annotate src/glyphs.c @ 408:501cfd01ee6d r21-2-34

Import from CVS: tag r21-2-34
author cvs
date Mon, 13 Aug 2007 11:18:11 +0200
parents b8cc9ab3f761
children de805c49cfc1
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
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
727 assert ( XIMAGE_INSTANCE_HEIGHT (ii)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
728 != IMAGE_UNSPECIFIED_GEOMETRY
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
729 && XIMAGE_INSTANCE_WIDTH (ii)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
730 != IMAGE_UNSPECIFIED_GEOMETRY);
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 ERROR_CHECK_IMAGE_INSTANCE (ii);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
733
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
734 RETURN_UNGCPRO (ii);
0
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 * Image-Instance Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 Lisp_Object Qimage_instancep;
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
743
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 static Lisp_Object
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
745 mark_image_instance (Lisp_Object obj)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
747 Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
748
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
749 /* #### 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
750 many instances of the instance being marked while the domain is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
751 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
752 callback_ex.*/
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
753 #if 0
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
754 ERROR_CHECK_IMAGE_INSTANCE (obj);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
755 #endif
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
756
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
757 mark_object (i->name);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
758 /* 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
759 domain has been deleted - making the instance unusable. It seems
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
760 better to remove the domain so that it can be finalized. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
761 if (!DOMAIN_LIVE_P (i->domain))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
762 i->domain = Qnil;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
763 else
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
764 mark_object (i->domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
765
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
766 /* 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
767 circularity preventing GC. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 switch (IMAGE_INSTANCE_TYPE (i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 case IMAGE_TEXT:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
771 mark_object (IMAGE_INSTANCE_TEXT_STRING (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 case IMAGE_COLOR_PIXMAP:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
775 mark_object (IMAGE_INSTANCE_PIXMAP_FILENAME (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
776 mark_object (IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
777 mark_object (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
778 mark_object (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
779 mark_object (IMAGE_INSTANCE_PIXMAP_FG (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
780 mark_object (IMAGE_INSTANCE_PIXMAP_BG (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 break;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
782
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
783 case IMAGE_WIDGET:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
784 mark_object (IMAGE_INSTANCE_WIDGET_TYPE (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
785 mark_object (IMAGE_INSTANCE_WIDGET_PROPS (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
786 mark_object (IMAGE_INSTANCE_WIDGET_FACE (i));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
787 mark_object (IMAGE_INSTANCE_WIDGET_ITEMS (i));
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
788 mark_object (IMAGE_INSTANCE_LAYOUT_CHILDREN (i));
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
789 mark_object (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (i));
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
790 mark_object (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i));
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
791 mark_object (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 case IMAGE_SUBWINDOW:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 break;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
794
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
799 /* The image may have been previously finalized (yes that's wierd,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
800 see Fdelete_frame() and mark_window_as_deleted()), in which case
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
801 the domain will be nil, so cope with this. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
802 if (!NILP (IMAGE_INSTANCE_DEVICE (i)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
803 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
804 mark_image_instance, (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
806 return i->device;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 print_image_instance (Lisp_Object obj, Lisp_Object printcharfun,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 int escapeflag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 char buf[100];
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
814 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 if (print_readably)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 error ("printing unreadable object #<image-instance 0x%x>",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ii->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 write_c_string ("#<image-instance (", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 print_internal (Fimage_instance_type (obj), printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 write_c_string (") ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 if (!NILP (ii->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 print_internal (ii->name, printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 write_c_string (" ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 write_c_string ("on ", printcharfun);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
828 print_internal (ii->domain, printcharfun, 0);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 write_c_string (" ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 switch (IMAGE_INSTANCE_TYPE (ii))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 print_internal (IMAGE_INSTANCE_TEXT_STRING (ii), printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 if (STRINGP (IMAGE_INSTANCE_PIXMAP_FILENAME (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 char *s;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 Lisp_Object filename = IMAGE_INSTANCE_PIXMAP_FILENAME (ii);
14
9ee227acff29 Import from CVS: tag r19-15b90
cvs
parents: 0
diff changeset
846 s = strrchr ((char *) XSTRING_DATA (filename), '/');
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 if (s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 print_internal (build_string (s + 1), printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 print_internal (filename, printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 if (IMAGE_INSTANCE_PIXMAP_DEPTH (ii) > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 sprintf (buf, " %dx%dx%d", IMAGE_INSTANCE_PIXMAP_WIDTH (ii),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 IMAGE_INSTANCE_PIXMAP_DEPTH (ii));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 sprintf (buf, " %dx%d", IMAGE_INSTANCE_PIXMAP_WIDTH (ii),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 !NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 write_c_string (" @", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 {
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
866 long_to_string (buf, XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 write_c_string ("??", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 write_c_string (",", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 {
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
874 long_to_string (buf, XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 write_c_string ("??", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii)) ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 !NILP (IMAGE_INSTANCE_PIXMAP_BG (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 write_c_string (" (", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 if (!NILP (IMAGE_INSTANCE_PIXMAP_FG (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 print_internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 (XCOLOR_INSTANCE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 (IMAGE_INSTANCE_PIXMAP_FG (ii))->name, printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 write_c_string ("/", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 if (!NILP (IMAGE_INSTANCE_PIXMAP_BG (ii)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 print_internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 (XCOLOR_INSTANCE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (IMAGE_INSTANCE_PIXMAP_BG (ii))->name, printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 write_c_string (")", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
901 case IMAGE_WIDGET:
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
902 print_internal (IMAGE_INSTANCE_WIDGET_TYPE (ii), printcharfun, 0);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
903
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
904 if (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_ITEM (ii)))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
905 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
906 write_c_string (" ", printcharfun);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
907 print_internal (IMAGE_INSTANCE_WIDGET_TEXT (ii), printcharfun, 1);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
908 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
909
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
910 if (!NILP (IMAGE_INSTANCE_WIDGET_FACE (ii)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
911 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
912 write_c_string (" face=", printcharfun);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
913 print_internal
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
914 (IMAGE_INSTANCE_WIDGET_FACE (ii), printcharfun, 0);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
915 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
916
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
917
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 case IMAGE_SUBWINDOW:
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
919 sprintf (buf, " %dx%d", IMAGE_INSTANCE_WIDTH (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
920 IMAGE_INSTANCE_HEIGHT (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
921 write_c_string (buf, printcharfun);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
922
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
923 /* 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
924 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
925 description what that frame is. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
926
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
927 write_c_string (" on #<", printcharfun);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
928 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
929 struct frame* f = XFRAME (IMAGE_INSTANCE_FRAME (ii));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
930
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
931 if (!FRAME_LIVE_P (f))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
932 write_c_string ("dead", printcharfun);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
933 else
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
934 write_c_string (DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f))),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
935 printcharfun);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
936 }
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
937 write_c_string ("-frame>", printcharfun);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
938 sprintf (buf, " 0x%p", IMAGE_INSTANCE_SUBWINDOW_ID (ii));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
939 write_c_string (buf, printcharfun);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
940
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
947 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), print_image_instance,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 (ii, printcharfun, escapeflag));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 sprintf (buf, " 0x%x>", ii->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 finalize_image_instance (void *header, int for_disksave)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
956 Lisp_Image_Instance *i = (Lisp_Image_Instance *) header;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
958 /* 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
959 if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
960 ||
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
961 NILP (IMAGE_INSTANCE_DEVICE (i)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 if (for_disksave) finalose (i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
965 /* We can't use the domain here, because it might have
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
966 disappeared. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
967 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
968 finalize_image_instance, (i));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
969
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
970 /* Make sure we don't try this twice. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
971 IMAGE_INSTANCE_DEVICE (i) = Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 static int
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
975 image_instance_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
977 Lisp_Image_Instance *i1 = XIMAGE_INSTANCE (obj1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
978 Lisp_Image_Instance *i2 = XIMAGE_INSTANCE (obj2);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
979
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
980 ERROR_CHECK_IMAGE_INSTANCE (obj1);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
981 ERROR_CHECK_IMAGE_INSTANCE (obj2);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
982
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
983 if (!EQ (IMAGE_INSTANCE_DOMAIN (i1),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
984 IMAGE_INSTANCE_DOMAIN (i2))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
985 || IMAGE_INSTANCE_TYPE (i1) != IMAGE_INSTANCE_TYPE (i2)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
986 || IMAGE_INSTANCE_WIDTH (i1) != IMAGE_INSTANCE_WIDTH (i2)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
987 || IMAGE_INSTANCE_MARGIN_WIDTH (i1) !=
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
988 IMAGE_INSTANCE_MARGIN_WIDTH (i2)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
989 || IMAGE_INSTANCE_HEIGHT (i1) != IMAGE_INSTANCE_HEIGHT (i2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
990 || IMAGE_INSTANCE_XOFFSET (i1) != IMAGE_INSTANCE_XOFFSET (i2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
991 || IMAGE_INSTANCE_YOFFSET (i1) != IMAGE_INSTANCE_YOFFSET (i2))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 if (!internal_equal (IMAGE_INSTANCE_NAME (i1), IMAGE_INSTANCE_NAME (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 depth + 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 switch (IMAGE_INSTANCE_TYPE (i1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 if (!internal_equal (IMAGE_INSTANCE_TEXT_STRING (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 IMAGE_INSTANCE_TEXT_STRING (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 depth + 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 case IMAGE_POINTER:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1012 if (!(IMAGE_INSTANCE_PIXMAP_DEPTH (i1) ==
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 IMAGE_INSTANCE_PIXMAP_DEPTH (i2) &&
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1014 IMAGE_INSTANCE_PIXMAP_SLICE (i1) ==
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1015 IMAGE_INSTANCE_PIXMAP_SLICE (i2) &&
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 EQ (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (i2)) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 EQ (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (i2)) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 internal_equal (IMAGE_INSTANCE_PIXMAP_FILENAME (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 IMAGE_INSTANCE_PIXMAP_FILENAME (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 depth + 1) &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 internal_equal (IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i1),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (i2),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 depth + 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1029 case IMAGE_WIDGET:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1030 if (!(EQ (IMAGE_INSTANCE_WIDGET_TYPE (i1),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1031 IMAGE_INSTANCE_WIDGET_TYPE (i2))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1032 && IMAGE_INSTANCE_SUBWINDOW_ID (i1) ==
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1033 IMAGE_INSTANCE_SUBWINDOW_ID (i2)
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1034 &&
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1035 EQ (IMAGE_INSTANCE_WIDGET_FACE (i1),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1036 IMAGE_INSTANCE_WIDGET_TYPE (i2))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1037 && internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (i1),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1038 IMAGE_INSTANCE_WIDGET_ITEMS (i2),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1039 depth + 1)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1040 && internal_equal (IMAGE_INSTANCE_LAYOUT_CHILDREN (i1),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1041 IMAGE_INSTANCE_LAYOUT_CHILDREN (i2),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1042 depth + 1)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1043 && internal_equal (IMAGE_INSTANCE_WIDGET_PROPS (i1),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1044 IMAGE_INSTANCE_WIDGET_PROPS (i2),
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1045 depth + 1)
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1046 && internal_equal (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i1),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1047 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i2),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1048 depth + 1)
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1049 && internal_equal (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i1),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1050 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i2),
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1051 depth + 1)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1052 ))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1053 return 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1054 break;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1055
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 case IMAGE_SUBWINDOW:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1057 if (!(IMAGE_INSTANCE_SUBWINDOW_ID (i1) ==
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1058 IMAGE_INSTANCE_SUBWINDOW_ID (i2)))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1059 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1066 return DEVMETH_OR_GIVEN (DOMAIN_XDEVICE (i1->domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1067 image_instance_equal, (i1, i2, depth), 1);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1068 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1069
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1070 /* Image instance domain manipulators. We can't error check in these
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1071 otherwise we get into infinite recursion. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1072 Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1073 image_instance_device (Lisp_Object 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 return XIMAGE_INSTANCE_DEVICE (instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1076 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1077
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1078 Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1079 image_instance_frame (Lisp_Object 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 return XIMAGE_INSTANCE_FRAME (instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1082 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1083
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1084 Lisp_Object
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1085 image_instance_window (Lisp_Object 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 return DOMAIN_WINDOW (XIMAGE_INSTANCE_DOMAIN (instance));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1088 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1089
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1090 int
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1091 image_instance_live_p (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1092 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1093 return DOMAIN_LIVE_P (XIMAGE_INSTANCE_DOMAIN (instance));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1094 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1095
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1096 static unsigned long
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 image_instance_hash (Lisp_Object obj, int depth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1099 Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1100 unsigned long hash = HASH4 (LISP_HASH (IMAGE_INSTANCE_DOMAIN (i)),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1101 IMAGE_INSTANCE_WIDTH (i),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1102 IMAGE_INSTANCE_MARGIN_WIDTH (i),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1103 IMAGE_INSTANCE_HEIGHT (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1105 ERROR_CHECK_IMAGE_INSTANCE (obj);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1106
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 switch (IMAGE_INSTANCE_TYPE (i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 case IMAGE_NOTHING:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 case IMAGE_TEXT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 hash = HASH2 (hash, internal_hash (IMAGE_INSTANCE_TEXT_STRING (i),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 depth + 1));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 case IMAGE_POINTER:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1120 hash = HASH4 (hash, IMAGE_INSTANCE_PIXMAP_DEPTH (i),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1121 IMAGE_INSTANCE_PIXMAP_SLICE (i),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 internal_hash (IMAGE_INSTANCE_PIXMAP_FILENAME (i),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 depth + 1));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1126 case IMAGE_WIDGET:
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1127 /* We need the hash to be equivalent to what should be
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1128 displayed. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1129 hash = HASH5 (hash,
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
1130 LISP_HASH (IMAGE_INSTANCE_WIDGET_TYPE (i)),
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
1131 internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1132 internal_hash (IMAGE_INSTANCE_WIDGET_ITEMS (i), depth + 1),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1133 internal_hash (IMAGE_INSTANCE_LAYOUT_CHILDREN (i),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1134 depth + 1));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 case IMAGE_SUBWINDOW:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1136 hash = HASH2 (hash, (int) IMAGE_INSTANCE_SUBWINDOW_ID (i));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1143 return HASH2 (hash, DEVMETH_OR_GIVEN
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1144 (XDEVICE (image_instance_device (obj)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1145 image_instance_hash, (i, depth),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1146 0));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1149 DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1150 mark_image_instance, print_image_instance,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1151 finalize_image_instance, image_instance_equal,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1152 image_instance_hash, 0,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1153 Lisp_Image_Instance);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1154
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 static Lisp_Object
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1156 allocate_image_instance (Lisp_Object governing_domain, Lisp_Object glyph)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1158 Lisp_Image_Instance *lp =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1159 alloc_lcrecord_type (Lisp_Image_Instance, &lrecord_image_instance);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1160 Lisp_Object val;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 zero_lcrecord (lp);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1163 /* 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
1164 the instance was instantiated. This is because caching may mean
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1165 that the domain becomes invalid but the instance remains
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1166 valid. However, the only truly relevant domain is the domain in
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1167 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
1168 common to the instances. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1169 lp->domain = governing_domain;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1170 /* 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
1171 deleted before the image instance does. We need to know the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1172 domain device in order to finalize the image instance
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1173 properly. We therefore record the device also. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1174 lp->device = DOMAIN_DEVICE (governing_domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 lp->type = IMAGE_NOTHING;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 lp->name = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1177 lp->x_offset = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1178 lp->y_offset = 0;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1179 lp->width = IMAGE_UNSPECIFIED_GEOMETRY;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1180 lp->margin_width = 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1181 lp->height = IMAGE_UNSPECIFIED_GEOMETRY;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1182 lp->parent = glyph;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1183 /* So that layouts get done. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1184 lp->layout_changed = 1;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1185 lp->initialized = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1186
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 XSETIMAGE_INSTANCE (val, lp);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1188 MARK_GLYPHS_CHANGED;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1189
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 static enum image_instance_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 decode_image_instance_type (Lisp_Object type, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 CHECK_SYMBOL (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1199 if (EQ (type, Qnothing)) return IMAGE_NOTHING;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1200 if (EQ (type, Qtext)) return IMAGE_TEXT;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1201 if (EQ (type, Qmono_pixmap)) return IMAGE_MONO_PIXMAP;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1202 if (EQ (type, Qcolor_pixmap)) return IMAGE_COLOR_PIXMAP;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1203 if (EQ (type, Qpointer)) return IMAGE_POINTER;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1204 if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1205 if (EQ (type, Qwidget)) return IMAGE_WIDGET;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 maybe_signal_simple_error ("Invalid image-instance type", type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 Qimage, errb);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1209
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1210 return IMAGE_UNKNOWN; /* not reached */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 encode_image_instance_type (enum image_instance_type type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 switch (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1218 case IMAGE_NOTHING: return Qnothing;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1219 case IMAGE_TEXT: return Qtext;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1220 case IMAGE_MONO_PIXMAP: return Qmono_pixmap;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1221 case IMAGE_COLOR_PIXMAP: return Qcolor_pixmap;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1222 case IMAGE_POINTER: return Qpointer;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1223 case IMAGE_SUBWINDOW: return Qsubwindow;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1224 case IMAGE_WIDGET: return Qwidget;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 return Qnil; /* not reached */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 decode_image_instance_type_list (Lisp_Object list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 Lisp_Object rest;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 int mask = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 if (NILP (list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 return ~0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 if (!CONSP (list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 enum image_instance_type type =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 decode_image_instance_type (list, ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 return image_instance_type_to_mask (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 EXTERNAL_LIST_LOOP (rest, list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 enum image_instance_type type =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 decode_image_instance_type (XCAR (rest), ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 mask |= image_instance_type_to_mask (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 return mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 encode_image_instance_type_list (int mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 int count = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 Lisp_Object result = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 while (mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 count++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 if (mask & 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 result = Fcons (encode_image_instance_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 ((enum image_instance_type) count), result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 mask >>= 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 return Fnreverse (result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 DOESNT_RETURN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 incompatible_image_types (Lisp_Object instantiator, int given_dest_mask,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 int desired_dest_mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 signal_error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 (Qerror,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 list2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 (emacs_doprnt_string_lisp_2
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1284 ((const Bufbyte *)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 "No compatible image-instance types given: wanted one of %s, got %s",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 Qnil, -1, 2,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 encode_image_instance_type_list (desired_dest_mask),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 encode_image_instance_type_list (given_dest_mask)),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 valid_image_instance_type_p (Lisp_Object type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1295 return !NILP (memq_no_quit (type, Vimage_instance_type_list));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1298 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
1299 Given an IMAGE-INSTANCE-TYPE, return non-nil if it is valid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 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
1301 'pointer, 'subwindow, and 'widget, depending on how XEmacs was compiled.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1302 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1303 (image_instance_type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1305 return valid_image_instance_type_p (image_instance_type) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1308 DEFUN ("image-instance-type-list", Fimage_instance_type_list, 0, 0, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 Return a list of valid image-instance types.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1310 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1311 ())
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 return Fcopy_sequence (Vimage_instance_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 Error_behavior
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 decode_error_behavior_flag (Lisp_Object no_error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1319 if (NILP (no_error)) return ERROR_ME;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1320 else if (EQ (no_error, Qt)) return ERROR_ME_NOT;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
1321 else return ERROR_ME_WARN;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 encode_error_behavior_flag (Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 else if (ERRB_EQ (errb, ERROR_ME_NOT))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 return Qt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 assert (ERRB_EQ (errb, ERROR_ME_WARN));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 return Qwarning;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1338 /* Recurse up the hierarchy looking for the topmost glyph. This means
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1339 that instances in layouts will inherit face properties from their
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1340 parent. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1341 Lisp_Object image_instance_parent_glyph (Lisp_Image_Instance* ii)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1342 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1343 if (IMAGE_INSTANCEP (IMAGE_INSTANCE_PARENT (ii)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1344 {
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
1345 return image_instance_parent_glyph
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1346 (XIMAGE_INSTANCE (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 return IMAGE_INSTANCE_PARENT (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1349 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1350
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 static Lisp_Object
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1352 make_image_instance_1 (Lisp_Object data, Lisp_Object domain,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 Lisp_Object dest_types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 Lisp_Object ii;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 int dest_mask;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1358 Lisp_Object governing_domain;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1359
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 if (IMAGE_INSTANCEP (data))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1361 signal_simple_error ("Image instances not allowed here", data);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 image_validate (data);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1363 domain = decode_domain (domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1364 /* instantiate_image_instantiator() will abort if given an
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1365 image instance ... */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 dest_mask = decode_image_instance_type_list (dest_types);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1367 data = normalize_image_instantiator (data,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1368 DEVICE_TYPE (DOMAIN_XDEVICE (domain)),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 make_int (dest_mask));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 GCPRO1 (data);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1371 /* 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
1372 we filtered out above) or a vector. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1373 if (EQ (XVECTOR_DATA (data)[0], Qinherit))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
1374 signal_simple_error ("Inheritance not allowed here", data);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1375 governing_domain =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1376 get_image_instantiator_governing_domain (data, domain);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1377 ii = instantiate_image_instantiator (governing_domain, domain, data,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1378 Qnil, Qnil, dest_mask, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 RETURN_UNGCPRO (ii);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1382 DEFUN ("make-image-instance", Fmake_image_instance, 1, 4, 0, /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1383 Return a new `image-instance' object.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 Image-instance objects encapsulate the way a particular image (pixmap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 etc.) is displayed on a particular device. In most circumstances, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 do not need to directly create image instances; use a glyph instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 However, it may occasionally be useful to explicitly create image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 instances, if you want more control over the instantiation process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 DATA is an image instantiator, which describes the image; see
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1392 `make-image-specifier' for a description of the allowed values.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 DEST-TYPES should be a list of allowed image instance types that can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 be generated. The recognized image instance types are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 'nothing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 Nothing is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 'text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 Displayed as text. The foreground and background colors and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 font of the text are specified independent of the pixmap. Typically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 these attributes will come from the face of the surrounding text,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 unless a face is specified for the glyph in which the image appears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 'mono-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 Displayed as a mono pixmap (a pixmap with only two colors where the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 foreground and background can be specified independent of the pixmap;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 typically the pixmap assumes the foreground and background colors of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 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
1409 the image appears).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 'color-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 Displayed as a color pixmap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 'pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 Used as the mouse pointer for a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 'subwindow
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 A child window that is treated as an image. This allows (e.g.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 another program to be responsible for drawing into the window.
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1417 'widget
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1418 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
1419 button, text field, or slider.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1420
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1421 The DEST-TYPES list is unordered. If multiple destination types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1422 possible for a given instantiator, the "most natural" type for the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1423 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
1424 `mono-pixmap', followed by `color-pixmap', followed by `pointer'. For
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1425 the other normal image formats, the most natural types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1426 `color-pixmap', followed by `mono-pixmap', followed by `pointer'. For
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1427 the string and formatted-string formats, the most natural types are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1428 `text', followed by `mono-pixmap' (not currently implemented),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1429 followed by `color-pixmap' (not currently implemented). For MS
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1430 Windows resources, the most natural type for pointer resources is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1431 `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
1432 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
1433 specifically the order of the types into which an image is
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1434 instantiated, just call `make-image-instance' repeatedly until it
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1435 succeeds, passing less and less preferred destination types each
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1436 time.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1437
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1438 See `make-image-specifier' for a description of the different image
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1439 instantiator formats.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 If DEST-TYPES is omitted, all possible types are allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1443 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
1444 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
1445 domain depends on the image instantiator format. (Although, more correctly,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1446 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
1447 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
1448 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
1449 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
1450 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
1451 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
1452 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
1453 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
1454 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
1455 some XEmacs window.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1456
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1457 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
1458 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
1459 \(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
1460 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
1461 difference whether you specify an overly specific domain or the properly
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1462 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
1463 image instance by instantiating a specifier or glyph (e.g. with
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1464 `glyph-image-instance'), because the more specific domain causes spec lookup
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1465 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
1466 when creating an image instance with an instantiator format of `inherit',
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1467 but we currently disallow this. #### We should fix this.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1468
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1469 If omitted, DOMAIN defaults to the selected window.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1470
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 NO-ERROR controls what happens when the image cannot be generated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 If nil, an error message is generated. If t, no messages are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 generated and this function returns nil. If anything else, a warning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 message is generated and this function returns nil.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1475 */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1476 (data, domain, dest_types, no_error))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 Error_behavior errb = decode_error_behavior_flag (no_error);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
1480 return call_with_suspended_errors ((lisp_fn_t) make_image_instance_1,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 Qnil, Qimage, errb,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1482 3, data, domain, dest_types);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1485 DEFUN ("image-instance-p", Fimage_instance_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 Return non-nil if OBJECT is an image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1487 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1488 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1490 return IMAGE_INSTANCEP (object) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1493 DEFUN ("image-instance-type", Fimage_instance_type, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 Return the type of the given image instance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 The return value will be one of 'nothing, 'text, 'mono-pixmap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 'color-pixmap, 'pointer, or 'subwindow.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1497 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1498 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1501 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 return encode_image_instance_type (XIMAGE_INSTANCE_TYPE (image_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1505 DEFUN ("image-instance-name", Fimage_instance_name, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 Return the name of the given image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1507 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1508 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 CHECK_IMAGE_INSTANCE (image_instance);
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1511 return XIMAGE_INSTANCE_NAME (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1514 DEFUN ("image-instance-domain", Fimage_instance_domain, 1, 1, 0, /*
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1515 Return the governing domain of the given image instance.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1516 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
1517 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
1518 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
1519 of this image instance. See `make-image-instance' for more information
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1520 on governing domains.
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 (image_instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1523 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1524 CHECK_IMAGE_INSTANCE (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1525 return XIMAGE_INSTANCE_DOMAIN (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1526 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1527
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1528 DEFUN ("image-instance-string", Fimage_instance_string, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 Return the string of the given image instance.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1530 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
1531 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1532 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 CHECK_IMAGE_INSTANCE (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_TEXT)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1536 return XIMAGE_INSTANCE_TEXT_STRING (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1537 else if (XIMAGE_INSTANCE_TYPE (image_instance) == IMAGE_WIDGET)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1538 return XIMAGE_INSTANCE_WIDGET_TEXT (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1543 DEFUN ("image-instance-property", Fimage_instance_property, 2, 2, 0, /*
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1544 Return the given property of the given image instance.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1545 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
1546 the image instance in the domain.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1547 */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1548 (image_instance, prop))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1549 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1550 Lisp_Image_Instance* ii;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1551 Lisp_Object type, ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1552 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1553
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1554 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1555 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1556 CHECK_SYMBOL (prop);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1557 ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1558
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1559 /* ... then try device specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1560 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1561 meths = decode_device_ii_format (image_instance_device (image_instance),
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1562 type, ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1563 if (meths && HAS_IIFORMAT_METH_P (meths, property)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1564 &&
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1565 !UNBOUNDP (ret = IIFORMAT_METH (meths, property, (image_instance, prop))))
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 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1568 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1569 /* ... then format specific methods ... */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1570 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1571 if (meths && HAS_IIFORMAT_METH_P (meths, property)
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 !UNBOUNDP (ret = IIFORMAT_METH (meths, property, (image_instance, prop))))
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 return ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1576 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1577 /* ... then fail */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1578 return Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1579 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1580
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1581 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
1582 Set the given property of the given image instance.
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1583 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
1584 the image instance in the domain.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1585
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1586 WARNING: If you are thinking about using this function, think again.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1587 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
1588 specifier. Be especially wary if you are thinking of calling this
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1589 function after having called `glyph-image-instance'. Unless you are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1590 absolutely sure what you're doing, pretty much the only legitimate
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1591 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
1592 such as text in a text field. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1593 (image_instance, prop, val))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1594 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1595 Lisp_Image_Instance* ii;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1596 Lisp_Object type, ret;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1597 struct image_instantiator_methods* meths;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1598
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1599 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1600 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1601 CHECK_SYMBOL (prop);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1602 ii = XIMAGE_INSTANCE (image_instance);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1603 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1604 /* try device specific methods first ... */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1605 meths = decode_device_ii_format (image_instance_device (image_instance),
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1606 type, ERROR_ME_NOT);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1607 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1608 &&
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1609 !UNBOUNDP (ret =
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1610 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
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 val = ret;
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 else
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1615 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1616 /* ... then format specific methods ... */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1617 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1618 if (meths && HAS_IIFORMAT_METH_P (meths, set_property)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1619 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1620 !UNBOUNDP (ret =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1621 IIFORMAT_METH (meths, set_property, (image_instance, prop, val))))
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 val = ret;
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 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1626 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1627 val = Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1628 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1629 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1630
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1631 /* Make sure the image instance gets redisplayed. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1632 set_image_instance_dirty_p (image_instance, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1633 /* Force the glyph to be laid out again. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1634 IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1635
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1636 MARK_SUBWINDOWS_STATE_CHANGED;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1637 MARK_GLYPHS_CHANGED;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1638
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1639 return val;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1640 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1641
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1642 DEFUN ("image-instance-file-name", Fimage_instance_file_name, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 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
1644 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1645 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1648 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 return XIMAGE_INSTANCE_PIXMAP_FILENAME (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1662 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
1663 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
1664 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1665 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1668 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 return XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1682 DEFUN ("image-instance-depth", Fimage_instance_depth, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 Return the depth of the image instance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 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
1685 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1686 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1689 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 case IMAGE_POINTER:
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
1696 return make_int (XIMAGE_INSTANCE_PIXMAP_DEPTH (image_instance));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1703 DEFUN ("image-instance-height", Fimage_instance_height, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 Return the height of the image instance, in pixels.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1705 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1706 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1709 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 case IMAGE_POINTER:
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1716 case IMAGE_SUBWINDOW:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1717 case IMAGE_WIDGET:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1718 return make_int (XIMAGE_INSTANCE_HEIGHT (image_instance));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1719
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1725 DEFUN ("image-instance-width", Fimage_instance_width, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 Return the width of the image instance, in pixels.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1727 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1728 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1731 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 case IMAGE_POINTER:
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1738 case IMAGE_SUBWINDOW:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1739 case IMAGE_WIDGET:
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1740 return make_int (XIMAGE_INSTANCE_WIDTH (image_instance));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1741
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1747 DEFUN ("image-instance-hotspot-x", Fimage_instance_hotspot_x, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 Return the X coordinate of the image instance's hotspot, if known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 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
1750 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
1751 over the location that the pointer points to. This is, for example, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 tip of the arrow or the center of the crosshairs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 This will always be nil for a non-pointer image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1754 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1755 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1758 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 return XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1772 DEFUN ("image-instance-hotspot-y", Fimage_instance_hotspot_y, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 Return the Y coordinate of the image instance's hotspot, if known.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 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
1775 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
1776 over the location that the pointer points to. This is, for example, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 tip of the arrow or the center of the crosshairs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 This will always be nil for a non-pointer image instance.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1779 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1780 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1783 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 return XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1797 DEFUN ("image-instance-foreground", Fimage_instance_foreground, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 Return the foreground color of IMAGE-INSTANCE, if applicable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 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
1800 colorized mono pixmaps and for pointers.)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1801 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1802 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1805 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 return XIMAGE_INSTANCE_PIXMAP_FG (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1814 case IMAGE_WIDGET:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1815 return FACE_FOREGROUND (
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1816 XIMAGE_INSTANCE_WIDGET_FACE (image_instance),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1817 XIMAGE_INSTANCE_FRAME
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1818 (image_instance));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1819
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1825 DEFUN ("image-instance-background", Fimage_instance_background, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 Return the background color of IMAGE-INSTANCE, if applicable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 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
1828 colorized mono pixmaps and for pointers.)
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1829 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1830 (image_instance))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1833 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 switch (XIMAGE_INSTANCE_TYPE (image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 case IMAGE_MONO_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 case IMAGE_COLOR_PIXMAP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 case IMAGE_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 return XIMAGE_INSTANCE_PIXMAP_BG (image_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1842 case IMAGE_WIDGET:
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1843 return FACE_BACKGROUND (
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1844 XIMAGE_INSTANCE_WIDGET_FACE (image_instance),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1845 XIMAGE_INSTANCE_FRAME
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1846 (image_instance));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
1847
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1854 DEFUN ("colorize-image-instance", Fcolorize_image_instance, 3, 3, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 Make the image instance be displayed in the given colors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 This function returns a new image instance that is exactly like the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 specified one except that (if possible) the foreground and background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 colors and as specified. Currently, this only does anything if the image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 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
1860 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
1861 (image_instance, foreground, background))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 Lisp_Object new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 Lisp_Object device;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 CHECK_IMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1867 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 CHECK_COLOR_INSTANCE (foreground);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 CHECK_COLOR_INSTANCE (background);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1871 device = image_instance_device (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 if (!HAS_DEVMETH_P (XDEVICE (device), colorize_image_instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 return image_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1875 /* #### There should be a copy_image_instance(), which calls a
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1876 device-specific method to copy the window-system subobject. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1877 new = allocate_image_instance (XIMAGE_INSTANCE_DOMAIN (image_instance),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1878 Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 copy_lcrecord (XIMAGE_INSTANCE (new), XIMAGE_INSTANCE (image_instance));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 /* note that if this method returns non-zero, this method MUST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 copy any window-system resources, so that when one image instance is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 freed, the other one is not hosed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 if (!DEVMETH (XDEVICE (device), colorize_image_instance, (new, foreground,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 background)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 return image_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 return new;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1889
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 /* Geometry calculations */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1892 /************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1893
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1894 /* 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
1895 special function then just return the width and / or height. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1896 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1897 image_instance_query_geometry (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1898 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1899 enum image_instance_geometry disp,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1900 Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1901 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1902 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1903 Lisp_Object type;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1904 struct image_instantiator_methods* meths;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1905 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1906
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1907 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1908 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
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 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1911 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1912 IIFORMAT_METH (meths, query_geometry, (image_instance, width, height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1913 disp, domain));
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 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1916 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1917 if (width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1918 *width = IMAGE_INSTANCE_WIDTH (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1919 if (height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1920 *height = IMAGE_INSTANCE_HEIGHT (ii);
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 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1923
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1924 /* Layout the image instance using the provided dimensions. Layout
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1925 widgets are going to do different kinds of calculations to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1926 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
1927 function relatively simple to take account of that. An alternative
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1928 approach is to consider separately the two cases, one where you
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1929 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
1930 want to specifiy something (layout widgets). */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1931 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1932 image_instance_layout (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1933 unsigned int width, unsigned int height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1934 Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1935 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1936 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1937 Lisp_Object type;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1938 struct image_instantiator_methods* meths;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1939
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1940 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1941
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1942 /* Nothing is as nothing does. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1943 if (NOTHING_IMAGE_INSTANCEP (image_instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1944 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1945
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1946 type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1947 meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT);
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 /* If geometry is unspecified then get some reasonable values for it. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1950 if (width == IMAGE_UNSPECIFIED_GEOMETRY
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1951 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1952 height == IMAGE_UNSPECIFIED_GEOMETRY)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1953 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1954 unsigned int dwidth = IMAGE_UNSPECIFIED_GEOMETRY,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1955 dheight = IMAGE_UNSPECIFIED_GEOMETRY;
398
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 /* Get the desired geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1958 if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1959 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1960 IIFORMAT_METH (meths, query_geometry, (image_instance, &dwidth, &dheight,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1961 IMAGE_DESIRED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1962 domain));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1963 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1964 else
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 dwidth = IMAGE_INSTANCE_WIDTH (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1967 dheight = IMAGE_INSTANCE_HEIGHT (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1968 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1969
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1970 /* Compare with allowed geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1971 if (width == IMAGE_UNSPECIFIED_GEOMETRY)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1972 width = dwidth;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1973 if (height == IMAGE_UNSPECIFIED_GEOMETRY)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1974 height = dheight;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1975 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1976
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1977 /* 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
1978 must just return. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1979 if (width == IMAGE_UNSPECIFIED_GEOMETRY
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1980 ||
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1981 height == IMAGE_UNSPECIFIED_GEOMETRY)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1982 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1983
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1984 /* At this point width and height should contain sane values. Thus
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1985 we set the glyph geometry and lay it out. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1986 if (IMAGE_INSTANCE_WIDTH (ii) != width
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1987 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1988 IMAGE_INSTANCE_HEIGHT (ii) != height)
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_SIZE_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1991 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1992
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1993 IMAGE_INSTANCE_WIDTH (ii) = width;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1994 IMAGE_INSTANCE_HEIGHT (ii) = height;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
1995
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1996 if (IIFORMAT_METH_OR_GIVEN (meths, layout,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1997 (image_instance, width, height, domain), 1))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
1998 /* 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
1999 us at the end. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2000 IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2001 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2002
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 * 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
2005 * (b) GLYPH_OR_II instance in W is a string.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2006 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2007 * Return non-zero if instance has been marked dirty.
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 int
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2010 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
2011 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2012 if (XFRAME(WINDOW_FRAME(w))->faces_changed)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2013 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2014 Lisp_Object image = glyph_or_ii;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2015
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2016 if (GLYPHP (glyph_or_ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2017 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2018 Lisp_Object window;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2019 XSETWINDOW (window, w);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2020 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
2021 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2022
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2023 if (TEXT_IMAGE_INSTANCEP (image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2024 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2025 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2026 IMAGE_INSTANCE_DIRTYP (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2027 IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2028 if (GLYPHP (glyph_or_ii))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2029 XGLYPH_DIRTYP (glyph_or_ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2030 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2031 }
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2034 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2035 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2036
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2038 /************************************************************************/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2039 /* error helpers */
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 DOESNT_RETURN
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2042 signal_image_error (const char *reason, Lisp_Object frob)
276
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 signal_error (Qimage_conversion_error,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2045 list2 (build_translated_string (reason), frob));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2046 }
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 DOESNT_RETURN
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2049 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
2050 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2051 signal_error (Qimage_conversion_error,
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2052 list3 (build_translated_string (reason), frob0, frob1));
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2053 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2054
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 * nothing *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2060 nothing_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 return IMAGE_NOTHING_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066 nothing_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2068 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2070 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 if (dest_mask & IMAGE_NOTHING_MASK)
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2073 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2074 IMAGE_INSTANCE_TYPE (ii) = IMAGE_NOTHING;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2075 IMAGE_INSTANCE_HEIGHT (ii) = 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2076 IMAGE_INSTANCE_WIDTH (ii) = 0;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2077 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 incompatible_image_types (instantiator, dest_mask, IMAGE_NOTHING_MASK);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081
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 * inherit *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 inherit_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 face_must_be_present (instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 inherit_normalize (Lisp_Object inst, Lisp_Object console_type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 Lisp_Object face;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
2098 assert (XVECTOR_LENGTH (inst) == 3);
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
2099 face = XVECTOR_DATA (inst)[2];
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 if (!FACEP (face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 inst = vector3 (Qinherit, Q_face, Fget_face (face));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 return inst;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2106 inherit_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108 return IMAGE_MONO_PIXMAP_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 inherit_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2114 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 /* handled specially in image_instantiate */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119
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 * string *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 string_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128 data_must_be_present (instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2132 string_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 return IMAGE_TEXT_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2137 /* Called from autodetect_instantiate() */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2141 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2143 Lisp_Object string = find_keyword_in_vector (instantiator, Q_data);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2144 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2145
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2146 /* 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
2147 assert (!NILP (string) && WINDOWP (DOMAIN_WINDOW (domain)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 if (dest_mask & IMAGE_TEXT_MASK)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 IMAGE_INSTANCE_TYPE (ii) = IMAGE_TEXT;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2151 IMAGE_INSTANCE_TEXT_STRING (ii) = string;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 incompatible_image_types (instantiator, dest_mask, IMAGE_TEXT_MASK);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2157 /* 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
2158 it dynamically allows us to change the text and still see
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2159 everything. Note that the following methods are for text not string
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2160 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
2161 helper that is used elsewhere for calculating text geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2162 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2163 query_string_geometry (Lisp_Object string, Lisp_Object face,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2164 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2165 unsigned int* descent, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2166 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2167 struct font_metric_info fm;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2168 unsigned char charsets[NUM_LEADING_BYTES];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2169 struct face_cachel frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2170 struct face_cachel *cachel;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2171 Lisp_Object frame = DOMAIN_FRAME (domain);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2172
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2173 /* Compute height */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2174 if (height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2175 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2176 /* Compute string metric info */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2177 find_charsets_in_bufbyte_string (charsets,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2178 XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2179 XSTRING_LENGTH (string));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2180
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2181 /* Fallback to the default face if none was provided. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2182 if (!NILP (face))
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 reset_face_cachel (&frame_cachel);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2185 update_face_cachel_data (&frame_cachel, frame, face);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2186 cachel = &frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2187 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2188 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2189 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2190 cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2191 DEFAULT_INDEX);
398
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2194 ensure_face_cachel_complete (cachel, domain, charsets);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2195 face_cachel_charset_font_metric_info (cachel, charsets, &fm);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2196
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2197 *height = fm.ascent + fm.descent;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2198 /* #### descent only gets set if we query the height as well. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2199 if (descent)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2200 *descent = fm.descent;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2203 /* Compute width */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2204 if (width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2205 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2206 if (!NILP (face))
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 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 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2211 *width = redisplay_frame_text_width_string (XFRAME (frame),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2212 Vdefault_face,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2213 0, string, 0, -1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2214 }
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2217 Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2218 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
2219 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2220 unsigned char charsets[NUM_LEADING_BYTES];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2221 struct face_cachel frame_cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2222 struct face_cachel *cachel;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2223 int i;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2224 Lisp_Object frame = DOMAIN_FRAME (domain);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2225
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2226 /* Compute string font info */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2227 find_charsets_in_bufbyte_string (charsets,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2228 XSTRING_DATA (string),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2229 XSTRING_LENGTH (string));
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 reset_face_cachel (&frame_cachel);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2232 update_face_cachel_data (&frame_cachel, frame, face);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2233 cachel = &frame_cachel;
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 ensure_face_cachel_complete (cachel, domain, charsets);
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 for (i = 0; i < NUM_LEADING_BYTES; i++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2238 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2239 if (charsets[i])
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 return FACE_CACHEL_FONT (cachel,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2242 CHARSET_BY_LEADING_BYTE (i +
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2243 MIN_LEADING_BYTE));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2244
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2248 return Qnil; /* NOT REACHED */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2249 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2250
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2251 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2252 text_query_geometry (Lisp_Object image_instance,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2253 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2254 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2255 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2256 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2257 unsigned int descent = 0;
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 query_string_geometry (IMAGE_INSTANCE_TEXT_STRING (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2260 IMAGE_INSTANCE_FACE (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2261 width, height, &descent, domain);
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 /* The descent gets set as a side effect of querying the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2264 geometry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2265 IMAGE_INSTANCE_TEXT_DESCENT (ii) = descent;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2266 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2267
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2268 /* set the properties of a string */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2269 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2270 text_set_property (Lisp_Object image_instance, Lisp_Object prop,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2271 Lisp_Object val)
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 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2274
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2275 if (EQ (prop, Q_data))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2276 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2277 CHECK_STRING (val);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2278 IMAGE_INSTANCE_TEXT_STRING (ii) = val;
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 return Qt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2281 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2282 return Qunbound;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2283 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2284
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 * formatted-string *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 formatted_string_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 data_must_be_present (instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296 static int
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
2297 formatted_string_possible_dest_types (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 return IMAGE_TEXT_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 formatted_string_instantiate (Lisp_Object image_instance,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
124
9b50b4588a93 Import from CVS: tag r20-1b15
cvs
parents: 122
diff changeset
2306 int dest_mask, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 /* #### implement this */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 warn_when_safe (Qunimplemented, Qnotice,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 "`formatted-string' not yet implemented; assuming `string'");
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2311
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2312 string_instantiate (image_instance, instantiator,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2313 pointer_fg, pointer_bg, dest_mask, domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2317 /************************************************************************/
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2318 /* pixmap file functions */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2319 /************************************************************************/
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 /* If INSTANTIATOR refers to inline data, return Qnil.
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2322 If INSTANTIATOR refers to data in a file, return the full filename
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2323 if it exists; otherwise, return a cons of (filename).
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2324
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2325 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2326 keywords used to look up the file and inline data,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2327 respectively, in the instantiator. Normally these would
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2328 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
2329
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2330 Lisp_Object
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2331 potential_pixmap_file_instantiator (Lisp_Object instantiator,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2332 Lisp_Object file_keyword,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2333 Lisp_Object data_keyword,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2334 Lisp_Object console_type)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2335 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2336 Lisp_Object file;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2337 Lisp_Object data;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2338
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2339 assert (VECTORP (instantiator));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2340
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2341 data = find_keyword_in_vector (instantiator, data_keyword);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2342 file = find_keyword_in_vector (instantiator, file_keyword);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2343
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2344 if (!NILP (file) && NILP (data))
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 Lisp_Object retval = MAYBE_LISP_CONTYPE_METH
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2347 (decode_console_type(console_type, ERROR_ME),
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2348 locate_pixmap_file, (file));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2349
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2350 if (!NILP (retval))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2351 return retval;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2352 else
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2353 return Fcons (file, Qnil); /* should have been file */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2354 }
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2355
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2356 return Qnil;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2357 }
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 Lisp_Object
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2360 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type,
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2361 Lisp_Object image_type_tag)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2362 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2363 /* This function can call lisp */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2364 Lisp_Object file = Qnil;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2365 struct gcpro gcpro1, gcpro2;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2366 Lisp_Object alist = Qnil;
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2367
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2368 GCPRO2 (file, alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2369
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2370 /* 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
2371 `data' will contain the inline data (if any) or Qnil, and `file'
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2372 will contain the name this data was derived from (if known) or
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2373 Qnil.
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2374
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2375 Note that if we cannot generate any regular inline data, we
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2376 skip out. */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2377
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2378 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2379 console_type);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2380
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2381 if (CONSP (file)) /* failure locating filename */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2382 signal_double_file_error ("Opening pixmap file",
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2383 "no such file or directory",
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2384 Fcar (file));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2385
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2386 if (NILP (file)) /* no conversion necessary */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2387 RETURN_UNGCPRO (inst);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2388
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2389 alist = tagged_vector_to_alist (inst);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2390
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2391 {
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2392 Lisp_Object data = make_string_from_file (file);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2393 alist = remassq_no_quit (Q_file, alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2394 /* there can't be a :data at this point. */
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2395 alist = Fcons (Fcons (Q_file, file),
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2396 Fcons (Fcons (Q_data, data), alist));
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2397 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2398
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 Lisp_Object result = alist_to_tagged_vector (image_type_tag, alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2401 free_alist (alist);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2402 RETURN_UNGCPRO (result);
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2403 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2404 }
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2405
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 276
diff changeset
2406
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2407 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2408 /**********************************************************************
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2409 * XBM *
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2410 **********************************************************************/
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 /* 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
2413 of (width height bits), with checking done on the dimensions).
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2414 If not, signal an error. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2415
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2416 static void
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2417 check_valid_xbm_inline (Lisp_Object data)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2418 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2419 Lisp_Object width, height, bits;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2420
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2421 if (!CONSP (data) ||
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2422 !CONSP (XCDR (data)) ||
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2423 !CONSP (XCDR (XCDR (data))) ||
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2424 !NILP (XCDR (XCDR (XCDR (data)))))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2425 signal_simple_error ("Must be list of 3 elements", 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 width = XCAR (data);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2428 height = XCAR (XCDR (data));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2429 bits = XCAR (XCDR (XCDR (data)));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2430
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2431 CHECK_STRING (bits);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2432
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2433 if (!NATNUMP (width))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2434 signal_simple_error ("Width must be a natural number", width);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2435
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2436 if (!NATNUMP (height))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2437 signal_simple_error ("Height must be a natural number", height);
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 if (((XINT (width) * XINT (height)) / 8) > XSTRING_CHAR_LENGTH (bits))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2440 signal_simple_error ("data is too short for width and height",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2441 vector3 (width, height, bits));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2442 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2443
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2444 /* Validate method for XBM's. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2445
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2446 static void
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2447 xbm_validate (Lisp_Object instantiator)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2448 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2449 file_or_data_must_be_present (instantiator);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2450 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2451
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2452 /* Given a filename that is supposed to contain XBM data, return
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2453 the inline representation of it as (width height bits). Return
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2454 the hotspot through XHOT and YHOT, if those pointers are not 0.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2455 If there is no hotspot, XHOT and YHOT will contain -1.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2456
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2457 If the function fails:
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 -- if OK_IF_DATA_INVALID is set and the data was invalid,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2460 return Qt.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2461 -- maybe return an error, or return Qnil.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2462 */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2463
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2464 #ifdef HAVE_X_WINDOWS
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2465 #include <X11/Xlib.h>
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2466 #else
290
c9fe270a4101 Import from CVS: tag r21-0b43
cvs
parents: 288
diff changeset
2467 #define XFree(data) free(data)
c9fe270a4101 Import from CVS: tag r21-0b43
cvs
parents: 288
diff changeset
2468 #endif
288
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 Lisp_Object
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2471 bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2472 int ok_if_data_invalid)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2473 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2474 unsigned int w, h;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2475 Extbyte *data;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2476 int result;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2477 const char *filename_ext;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2478
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2479 TO_EXTERNAL_FORMAT (LISP_STRING, name,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2480 C_STRING_ALLOCA, filename_ext,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2481 Qfile_name);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2482 result = read_bitmap_data_from_file (filename_ext, &w, &h,
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2483 &data, xhot, yhot);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2484
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2485 if (result == BitmapSuccess)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2486 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2487 Lisp_Object retval;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2488 int len = (w + 7) / 8 * h;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2489
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2490 retval = list3 (make_int (w), make_int (h),
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2491 make_ext_string (data, len, Qbinary));
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2492 XFree ((char *) data);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2493 return retval;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2494 }
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 switch (result)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2497 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2498 case BitmapOpenFailed:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2499 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2500 /* should never happen */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2501 signal_double_file_error ("Opening bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2502 "no such file or directory",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2503 name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2504 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2505 case BitmapFileInvalid:
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2506 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2507 if (ok_if_data_invalid)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2508 return Qt;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2509 signal_double_file_error ("Reading bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2510 "invalid data in file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2511 name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2512 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2513 case BitmapNoMemory:
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 signal_double_file_error ("Reading bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2516 "out of memory",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2517 name);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2518 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2519 default:
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 signal_double_file_error_2 ("Reading bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2522 "unknown error code",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2523 make_int (result), name);
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
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2527 return Qnil; /* not reached */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2528 }
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 Lisp_Object
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2531 xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2532 Lisp_Object mask_file, Lisp_Object console_type)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2533 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2534 /* This is unclean but it's fairly standard -- a number of the
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2535 bitmaps in /usr/include/X11/bitmaps use it -- so we support
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2536 it. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2537 if (NILP (mask_file)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2538 /* don't override explicitly specified mask data. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2539 && NILP (assq_no_quit (Q_mask_data, alist))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2540 && !NILP (file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2541 {
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 ("Mask"))));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2545 if (NILP (mask_file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2546 mask_file = MAYBE_LISP_CONTYPE_METH
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2547 (decode_console_type(console_type, ERROR_ME),
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2548 locate_pixmap_file, (concat2 (file, build_string ("msk"))));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2549 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2550
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2551 if (!NILP (mask_file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2552 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2553 Lisp_Object mask_data =
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2554 bitmap_to_lisp_data (mask_file, 0, 0, 0);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2555 alist = remassq_no_quit (Q_mask_file, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2556 /* there can't be a :mask-data at this point. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2557 alist = Fcons (Fcons (Q_mask_file, mask_file),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2558 Fcons (Fcons (Q_mask_data, mask_data), alist));
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
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2561 return alist;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2562 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2563
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2564 /* Normalize method for XBM's. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2565
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2566 static Lisp_Object
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2567 xbm_normalize (Lisp_Object inst, Lisp_Object console_type)
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 Lisp_Object file = Qnil, mask_file = Qnil;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2570 struct gcpro gcpro1, gcpro2, gcpro3;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2571 Lisp_Object alist = Qnil;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2572
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2573 GCPRO3 (file, mask_file, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2574
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2575 /* Now, convert any file data into inline data for both the regular
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2576 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
2577 the inline data (if any) or Qnil, and `file' will contain
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2578 the name this data was derived from (if known) or Qnil.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2579 Likewise for `mask_file' and `mask_data'.
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2580
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2581 Note that if we cannot generate any regular inline data, we
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2582 skip out. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2583
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2584 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2585 console_type);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2586 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2587 Q_mask_data, console_type);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2588
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2589 if (CONSP (file)) /* failure locating filename */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2590 signal_double_file_error ("Opening bitmap file",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2591 "no such file or directory",
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2592 Fcar (file));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2593
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2594 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2595 RETURN_UNGCPRO (inst);
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 alist = tagged_vector_to_alist (inst);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2598
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2599 if (!NILP (file))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2600 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2601 int xhot, yhot;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2602 Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2603 alist = remassq_no_quit (Q_file, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2604 /* there can't be a :data at this point. */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2605 alist = Fcons (Fcons (Q_file, file),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2606 Fcons (Fcons (Q_data, data), alist));
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2607
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2608 if (xhot != -1 && NILP (assq_no_quit (Q_hotspot_x, alist)))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2609 alist = Fcons (Fcons (Q_hotspot_x, make_int (xhot)),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2610 alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2611 if (yhot != -1 && NILP (assq_no_quit (Q_hotspot_y, alist)))
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2612 alist = Fcons (Fcons (Q_hotspot_y, make_int (yhot)),
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2613 alist);
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
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2616 alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2617
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 Lisp_Object result = alist_to_tagged_vector (Qxbm, alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2620 free_alist (alist);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2621 RETURN_UNGCPRO (result);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2622 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2623 }
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
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2626 static int
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2627 xbm_possible_dest_types (void)
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2628 {
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2629 return
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2630 IMAGE_MONO_PIXMAP_MASK |
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2631 IMAGE_COLOR_PIXMAP_MASK |
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2632 IMAGE_POINTER_MASK;
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2633 }
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2634
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2635 #endif
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2636
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
2637
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2638 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2639 /**********************************************************************
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2640 * X-Face *
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
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2643 static void
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2644 xface_validate (Lisp_Object instantiator)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2645 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2646 file_or_data_must_be_present (instantiator);
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
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2649 static Lisp_Object
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2650 xface_normalize (Lisp_Object inst, Lisp_Object console_type)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2651 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2652 /* This function can call lisp */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2653 Lisp_Object file = Qnil, mask_file = Qnil;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2654 struct gcpro gcpro1, gcpro2, gcpro3;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2655 Lisp_Object alist = Qnil;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2656
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2657 GCPRO3 (file, mask_file, alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2658
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2659 /* 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
2660 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
2661 the inline data (if any) or Qnil, and `file' will contain
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2662 the name this data was derived from (if known) or Qnil.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2663 Likewise for `mask_file' and `mask_data'.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2664
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2665 Note that if we cannot generate any regular inline data, we
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2666 skip out. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2667
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2668 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2669 console_type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2670 mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2671 Q_mask_data, console_type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2672
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2673 if (CONSP (file)) /* failure locating filename */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2674 signal_double_file_error ("Opening bitmap file",
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2675 "no such file or directory",
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2676 Fcar (file));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2677
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2678 if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2679 RETURN_UNGCPRO (inst);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2680
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2681 alist = tagged_vector_to_alist (inst);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2682
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2683 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2684 Lisp_Object data = make_string_from_file (file);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2685 alist = remassq_no_quit (Q_file, alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2686 /* there can't be a :data at this point. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2687 alist = Fcons (Fcons (Q_file, file),
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2688 Fcons (Fcons (Q_data, data), alist));
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
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2691 alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2692
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 Lisp_Object result = alist_to_tagged_vector (Qxface, alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2695 free_alist (alist);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2696 RETURN_UNGCPRO (result);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2697 }
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
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2700 static int
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2701 xface_possible_dest_types (void)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2702 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2703 return
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2704 IMAGE_MONO_PIXMAP_MASK |
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2705 IMAGE_COLOR_PIXMAP_MASK |
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2706 IMAGE_POINTER_MASK;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2707 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2708
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2709 #endif /* HAVE_XFACE */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2710
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
2711
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2712 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2713
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2714 /**********************************************************************
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2715 * XPM *
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2716 **********************************************************************/
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2717
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2718 Lisp_Object
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2719 pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2720 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2721 char **data;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2722 int result;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
2723 char *fname = 0;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2724
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2725 TO_EXTERNAL_FORMAT (LISP_STRING, name,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2726 C_STRING_ALLOCA, fname,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2727 Qfile_name);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
2728 result = XpmReadFileToData (fname, &data);
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2729
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2730 if (result == XpmSuccess)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2731 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2732 Lisp_Object retval = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2733 struct buffer *old_buffer = current_buffer;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2734 Lisp_Object temp_buffer =
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2735 Fget_buffer_create (build_string (" *pixmap conversion*"));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2736 int elt;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2737 int height, width, ncolors;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2738 struct gcpro gcpro1, gcpro2, gcpro3;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2739 int speccount = specpdl_depth ();
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2740
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2741 GCPRO3 (name, retval, temp_buffer);
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 specbind (Qinhibit_quit, Qt);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2744 set_buffer_internal (XBUFFER (temp_buffer));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2745 Ferase_buffer (Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2746
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2747 buffer_insert_c_string (current_buffer, "/* XPM */\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2748 buffer_insert_c_string (current_buffer, "static char *pixmap[] = {\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2749
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2750 sscanf (data[0], "%d %d %d", &height, &width, &ncolors);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2751 for (elt = 0; elt <= width + ncolors; elt++)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2752 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2753 buffer_insert_c_string (current_buffer, "\"");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2754 buffer_insert_c_string (current_buffer, data[elt]);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2755
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2756 if (elt < width + ncolors)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2757 buffer_insert_c_string (current_buffer, "\",\r");
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2758 else
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2759 buffer_insert_c_string (current_buffer, "\"};\r");
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
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2762 retval = Fbuffer_substring (Qnil, Qnil, Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2763 XpmFree (data);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2764
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2765 set_buffer_internal (old_buffer);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2766 unbind_to (speccount, Qnil);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2767
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2768 RETURN_UNGCPRO (retval);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2769 }
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 switch (result)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2772 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2773 case XpmFileInvalid:
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 if (ok_if_data_invalid)
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2776 return Qt;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2777 signal_image_error ("invalid XPM data in file", name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2778 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2779 case XpmNoMemory:
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2780 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2781 signal_double_file_error ("Reading pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2782 "out of memory", name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2783 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2784 case XpmOpenFailed:
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 /* should never happen? */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2787 signal_double_file_error ("Opening pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2788 "no such file or directory", name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2789 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2790 default:
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2791 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2792 signal_double_file_error_2 ("Parsing pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2793 "unknown error code",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2794 make_int (result), name);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2795 break;
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 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2798
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2799 return Qnil; /* not reached */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2800 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2801
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2802 static void
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2803 check_valid_xpm_color_symbols (Lisp_Object data)
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 Lisp_Object rest;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2806
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2807 for (rest = data; !NILP (rest); rest = XCDR (rest))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2808 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2809 if (!CONSP (rest) ||
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2810 !CONSP (XCAR (rest)) ||
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2811 !STRINGP (XCAR (XCAR (rest))) ||
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2812 (!STRINGP (XCDR (XCAR (rest))) &&
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2813 !COLOR_SPECIFIERP (XCDR (XCAR (rest)))))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2814 signal_simple_error ("Invalid color symbol alist", data);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2815 }
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
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2818 static void
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2819 xpm_validate (Lisp_Object instantiator)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2820 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2821 file_or_data_must_be_present (instantiator);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2822 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2823
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2824 Lisp_Object Vxpm_color_symbols;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2825
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2826 Lisp_Object
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2827 evaluate_xpm_color_symbols (void)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2828 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2829 Lisp_Object rest, results = Qnil;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2830 struct gcpro gcpro1, gcpro2;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2831
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2832 GCPRO2 (rest, results);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2833 for (rest = Vxpm_color_symbols; !NILP (rest); rest = XCDR (rest))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2834 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2835 Lisp_Object name, value, cons;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2836
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2837 CHECK_CONS (rest);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2838 cons = XCAR (rest);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2839 CHECK_CONS (cons);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2840 name = XCAR (cons);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2841 CHECK_STRING (name);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2842 value = XCDR (cons);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2843 CHECK_CONS (value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2844 value = XCAR (value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2845 value = Feval (value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2846 if (NILP (value))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2847 continue;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2848 if (!STRINGP (value) && !COLOR_SPECIFIERP (value))
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2849 signal_simple_error
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2850 ("Result from xpm-color-symbols eval must be nil, string, or color",
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2851 value);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2852 results = Fcons (Fcons (name, value), results);
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 UNGCPRO; /* no more evaluation */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2855 return results;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2856 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2857
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2858 static Lisp_Object
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2859 xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2860 {
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2861 Lisp_Object file = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2862 Lisp_Object color_symbols;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2863 struct gcpro gcpro1, gcpro2;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2864 Lisp_Object alist = Qnil;
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2865
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2866 GCPRO2 (file, alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2867
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2868 /* 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
2869 `data' will contain the inline data (if any) or Qnil, and
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2870 `file' will contain the name this data was derived from (if
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2871 known) or Qnil.
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2872
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2873 Note that if we cannot generate any regular inline data, we
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2874 skip out. */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2875
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2876 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2877 console_type);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2878
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2879 if (CONSP (file)) /* failure locating filename */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2880 signal_double_file_error ("Opening pixmap file",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2881 "no such file or directory",
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2882 Fcar (file));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2883
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2884 color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols,
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2885 Qunbound);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2886
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2887 if (NILP (file) && !UNBOUNDP (color_symbols))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2888 /* no conversion necessary */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2889 RETURN_UNGCPRO (inst);
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2890
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2891 alist = tagged_vector_to_alist (inst);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2892
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2893 if (!NILP (file))
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2894 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2895 Lisp_Object data = pixmap_to_lisp_data (file, 0);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2896 alist = remassq_no_quit (Q_file, alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2897 /* there can't be a :data at this point. */
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2898 alist = Fcons (Fcons (Q_file, file),
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2899 Fcons (Fcons (Q_data, data), alist));
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2900 }
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
2901
280
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2902 if (UNBOUNDP (color_symbols))
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 color_symbols = evaluate_xpm_color_symbols ();
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2905 alist = Fcons (Fcons (Q_color_symbols, color_symbols),
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2906 alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2907 }
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2908
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2909 {
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2910 Lisp_Object result = alist_to_tagged_vector (Qxpm, alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2911 free_alist (alist);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2912 RETURN_UNGCPRO (result);
7df0dd720c89 Import from CVS: tag r21-0b38
cvs
parents: 278
diff changeset
2913 }
276
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
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2916 static int
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2917 xpm_possible_dest_types (void)
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2918 {
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2919 return
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2920 IMAGE_MONO_PIXMAP_MASK |
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2921 IMAGE_COLOR_PIXMAP_MASK |
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2922 IMAGE_POINTER_MASK;
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2923 }
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2924
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2925 #endif /* HAVE_XPM */
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2926
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
2927
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929 * Image Specifier Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 DEFINE_SPECIFIER_TYPE (image);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 image_create (Lisp_Object obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2937 Lisp_Specifier *image = XIMAGE_SPECIFIER (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939 IMAGE_SPECIFIER_ALLOWED (image) = ~0; /* all are allowed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940 IMAGE_SPECIFIER_ATTACHEE (image) = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941 IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image) = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944 static void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2945 image_mark (Lisp_Object obj)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2947 Lisp_Specifier *image = XIMAGE_SPECIFIER (obj);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2948
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2949 mark_object (IMAGE_SPECIFIER_ATTACHEE (image));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2950 mark_object (IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2954 image_instantiate_cache_result (Lisp_Object locative)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 {
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2956 /* locative = (instance instantiator . subtable)
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2957
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2958 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
2959 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
2960 image instance will stay around as long as the instantiator stays
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2961 around. The instantiator is stored in the `image' slot of the
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
2962 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
2963 as well and hence the cached image instance also.*/
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
2964 Fputhash (XCAR (XCDR (locative)), XCAR (locative), XCDR (XCDR (locative)));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965 free_cons (XCONS (XCDR (locative)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 free_cons (XCONS (locative));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2969
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 /* Given a specification for an image, return an instance of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2971 the image which matches the given instantiator and which can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 displayed in the given domain. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 image_instantiate (Lisp_Object specifier, Lisp_Object matchspec,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 Lisp_Object domain, Lisp_Object instantiator,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977 Lisp_Object depth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
2979 Lisp_Object glyph = IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980 int dest_mask = XIMAGE_SPECIFIER_ALLOWED (specifier);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981 int pointerp = dest_mask & image_instance_type_to_mask (IMAGE_POINTER);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983 if (IMAGE_INSTANCEP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2984 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2985 /* make sure that the image instance's governing domain and type are
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 matching. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2987 Lisp_Object governing_domain = XIMAGE_INSTANCE_DOMAIN (instantiator);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2988
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2989 if ((DEVICEP (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2990 && EQ (governing_domain, DOMAIN_DEVICE (domain)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2991 || (FRAMEP (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2992 && EQ (governing_domain, DOMAIN_FRAME (domain)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2993 || (WINDOWP (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
2994 && EQ (governing_domain, DOMAIN_WINDOW (domain))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996 int mask =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997 image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 if (mask & dest_mask)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 return instantiator;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001 signal_simple_error ("Type of image instance not allowed here",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 instantiator);
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
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3005 signal_simple_error_2 ("Wrong domain for image instance",
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3006 instantiator, domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3007 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008 else if (VECTORP (instantiator)
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3009 && EQ (XVECTOR_DATA (instantiator)[0], Qinherit))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3011 assert (XVECTOR_LENGTH (instantiator) == 3);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 return (FACE_PROPERTY_INSTANCE
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3013 (Fget_face (XVECTOR_DATA (instantiator)[2]),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 Qbackground_pixmap, domain, 0, depth));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 Lisp_Object instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019 Lisp_Object subtable;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3020 Lisp_Object ls3 = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3021 Lisp_Object pointer_fg = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3022 Lisp_Object pointer_bg = Qnil;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3023 Lisp_Object governing_domain =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3024 get_image_instantiator_governing_domain (instantiator, domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3025
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3026 /* We have to put subwindow, widget and text image instances in
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3027 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
3028 different windows. We use governing_domain to determine the type
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3029 of image_instance that will be created. */
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
3030
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 if (pointerp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3033 pointer_fg = FACE_FOREGROUND (Vpointer_face, domain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 pointer_bg = FACE_BACKGROUND (Vpointer_face, domain);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 ls3 = list3 (instantiator, pointer_fg, pointer_bg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3037
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3038 /* First look in the device cache. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3039 if (DEVICEP (governing_domain))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3040 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3041 subtable = Fgethash (make_int (dest_mask),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3042 XDEVICE (governing_domain)->
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3043 image_instance_cache,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3044 Qunbound);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3045 if (UNBOUNDP (subtable))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3046 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3047 /* For the image instance cache, we do comparisons with
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3048 EQ rather than with EQUAL, as we do for color and
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3049 font names. The reasons are:
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3050
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3051 1) pixmap data can be very long, and thus the hashing
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3052 and comparing will take awhile.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3053
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3054 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
3055 are EQUAL but not EQ (that can happen a lot with
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3056 faces, because their specifiers are copied around);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3057 but pixmaps tend not to be in faces.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3058
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3059 However, if the image-instance could be a pointer, we
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3060 have to use EQUAL because we massaged the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3061 instantiator into a cons3 also containing the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3062 foreground and background of the pointer face. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3063
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3064 subtable = make_lisp_hash_table
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3065 (20, pointerp ? HASH_TABLE_KEY_CAR_WEAK
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3066 : HASH_TABLE_KEY_WEAK,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3067 pointerp ? HASH_TABLE_EQUAL
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3068 : HASH_TABLE_EQ);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3069 Fputhash (make_int (dest_mask), subtable,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3070 XDEVICE (governing_domain)->image_instance_cache);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3071 instance = Qunbound;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3072 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3073 else
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3074 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3075 instance = Fgethash (pointerp ? ls3 : instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3076 subtable, Qunbound);
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 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3079 else if (WINDOWP (governing_domain))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3080 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3081 /* Subwindows have a per-window cache and have to be treated
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3082 differently. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3083 instance =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3084 Fgethash (instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3085 XWINDOW (governing_domain)->subwindow_instance_cache,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3086 Qunbound);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3087 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3088 else
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3089 abort (); /* We're not allowed anything else currently. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3090
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3091 /* 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
3092 one. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3093 if (UNBOUNDP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3094 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3095 Lisp_Object locative =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3096 noseeum_cons (Qnil,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3097 noseeum_cons (pointerp ? ls3 : instantiator,
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3098 DEVICEP (governing_domain) ? subtable
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3099 : XWINDOW (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3100 ->subwindow_instance_cache));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3101 int speccount = specpdl_depth ();
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3102
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3103 /* Make sure we cache the failures, too. Use an
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3104 unwind-protect to catch such errors. If we fail, the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3105 unwind-protect records nil in the hash table. If we
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3106 succeed, we change the car of the locative to the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3107 resulting instance, which gets recorded instead. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3108 record_unwind_protect (image_instantiate_cache_result,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3109 locative);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3110 instance =
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3111 instantiate_image_instantiator (governing_domain,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3112 domain, instantiator,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3113 pointer_fg, pointer_bg,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3114 dest_mask, glyph);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3115
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3116 /* We need a per-frame cache for redisplay. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3117 cache_subwindow_instance_in_frame_maybe (instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3118
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3119 Fsetcar (locative, instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3120 #ifdef ERROR_CHECK_GLYPHS
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
3121 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3122 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3123 assert (EQ (XIMAGE_INSTANCE_FRAME (instance),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3124 DOMAIN_FRAME (domain)));
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3125 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3126 unbind_to (speccount, Qnil);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3127 #ifdef ERROR_CHECK_GLYPHS
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3128 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3129 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3130 assert (EQ (Fgethash ((pointerp ? ls3 : instantiator),
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3131 XWINDOW (governing_domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3132 ->subwindow_instance_cache,
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3133 Qunbound), instance));
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3134 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3135 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3136 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3137 free_list (ls3);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3139 if (NILP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3140 signal_simple_error ("Can't instantiate image (probably cached)",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3141 instantiator);
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3142 #ifdef ERROR_CHECK_GLYPHS
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3143 if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3144 & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK))
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3145 assert (EQ (XIMAGE_INSTANCE_FRAME (instance),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3146 DOMAIN_FRAME (domain)));
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
3147 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3148 ERROR_CHECK_IMAGE_INSTANCE (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3149 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3150 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3152 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3153 return Qnil; /* not reached */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3154 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3156 /* Validate an image instantiator. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3158 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3159 image_validate (Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3160 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3161 if (IMAGE_INSTANCEP (instantiator) || STRINGP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3162 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3163 else if (VECTORP (instantiator))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3164 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3165 Lisp_Object *elt = XVECTOR_DATA (instantiator);
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3166 int instantiator_len = XVECTOR_LENGTH (instantiator);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3167 struct image_instantiator_methods *meths;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3168 Lisp_Object already_seen = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3169 struct gcpro gcpro1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3170 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3172 if (instantiator_len < 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3173 signal_simple_error ("Vector length must be at least 1",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3174 instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3176 meths = decode_image_instantiator_format (elt[0], ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3177 if (!(instantiator_len & 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3178 signal_simple_error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3179 ("Must have alternating keyword/value pairs", instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3181 GCPRO1 (already_seen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3183 for (i = 1; i < instantiator_len; i += 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3184 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3185 Lisp_Object keyword = elt[i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3186 Lisp_Object value = elt[i+1];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3187 int j;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3189 CHECK_SYMBOL (keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3190 if (!SYMBOL_IS_KEYWORD (keyword))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3191 signal_simple_error ("Symbol must begin with a colon", keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3193 for (j = 0; j < Dynarr_length (meths->keywords); j++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3194 if (EQ (keyword, Dynarr_at (meths->keywords, j).keyword))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3195 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3197 if (j == Dynarr_length (meths->keywords))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3198 signal_simple_error ("Unrecognized keyword", keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3200 if (!Dynarr_at (meths->keywords, j).multiple_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3201 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3202 if (!NILP (memq_no_quit (keyword, already_seen)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3203 signal_simple_error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3204 ("Keyword may not appear more than once", keyword);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3205 already_seen = Fcons (keyword, already_seen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3206 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3208 (Dynarr_at (meths->keywords, j).validate) (value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3209 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3211 UNGCPRO;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3213 MAYBE_IIFORMAT_METH (meths, validate, (instantiator));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3214 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3215 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3216 signal_simple_error ("Must be string or vector", instantiator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3217 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3219 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3220 image_after_change (Lisp_Object specifier, Lisp_Object locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3221 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3222 Lisp_Object attachee =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3223 IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3224 Lisp_Object property =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3225 IMAGE_SPECIFIER_ATTACHEE_PROPERTY (XIMAGE_SPECIFIER (specifier));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3226 if (FACEP (attachee))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3227 face_property_was_changed (attachee, property, locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3228 else if (GLYPHP (attachee))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3229 glyph_property_was_changed (attachee, property, locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3230 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3232 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3233 set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3234 Lisp_Object property)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3235 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3236 Lisp_Specifier *image = XIMAGE_SPECIFIER (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3238 IMAGE_SPECIFIER_ATTACHEE (image) = face_or_glyph;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3239 IMAGE_SPECIFIER_ATTACHEE_PROPERTY (image) = property;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3240 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3242 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3243 image_going_to_add (Lisp_Object specifier, Lisp_Object locale,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3244 Lisp_Object tag_set, Lisp_Object instantiator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3245 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3246 Lisp_Object possible_console_types = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3247 Lisp_Object rest;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3248 Lisp_Object retlist = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3249 struct gcpro gcpro1, gcpro2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3251 LIST_LOOP (rest, Vconsole_type_list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3252 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3253 Lisp_Object contype = XCAR (rest);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3254 if (!NILP (memq_no_quit (contype, tag_set)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3255 possible_console_types = Fcons (contype, possible_console_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3256 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3258 if (XINT (Flength (possible_console_types)) > 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3259 /* two conflicting console types specified */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3260 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3262 if (NILP (possible_console_types))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3263 possible_console_types = Vconsole_type_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3265 GCPRO2 (retlist, possible_console_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3267 LIST_LOOP (rest, possible_console_types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3268 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3269 Lisp_Object contype = XCAR (rest);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3270 Lisp_Object newinst = call_with_suspended_errors
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3271 ((lisp_fn_t) normalize_image_instantiator,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3272 Qnil, Qimage, ERROR_ME_NOT, 3, instantiator, contype,
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
3273 make_int (XIMAGE_SPECIFIER_ALLOWED (specifier)));
84
ac0620f6398e Import from CVS: tag r20-0b92
cvs
parents: 82
diff changeset
3274
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3275 if (!NILP (newinst))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3276 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3277 Lisp_Object newtag;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3278 if (NILP (memq_no_quit (contype, tag_set)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3279 newtag = Fcons (contype, tag_set);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3280 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3281 newtag = tag_set;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3282 retlist = Fcons (Fcons (newtag, newinst), retlist);
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3286 UNGCPRO;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3288 return retlist;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3289 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3290
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3291 /* 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
3292 may contain circular references which would send Fcopy_tree into
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3293 infloop death. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3294 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3295 image_copy_vector_instantiator (Lisp_Object instantiator)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3296 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3297 int i;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3298 struct image_instantiator_methods *meths;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3299 Lisp_Object *elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3300 int instantiator_len;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3301
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3302 CHECK_VECTOR (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3303
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3304 instantiator = Fcopy_sequence (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3305 elt = XVECTOR_DATA (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3306 instantiator_len = XVECTOR_LENGTH (instantiator);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3307
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3308 meths = decode_image_instantiator_format (elt[0], ERROR_ME);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3309
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3310 for (i = 1; i < instantiator_len; i += 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3311 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3312 int j;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3313 Lisp_Object keyword = elt[i];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3314 Lisp_Object value = elt[i+1];
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3315
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3316 /* Find the keyword entry. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3317 for (j = 0; j < Dynarr_length (meths->keywords); j++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3318 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3319 if (EQ (keyword, Dynarr_at (meths->keywords, j).keyword))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3320 break;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3323 /* Only copy keyword values that should be copied. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3324 if (Dynarr_at (meths->keywords, j).copy_p
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3325 &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3326 (CONSP (value) || VECTORP (value)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3327 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3328 elt [i+1] = Fcopy_tree (value, Qt);
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3332 return instantiator;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3335 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3336 image_copy_instantiator (Lisp_Object arg)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3337 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3338 if (CONSP (arg))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3339 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3340 Lisp_Object rest;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3341 rest = arg = Fcopy_sequence (arg);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3342 while (CONSP (rest))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3343 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3344 Lisp_Object elt = XCAR (rest);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3345 if (CONSP (elt))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3346 XCAR (rest) = Fcopy_tree (elt, Qt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3347 else if (VECTORP (elt))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3348 XCAR (rest) = image_copy_vector_instantiator (elt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3349 if (VECTORP (XCDR (rest))) /* hack for (a b . [c d]) */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3350 XCDR (rest) = Fcopy_tree (XCDR (rest), Qt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3351 rest = XCDR (rest);
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 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3354 else if (VECTORP (arg))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3355 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3356 arg = image_copy_vector_instantiator (arg);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3357 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3358 return arg;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3359 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3360
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3361 DEFUN ("image-specifier-p", Fimage_specifier_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3362 Return non-nil if OBJECT is an image specifier.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3363 See `make-image-specifier' for a description of image instantiators.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3364 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3365 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3366 {
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3367 return IMAGE_SPECIFIERP (object) ? Qt : Qnil;
0
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 /****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3372 * Glyph Object *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3373 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3375 static Lisp_Object
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3376 mark_glyph (Lisp_Object obj)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3377 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3378 Lisp_Glyph *glyph = XGLYPH (obj);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3379
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3380 mark_object (glyph->image);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3381 mark_object (glyph->contrib_p);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3382 mark_object (glyph->baseline);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3383 mark_object (glyph->face);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3384
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3385 return glyph->plist;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3386 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3388 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3389 print_glyph (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3390 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3391 Lisp_Glyph *glyph = XGLYPH (obj);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3392 char buf[20];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3394 if (print_readably)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3395 error ("printing unreadable object #<glyph 0x%x>", glyph->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3397 write_c_string ("#<glyph (", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3398 print_internal (Fglyph_type (obj), printcharfun, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3399 write_c_string (") ", printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3400 print_internal (glyph->image, printcharfun, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3401 sprintf (buf, "0x%x>", glyph->header.uid);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3402 write_c_string (buf, printcharfun);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3403 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3405 /* Glyphs are equal if all of their display attributes are equal. We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3406 don't compare names or doc-strings, because that would make equal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3407 be eq.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3409 This isn't concerned with "unspecified" attributes, that's what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3410 #'glyph-differs-from-default-p is for. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3411 static int
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
3412 glyph_equal (Lisp_Object obj1, Lisp_Object obj2, int depth)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3413 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3414 Lisp_Glyph *g1 = XGLYPH (obj1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3415 Lisp_Glyph *g2 = XGLYPH (obj2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3417 depth++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3418
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3419 return (internal_equal (g1->image, g2->image, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3420 internal_equal (g1->contrib_p, g2->contrib_p, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3421 internal_equal (g1->baseline, g2->baseline, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3422 internal_equal (g1->face, g2->face, depth) &&
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3423 !plists_differ (g1->plist, g2->plist, 0, 0, depth + 1));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3424 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3426 static unsigned long
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3427 glyph_hash (Lisp_Object obj, int depth)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3428 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3429 depth++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3431 /* No need to hash all of the elements; that would take too long.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3432 Just hash the most common ones. */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3433 return HASH2 (internal_hash (XGLYPH (obj)->image, depth),
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3434 internal_hash (XGLYPH (obj)->face, depth));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3435 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3437 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3438 glyph_getprop (Lisp_Object obj, Lisp_Object prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3439 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3440 Lisp_Glyph *g = XGLYPH (obj);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3441
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3442 if (EQ (prop, Qimage)) return g->image;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3443 if (EQ (prop, Qcontrib_p)) return g->contrib_p;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3444 if (EQ (prop, Qbaseline)) return g->baseline;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3445 if (EQ (prop, Qface)) return g->face;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3447 return external_plist_get (&g->plist, prop, 0, ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3448 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3450 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3451 glyph_putprop (Lisp_Object obj, Lisp_Object prop, Lisp_Object value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3452 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3453 if (EQ (prop, Qimage) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3454 EQ (prop, Qcontrib_p) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3455 EQ (prop, Qbaseline))
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3456 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3458 if (EQ (prop, Qface))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3459 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3460 XGLYPH (obj)->face = Fget_face (value);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3461 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3462 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3463
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3464 external_plist_put (&XGLYPH (obj)->plist, prop, value, 0, ERROR_ME);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3465 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3466 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3467
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3468 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3469 glyph_remprop (Lisp_Object obj, Lisp_Object prop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3470 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3471 if (EQ (prop, Qimage) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3472 EQ (prop, Qcontrib_p) ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3473 EQ (prop, Qbaseline))
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3474 return -1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3476 if (EQ (prop, Qface))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3477 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3478 XGLYPH (obj)->face = Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3479 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3480 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3481
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3482 return external_remprop (&XGLYPH (obj)->plist, prop, 0, ERROR_ME);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3483 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3485 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3486 glyph_plist (Lisp_Object obj)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3487 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3488 Lisp_Glyph *glyph = XGLYPH (obj);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3489 Lisp_Object result = glyph->plist;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3490
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3491 result = cons3 (Qface, glyph->face, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3492 result = cons3 (Qbaseline, glyph->baseline, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3493 result = cons3 (Qcontrib_p, glyph->contrib_p, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3494 result = cons3 (Qimage, glyph->image, result);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3495
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3496 return result;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3497 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3498
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3499 static const struct lrecord_description glyph_description[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3500 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, image) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3501 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, contrib_p) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3502 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, baseline) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3503 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, face) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3504 { XD_LISP_OBJECT, offsetof (Lisp_Glyph, plist) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3505 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3506 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3507
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3508 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("glyph", glyph,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3509 mark_glyph, print_glyph, 0,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3510 glyph_equal, glyph_hash, glyph_description,
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3511 glyph_getprop, glyph_putprop,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3512 glyph_remprop, glyph_plist,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3513 Lisp_Glyph);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3514
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3515 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3516 allocate_glyph (enum glyph_type type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3517 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3518 Lisp_Object locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3519 {
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3520 /* This function can GC */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3521 Lisp_Object obj = Qnil;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3522 Lisp_Glyph *g = alloc_lcrecord_type (Lisp_Glyph, &lrecord_glyph);
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3523
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3524 g->type = type;
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3525 g->image = Fmake_specifier (Qimage); /* This function can GC */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3526 g->dirty = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3527 switch (g->type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3528 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3529 case GLYPH_BUFFER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3530 XIMAGE_SPECIFIER_ALLOWED (g->image) =
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3531 IMAGE_NOTHING_MASK | IMAGE_TEXT_MASK
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3532 | IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3533 | IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3534 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3535 case GLYPH_POINTER:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3536 XIMAGE_SPECIFIER_ALLOWED (g->image) =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3537 IMAGE_NOTHING_MASK | IMAGE_POINTER_MASK;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3538 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3539 case GLYPH_ICON:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3540 XIMAGE_SPECIFIER_ALLOWED (g->image) =
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3541 IMAGE_NOTHING_MASK | IMAGE_MONO_PIXMAP_MASK
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3542 | IMAGE_COLOR_PIXMAP_MASK;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3543 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3544 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3545 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3546 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3547
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3548 /* 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
3549 /* 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
3550 /* best to GCPRO everything. */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3551 {
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3552 Lisp_Object tem1 = list1 (Fcons (Qnil, Vthe_nothing_vector));
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3553 Lisp_Object tem2 = list1 (Fcons (Qnil, Qt));
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3554 Lisp_Object tem3 = list1 (Fcons (Qnil, Qnil));
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3555 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3556
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3557 GCPRO4 (obj, tem1, tem2, tem3);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3558
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3559 set_specifier_fallback (g->image, tem1);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3560 g->contrib_p = Fmake_specifier (Qboolean);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3561 set_specifier_fallback (g->contrib_p, tem2);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3562 /* #### should have a specifier for the following */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3563 g->baseline = Fmake_specifier (Qgeneric);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3564 set_specifier_fallback (g->baseline, tem3);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3565 g->face = Qnil;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3566 g->plist = Qnil;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3567 g->after_change = after_change;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3568 XSETGLYPH (obj, g);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3569
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3570 set_image_attached_to (g->image, obj, Qimage);
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3571 UNGCPRO;
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
3572 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3574 return obj;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3575 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3577 static enum glyph_type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3578 decode_glyph_type (Lisp_Object type, Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3579 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3580 if (NILP (type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3581 return GLYPH_BUFFER;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3583 if (ERRB_EQ (errb, ERROR_ME))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3584 CHECK_SYMBOL (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3585
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3586 if (EQ (type, Qbuffer)) return GLYPH_BUFFER;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3587 if (EQ (type, Qpointer)) return GLYPH_POINTER;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3588 if (EQ (type, Qicon)) return GLYPH_ICON;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3589
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3590 maybe_signal_simple_error ("Invalid glyph type", type, Qimage, errb);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3591
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3592 return GLYPH_UNKNOWN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3593 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3595 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3596 valid_glyph_type_p (Lisp_Object type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3597 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3598 return !NILP (memq_no_quit (type, Vglyph_type_list));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3599 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3600
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3601 DEFUN ("valid-glyph-type-p", Fvalid_glyph_type_p, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3602 Given a GLYPH-TYPE, return non-nil if it is valid.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3603 Valid types are `buffer', `pointer', and `icon'.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3604 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3605 (glyph_type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3606 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3607 return valid_glyph_type_p (glyph_type) ? Qt : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3608 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3609
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3610 DEFUN ("glyph-type-list", Fglyph_type_list, 0, 0, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3611 Return a list of valid glyph types.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3612 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3613 ())
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3614 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3615 return Fcopy_sequence (Vglyph_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3616 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3617
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3618 DEFUN ("make-glyph-internal", Fmake_glyph_internal, 0, 1, 0, /*
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
3619 Create and return a new uninitialized glyph or type TYPE.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3621 TYPE specifies the type of the glyph; this should be one of `buffer',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3622 `pointer', or `icon', and defaults to `buffer'. The type of the glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3623 specifies in which contexts the glyph can be used, and controls the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3624 allowable image types into which the glyph's image can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3625 instantiated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3627 `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
3628 extent, in the modeline, and in the toolbar. Their image can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3629 instantiated as `nothing', `mono-pixmap', `color-pixmap', `text',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3630 and `subwindow'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3632 `pointer' glyphs can be used to specify the mouse pointer. Their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3633 image can be instantiated as `pointer'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3635 `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
3636 iconified. Their image can be instantiated as `mono-pixmap' and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3637 `color-pixmap'.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3638 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3639 (type))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3640 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3641 enum glyph_type typeval = decode_glyph_type (type, ERROR_ME);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3642 return allocate_glyph (typeval, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3643 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3644
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3645 DEFUN ("glyphp", Fglyphp, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3646 Return non-nil if OBJECT is a glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3647
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3648 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
3649 in begin-glyphs and end-glyphs attached to extents, in marginal and textual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3650 annotations, in overlay arrows (overlay-arrow-* variables), in toolbar
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3651 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
3652 `make-glyph'. Its image is described using an image specifier --
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3653 see `make-image-specifier'. See also `make-image-instance' for further
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3654 information.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3655 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3656 (object))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3657 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3658 return GLYPHP (object) ? Qt : Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3659 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3660
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3661 DEFUN ("glyph-type", Fglyph_type, 1, 1, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3662 Return the type of the given glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3663 The return value will be one of 'buffer, 'pointer, or 'icon.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3664 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3665 (glyph))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3666 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3667 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3668 switch (XGLYPH_TYPE (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3669 {
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 373
diff changeset
3670 default: abort ();
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3671 case GLYPH_BUFFER: return Qbuffer;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3672 case GLYPH_POINTER: return Qpointer;
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3673 case GLYPH_ICON: return Qicon;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3674 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3675 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3676
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3677 Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3678 glyph_image_instance (Lisp_Object glyph, Lisp_Object domain,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3679 Error_behavior errb, int no_quit)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3680 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3681 Lisp_Object specifier = GLYPH_IMAGE (XGLYPH (glyph));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3682
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3683 /* This can never return Qunbound. All glyphs have 'nothing as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3684 a fallback. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3685 Lisp_Object image_instance = specifier_instance (specifier, Qunbound,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3686 domain, errb, no_quit, 0,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3687 Qzero);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3688 assert (!UNBOUNDP (image_instance));
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3689 ERROR_CHECK_IMAGE_INSTANCE (image_instance);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3690
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3691 return image_instance;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3694 static Lisp_Object
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3695 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
3696 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3697 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3698
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3699 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3700 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
3701
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3702 return instance;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3703 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3704
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3705 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3706 glyph_width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3707
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3708 Return the width of the given GLYPH on the given WINDOW.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3709 Calculations are done based on recursively querying the geometry of
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3710 the associated image instances.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3711 ****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3712 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3713 glyph_width (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3714 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3715 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3716 domain);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3717 if (!IMAGE_INSTANCEP (instance))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3718 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3719
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3720 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3721 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3722 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3723
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3724 return XIMAGE_INSTANCE_WIDTH (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3725 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3726
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3727 DEFUN ("glyph-width", Fglyph_width, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3728 Return the width of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3729 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
3730 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3731 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3732 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3733 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3734 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3735 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3736
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3737 return make_int (glyph_width (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3738 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3740 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3741 glyph_ascent (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3742 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3743 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3744 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3745 if (!IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3746 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3747
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3748 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3749 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3750 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3751
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3752 if (XIMAGE_INSTANCE_TYPE (instance) == IMAGE_TEXT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3753 return XIMAGE_INSTANCE_TEXT_ASCENT (instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3754 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3755 return XIMAGE_INSTANCE_HEIGHT (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3756 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3757
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3758 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3759 glyph_descent (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3760 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3761 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3762 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3763 if (!IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3764 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3765
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3766 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3767 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3768 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3769
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3770 if (XIMAGE_INSTANCE_TYPE (instance) == IMAGE_TEXT)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3771 return XIMAGE_INSTANCE_TEXT_DESCENT (instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3772 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3773 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3774 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3775
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3776 /* strictly a convenience function. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3777 unsigned short
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3778 glyph_height (Lisp_Object glyph_or_image, Lisp_Object domain)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3779 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3780 Lisp_Object instance = glyph_image_instance_maybe (glyph_or_image,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3781 domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3782
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3783 if (!IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3784 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3785
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3786 if (XIMAGE_INSTANCE_NEEDS_LAYOUT (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3787 image_instance_layout (instance, IMAGE_UNSPECIFIED_GEOMETRY,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3788 IMAGE_UNSPECIFIED_GEOMETRY, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3789
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3790 return XIMAGE_INSTANCE_HEIGHT (instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3791 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3792
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3793 DEFUN ("glyph-ascent", Fglyph_ascent, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3794 Return the ascent value of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3795 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
3796 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3797 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3798 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3799 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3800 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3801 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3802
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3803 return make_int (glyph_ascent (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3804 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3805
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3806 DEFUN ("glyph-descent", Fglyph_descent, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3807 Return the descent value of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3808 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
3809 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3810 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3811 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3812 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3813 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3814 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3815
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3816 return make_int (glyph_descent (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3817 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3819 /* 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
3820 DEFUN ("glyph-height", Fglyph_height, 1, 2, 0, /*
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3821 Return the height of GLYPH on WINDOW.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3822 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
3823 that redisplay will.
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3824 */
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
3825 (glyph, window))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3826 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3827 XSETWINDOW (window, decode_window (window));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3828 CHECK_GLYPH (glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3829
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3830 return make_int (glyph_height (glyph, window));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3831 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3832
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3833 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3834 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
3835 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3836 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3837
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3838 if (!NILP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3839 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3840 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3841 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3842 instance = glyph_image_instance (glyph_or_image, window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3843 ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3844 XGLYPH_DIRTYP (glyph_or_image) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3845 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3846
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3847 if (!IMAGE_INSTANCEP (instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3848 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3849
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3850 XIMAGE_INSTANCE_DIRTYP (instance) = dirty;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3854 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3855 set_image_instance_dirty_p (Lisp_Object instance, int dirty)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3856 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3857 if (IMAGE_INSTANCEP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3858 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3859 XIMAGE_INSTANCE_DIRTYP (instance) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3860 /* Now cascade up the hierarchy. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3861 set_image_instance_dirty_p (XIMAGE_INSTANCE_PARENT (instance),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3862 dirty);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3863 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3864 else if (GLYPHP (instance))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3865 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3866 XGLYPH_DIRTYP (instance) = dirty;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3867 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3868 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3870 /* #### do we need to cache this info to speed things up? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3872 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3873 glyph_baseline (Lisp_Object glyph, Lisp_Object domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3874 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3875 if (!GLYPHP (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3876 return Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3877 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3878 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3879 Lisp_Object retval =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3880 specifier_instance_no_quit (GLYPH_BASELINE (XGLYPH (glyph)),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3881 /* #### look into ERROR_ME_NOT */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3882 Qunbound, domain, ERROR_ME_NOT,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3883 0, Qzero);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3884 if (!NILP (retval) && !INTP (retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3885 retval = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3886 else if (INTP (retval))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3887 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3888 if (XINT (retval) < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3889 retval = Qzero;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3890 if (XINT (retval) > 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3891 retval = make_int (100);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3892 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3893 return retval;
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3897 Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3898 glyph_face (Lisp_Object glyph, Lisp_Object domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3899 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3900 /* #### Domain parameter not currently used but it will be */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3901 return GLYPHP (glyph) ? GLYPH_FACE (XGLYPH (glyph)) : Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3902 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3904 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3905 glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3906 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3907 if (!GLYPHP (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3908 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3909 else
173
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3910 return !NILP (specifier_instance_no_quit
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3911 (GLYPH_CONTRIB_P (XGLYPH (glyph)), Qunbound, domain,
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3912 /* #### look into ERROR_ME_NOT */
8eaf7971accc Import from CVS: tag r20-3b13
cvs
parents: 169
diff changeset
3913 ERROR_ME_NOT, 0, Qzero));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3914 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3916 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3917 glyph_property_was_changed (Lisp_Object glyph, Lisp_Object property,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3918 Lisp_Object locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3919 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3920 if (XGLYPH (glyph)->after_change)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3921 (XGLYPH (glyph)->after_change) (glyph, property, locale);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3922 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3923
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3924 #if 0 /* Not used for now */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3925 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3926 glyph_query_geometry (Lisp_Object glyph_or_image, Lisp_Object window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3927 unsigned int* width, unsigned int* height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3928 enum image_instance_geometry disp, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3929 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3930 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3931
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3932 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3933 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
3934
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3935 image_instance_query_geometry (instance, width, height, disp, domain);
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3938 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3939 glyph_layout (Lisp_Object glyph_or_image, Lisp_Object window,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3940 unsigned int width, unsigned int height, Lisp_Object domain)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3941 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3942 Lisp_Object instance = glyph_or_image;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3943
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3944 if (GLYPHP (glyph_or_image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3945 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
3946
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3947 image_instance_layout (instance, width, height, domain);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3948 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3949 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3950
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3952 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3953 * glyph cachel functions *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3954 *****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3955
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3956 /* #### All of this is 95% copied from face cachels. Consider
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
3957 consolidating.
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
3958
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3959 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
3960 per-window information about a particular glyph. A glyph itself is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3961 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
3962 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
3963 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
3964 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
3965 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
3966 can iterate through doing this. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3967 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3968 mark_glyph_cachels (glyph_cachel_dynarr *elements)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3969 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3970 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3971
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3972 if (!elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3973 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3974
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3975 for (elt = 0; elt < Dynarr_length (elements); elt++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3976 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3977 struct glyph_cachel *cachel = Dynarr_atp (elements, elt);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3978 mark_object (cachel->glyph);
0
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3982 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3983 update_glyph_cachel_data (struct window *w, Lisp_Object glyph,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3984 struct glyph_cachel *cachel)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3985 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3986 if (!cachel->updated || NILP (cachel->glyph) || !EQ (cachel->glyph, glyph)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3987 || XGLYPH_DIRTYP (cachel->glyph)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3988 || XFRAME(WINDOW_FRAME(w))->faces_changed)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3989 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3990 Lisp_Object window, instance;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3992 XSETWINDOW (window, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3993
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
3994 cachel->glyph = glyph;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3995 /* Speed things up slightly by grabbing the glyph instantiation
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3996 and passing it to the size functions. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3997 instance = glyph_image_instance (glyph, window, ERROR_ME_NOT, 1);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
3998
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
3999 if (!IMAGE_INSTANCEP (instance))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4000 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4001
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4002 /* Mark text instance of the glyph dirty if faces have changed,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4003 because its geometry might have changed. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4004 invalidate_glyph_geometry_maybe (instance, w);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4005
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4006 /* #### Do the following 2 lines buy us anything? --kkm */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4007 XGLYPH_DIRTYP (glyph) = XIMAGE_INSTANCE_DIRTYP (instance);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4008 cachel->dirty = XGLYPH_DIRTYP (glyph);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4009 cachel->width = glyph_width (instance, window);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4010 cachel->ascent = glyph_ascent (instance, window);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4011 cachel->descent = glyph_descent (instance, window);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4012 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4014 cachel->updated = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4015 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4016
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4017 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4018 add_glyph_cachel (struct window *w, Lisp_Object glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4019 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4020 struct glyph_cachel new_cachel;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4021
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
4022 xzero (new_cachel);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4023 new_cachel.glyph = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4024
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4025 update_glyph_cachel_data (w, glyph, &new_cachel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4026 Dynarr_add (w->glyph_cachels, new_cachel);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4027 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4028
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4029 glyph_index
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4030 get_glyph_cachel_index (struct window *w, Lisp_Object glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4031 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4032 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4034 if (noninteractive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4035 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4037 for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4038 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4039 struct glyph_cachel *cachel =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4040 Dynarr_atp (w->glyph_cachels, elt);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4042 if (EQ (cachel->glyph, glyph) && !NILP (glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4043 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4044 update_glyph_cachel_data (w, glyph, cachel);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4045 return elt;
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4049 /* 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
4050 add_glyph_cachel (w, glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4051 return elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4052 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4053
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4054 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4055 reset_glyph_cachels (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4056 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4057 Dynarr_reset (w->glyph_cachels);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4058 get_glyph_cachel_index (w, Vcontinuation_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4059 get_glyph_cachel_index (w, Vtruncation_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4060 get_glyph_cachel_index (w, Vhscroll_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4061 get_glyph_cachel_index (w, Vcontrol_arrow_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4062 get_glyph_cachel_index (w, Voctal_escape_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4063 get_glyph_cachel_index (w, Vinvisible_text_glyph);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4064 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4066 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4067 mark_glyph_cachels_as_not_updated (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4068 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4069 int elt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4071 /* 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
4072 We can check to see if each glyph variable is actually a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4073 completely different glyph, though. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4074 #define FROB(glyph_obj, gindex) \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4075 update_glyph_cachel_data (w, glyph_obj, \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4076 Dynarr_atp (w->glyph_cachels, gindex))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4077
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4078 FROB (Vcontinuation_glyph, CONT_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4079 FROB (Vtruncation_glyph, TRUN_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4080 FROB (Vhscroll_glyph, HSCROLL_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4081 FROB (Vcontrol_arrow_glyph, CONTROL_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4082 FROB (Voctal_escape_glyph, OCT_ESC_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4083 FROB (Vinvisible_text_glyph, INVIS_GLYPH_INDEX);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4084 #undef FROB
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4085
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4086 for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4087 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4088 Dynarr_atp (w->glyph_cachels, elt)->updated = 0;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4092 /* 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
4093 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4094 mark_glyph_cachels_as_clean (struct window* w)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4095 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4096 int elt;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4097 Lisp_Object window;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4098 XSETWINDOW (window, w);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4099 for (elt = 0; elt < Dynarr_length (w->glyph_cachels); elt++)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4100 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4101 struct glyph_cachel *cachel = Dynarr_atp (w->glyph_cachels, elt);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4102 cachel->dirty = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4103 set_glyph_dirty_p (cachel->glyph, window, 0);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4104 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4105 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4107 #ifdef MEMORY_USAGE_STATS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4109 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4110 compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4111 struct overhead_stats *ovstats)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4112 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4113 int total = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4115 if (glyph_cachels)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4116 total += Dynarr_memory_usage (glyph_cachels, ovstats);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4118 return total;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4119 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4121 #endif /* MEMORY_USAGE_STATS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4122
384
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 /*****************************************************************************
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4126 * subwindow cachel functions *
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4127 *****************************************************************************/
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4128 /* 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
4129 not display them. It is problematic deciding what to do in
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4130 redisplay. We have two caches - a per-window instance cache that
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4131 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
4132 instantiator in the hashtable and when the instantiator goes away
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4133 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
4134 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
4135 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
4136 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
4137 subwindow_cachels. This is a weak list so unreference instances
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4138 will get deleted properly. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4139
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4140 /* redisplay in general assumes that drawing something will erase
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4141 what was there before. unfortunately this does not apply to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4142 subwindows that need to be specifically unmapped in order to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4143 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
4144 cheap - and unmap all subwindows in a display line */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4145
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4146 /* 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
4147 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
4148 removed automatically. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4149 static void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4150 cache_subwindow_instance_in_frame_maybe (Lisp_Object instance)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4151 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4152 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4153 if (image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4154 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4155 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4156 struct frame* f = DOMAIN_XFRAME (IMAGE_INSTANCE_DOMAIN (ii));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4157 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4158 = Fcons (instance, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)));
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
4159 }
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4160 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4161
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4162 /* Unmap and finalize all subwindow instances in the frame cache. This
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4163 is necessary because GC will not guarantee the order things get
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4164 deleted in and moreover, frame finalization deletes the window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4165 system windows before deleting XEmacs windows, and hence
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4166 subwindows. */
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4167 void
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4168 free_frame_subwindow_instance_cache (struct frame* f)
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 Lisp_Object rest;
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 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4173 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4174 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4175 /* Make sure that the subwindow is unmapped so that window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4176 deletion will not try and do it again. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4177 unmap_subwindow (XCAR (rest));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4178 finalize_image_instance (ii, 0);
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 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4181
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4182 /* Unmap and remove all instances from the frame cache. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4183 void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4184 reset_frame_subwindow_instance_cache (struct frame* f)
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 Lisp_Object rest;
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 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4189 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4190 Lisp_Object value = XCAR (rest);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4191 /* Make sure that the subwindow is unmapped so that window
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4192 deletion will not try and do it again. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4193 unmap_subwindow (value);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4194 XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4195 = delq_no_quit (value, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4196 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4197 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4198
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 * subwindow exposure ignorance *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4201 *****************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4202 /* when we unmap subwindows the associated window system will generate
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4203 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
4204 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
4205 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
4206 expose events that are going to come and ignore them as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4207 required. */
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 struct expose_ignore_blocktype
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4210 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4211 Blocktype_declare (struct expose_ignore);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4212 } *the_expose_ignore_blocktype;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4213
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4214 int
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4215 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
4216 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4217 struct expose_ignore *ei, *prev;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4218 /* 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
4219 the first element in the list */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4220 for (ei = f->subwindow_exposures, prev = 0; ei; ei = ei->next)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4221 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4222 /* Checking for exact matches just isn't good enough as we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4223 mighte get exposures for partially obscure subwindows, thus
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4224 we have to check for overlaps. Being conservative we will
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4225 check for exposures wholly contained by the subwindow, this
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4226 might give us what we want.*/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4227 if (ei->x <= x && ei->y <= y
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4228 && ei->x + ei->width >= x + width
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4229 && ei->y + ei->height >= y + height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4230 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4231 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4232 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
4233 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
4234 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4235 if (!prev)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4236 f->subwindow_exposures = ei->next;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4237 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4238 prev->next = ei->next;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4239
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4240 if (ei == f->subwindow_exposures_tail)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4241 f->subwindow_exposures_tail = prev;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4242
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4243 Blocktype_free (the_expose_ignore_blocktype, ei);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4244 return 1;
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 prev = ei;
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 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4249 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4250
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4251 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4252 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
4253 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4254 if (!hold_ignored_expose_registration)
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 struct expose_ignore *ei;
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 = Blocktype_alloc (the_expose_ignore_blocktype);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4259
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4260 ei->next = NULL;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4261 ei->x = x;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4262 ei->y = y;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4263 ei->width = width;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4264 ei->height = height;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4265
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4266 /* 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
4267 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
4268 of the end so that we can add right to it. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4269 if (f->subwindow_exposures_tail)
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 f->subwindow_exposures_tail->next = ei;
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 if (!f->subwindow_exposures)
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 = 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 f->subwindow_exposures_tail = ei;
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
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 find_matching_subwindow
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4283
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4284 See if there is a subwindow that completely encloses the requested
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4285 area.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4286 ****************************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4287 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
4288 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4289 Lisp_Object rest;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4290
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4291 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4292 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4293 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest));
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4294
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4295 if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4296 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4297 IMAGE_INSTANCE_DISPLAY_X (ii) <= x
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4298 &&
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4299 IMAGE_INSTANCE_DISPLAY_Y (ii) <= y
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4300 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4301 IMAGE_INSTANCE_DISPLAY_X (ii)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4302 + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) >= x + width
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4303 &&
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4304 IMAGE_INSTANCE_DISPLAY_Y (ii)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4305 + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) >= y + height)
398
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 return 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4308 }
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 return 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4311 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4312
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4313
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 * subwindow functions *
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4316 *****************************************************************************/
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4317
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4318 /* Update the displayed characteristics of a subwindow. This function
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4319 should generally only get called if the subwindow is actually
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4320 dirty. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4321 void
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4322 update_subwindow (Lisp_Object subwindow)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4323 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4324 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4325 int count = specpdl_depth ();
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4326
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4327 /* 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
4328 common for this function to get called from somewhere in
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4329 redisplay we need to make sure that quits are ignored. Otherwise
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4330 Fsignal will abort. */
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4331 specbind (Qinhibit_quit, Qt);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4332
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4333 ERROR_CHECK_IMAGE_INSTANCE (subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4334
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4335 if (WIDGET_IMAGE_INSTANCEP (subwindow))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4336 {
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4337 if (image_instance_changed (subwindow))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4338 update_widget (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4339 /* Reset the changed flags. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4340 IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4341 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4342 IMAGE_INSTANCE_TEXT_CHANGED (ii) = 0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4343 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4344 else if (IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW
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 !NILP (IMAGE_INSTANCE_FRAME (ii)))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4347 {
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4348 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4349 update_subwindow, (ii));
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4350 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4351
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4352 IMAGE_INSTANCE_SIZE_CHANGED (ii) = 0;
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4353 /* This function is typically called by redisplay just before
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4354 outputting the information to the screen. Thus we record a hash
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4355 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
4356 recorded structure. This approach has limitations in there is a
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4357 good chance that hash values will be different for the same
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4358 visual appearance. However, we would rather that then the other
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4359 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
4360 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
4361 negative - currently it will recurse down 7 levels.*/
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4362 IMAGE_INSTANCE_DISPLAY_HASH (ii) = internal_hash (subwindow,
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4363 IMAGE_INSTANCE_HASH_DEPTH);
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4364
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4365 unbind_to (count, Qnil);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4366 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4367
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4368 int
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4369 image_instance_changed (Lisp_Object 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 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4372
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4373 if (internal_hash (subwindow, IMAGE_INSTANCE_HASH_DEPTH) !=
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4374 IMAGE_INSTANCE_DISPLAY_HASH (ii))
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4375 return 1;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4376 /* #### 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
4377 layouts - and yet the pending items are always nil for
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4378 layouts. We are saved by layout optimization, but I'm undecided
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4379 as to what the correct fix is. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4380 else if (WIDGET_IMAGE_INSTANCEP (subwindow)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4381 && (!internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4382 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii), 0)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4383 || !NILP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii))))
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4384 return 1;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4385 else
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4386 return 0;
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4387 }
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 404
diff changeset
4388
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4389 /* Update all the subwindows on a frame. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4390 void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4391 update_widget_instances (Lisp_Object frame)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4392 {
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4393 struct frame* f;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4394 Lisp_Object rest;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4395
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4396 /* Its possible for the preceeding callback to have deleted the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4397 frame, so cope with this. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4398 if (!FRAMEP (frame) || !FRAME_LIVE_P (XFRAME (frame)))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4399 return;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4400
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4401 CHECK_FRAME (frame);
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4402 f = XFRAME (frame);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4403
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4404 /* If we get called we know something has changed. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4405 LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))
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 Lisp_Object widget = XCAR (rest);
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 if (XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (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 image_instance_changed (widget))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4412 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4413 set_image_instance_dirty_p (widget, 1);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4414 MARK_FRAME_GLYPHS_CHANGED (f);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4415 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4416 }
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4417 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4418
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4419 /* remove a subwindow from its frame */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4420 void unmap_subwindow (Lisp_Object subwindow)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4421 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4422 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4423 struct frame* f;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4424
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4425 ERROR_CHECK_IMAGE_INSTANCE (subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4426
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4427 if (!image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4428 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4429 ||
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4430 !IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4431 return;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4432
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4433 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4434 stderr_out ("unmapping subwindow %d\n", IMAGE_INSTANCE_SUBWINDOW_ID (ii));
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4435 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4436 f = XFRAME (IMAGE_INSTANCE_FRAME (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4437
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4438 /* make sure we don't get expose events */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4439 register_ignored_expose (f, IMAGE_INSTANCE_DISPLAY_X (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4440 IMAGE_INSTANCE_DISPLAY_Y (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4441 IMAGE_INSTANCE_DISPLAY_WIDTH (ii),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4442 IMAGE_INSTANCE_DISPLAY_HEIGHT (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4443 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4444
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4445 MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4446 unmap_subwindow, (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4447 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4448
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4449 /* show a subwindow in its frame */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4450 void map_subwindow (Lisp_Object subwindow, int x, int y,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4451 struct display_glyph_area *dga)
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4452 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4453 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4454 struct frame* f;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4455
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4456 ERROR_CHECK_IMAGE_INSTANCE (subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4457
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4458 if (!image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii))
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4459 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4460 return;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4461
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4462 #ifdef DEBUG_WIDGETS
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4463 stderr_out ("mapping subwindow %d, %dx%d@%d+%d\n",
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4464 IMAGE_INSTANCE_SUBWINDOW_ID (ii),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4465 dga->width, dga->height, x, y);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4466 #endif
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4467 f = XFRAME (IMAGE_INSTANCE_FRAME (ii));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4468 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 1;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4469 IMAGE_INSTANCE_DISPLAY_X (ii) = x;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4470 IMAGE_INSTANCE_DISPLAY_Y (ii) = y;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4471 IMAGE_INSTANCE_DISPLAY_WIDTH (ii) = dga->width;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4472 IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) = dga->height;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4473
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4474 MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain),
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4475 map_subwindow, (ii, x, y, dga));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4476 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4477
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4478 static int
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4479 subwindow_possible_dest_types (void)
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 return IMAGE_SUBWINDOW_MASK;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4482 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4483
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4484 int
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4485 subwindow_governing_domain (void)
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 return GOVERNING_DOMAIN_WINDOW;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4488 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4489
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4490 /* Partially instantiate a subwindow. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4491 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4492 subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4493 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4494 int dest_mask, Lisp_Object domain)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4495 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4496 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4497 Lisp_Object device = image_instance_device (image_instance);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4498 Lisp_Object frame = DOMAIN_FRAME (domain);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4499 Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4500 Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4501
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4502 if (NILP (frame))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4503 signal_simple_error ("No selected frame", device);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4504
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4505 if (!(dest_mask & IMAGE_SUBWINDOW_MASK))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4506 incompatible_image_types (instantiator, dest_mask, IMAGE_SUBWINDOW_MASK);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4507
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4508 ii->data = 0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4509 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = 0;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4510 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0;
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4511
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4512 if (INTP (width))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4513 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4514 int w = 1;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4515 if (XINT (width) > 1)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4516 w = XINT (width);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4517 IMAGE_INSTANCE_WIDTH (ii) = w;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4518 IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4519 }
404
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4520
2f8bb876ab1d Import from CVS: tag r21-2-32
cvs
parents: 400
diff changeset
4521 if (INTP (height))
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4522 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4523 int h = 1;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4524 if (XINT (height) > 1)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4525 h = XINT (height);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4526 IMAGE_INSTANCE_HEIGHT (ii) = h;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4527 IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4528 }
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4529 }
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4530
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4531 /* 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
4532 #### It should really query the enclose window for geometry. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4533 static void
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4534 subwindow_query_geometry (Lisp_Object image_instance, unsigned int* width,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4535 unsigned int* height, enum image_instance_geometry disp,
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4536 Lisp_Object domain)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4537 {
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4538 if (width) *width = 20;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4539 if (height) *height = 20;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4540 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4541
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4542 DEFUN ("subwindowp", Fsubwindowp, 1, 1, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4543 Return non-nil if OBJECT is a subwindow.
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 (object))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4546 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4547 CHECK_IMAGE_INSTANCE (object);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4548 return (XIMAGE_INSTANCE_TYPE (object) == IMAGE_SUBWINDOW) ? Qt : Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4549 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4550
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4551 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
4552 Return the window id of SUBWINDOW as a number.
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 (subwindow))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4555 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4556 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4557 return make_int ((int) XIMAGE_INSTANCE_SUBWINDOW_ID (subwindow));
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4558 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4559
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4560 DEFUN ("resize-subwindow", Fresize_subwindow, 1, 3, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4561 Resize SUBWINDOW to WIDTH x HEIGHT.
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4562 If a value is nil that parameter is not changed.
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 (subwindow, width, height))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4565 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4566 int neww, newh;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4567 Lisp_Image_Instance* ii;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4568
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4569 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4570 ii = XIMAGE_INSTANCE (subwindow);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4571
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4572 if (NILP (width))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4573 neww = IMAGE_INSTANCE_WIDTH (ii);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4574 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4575 neww = XINT (width);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4576
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4577 if (NILP (height))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4578 newh = IMAGE_INSTANCE_HEIGHT (ii);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4579 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4580 newh = XINT (height);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4581
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4582 /* The actual resizing gets done asychronously by
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4583 update_subwindow. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4584 IMAGE_INSTANCE_HEIGHT (ii) = newh;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4585 IMAGE_INSTANCE_WIDTH (ii) = neww;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4586 IMAGE_INSTANCE_SIZE_CHANGED (ii) = 1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4587
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4588 return subwindow;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4589 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4590
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4591 DEFUN ("force-subwindow-map", Fforce_subwindow_map, 1, 1, 0, /*
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4592 Generate a Map event for 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 (subwindow))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4595 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4596 CHECK_SUBWINDOW_IMAGE_INSTANCE (subwindow);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4597 #if 0
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4598 map_subwindow (subwindow, 0, 0);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4599 #endif
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4600 return subwindow;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4601 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4602
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4604 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4605 * display tables *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4606 *****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4607
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4608 /* 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
4609 FACE. #### This will have to be redone. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4610
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4611 void
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4612 get_display_tables (struct window *w, face_index findex,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4613 Lisp_Object *face_table, Lisp_Object *window_table)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4614 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
4615 Lisp_Object tem;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4616 tem = WINDOW_FACE_CACHEL_DISPLAY_TABLE (w, findex);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4617 if (UNBOUNDP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4618 tem = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4619 if (!LISTP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4620 tem = noseeum_cons (tem, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4621 *face_table = tem;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4622 tem = w->display_table;
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4623 if (UNBOUNDP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4624 tem = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4625 if (!LISTP (tem))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4626 tem = noseeum_cons (tem, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4627 *window_table = tem;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4628 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4629
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4630 Lisp_Object
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4631 display_table_entry (Emchar ch, Lisp_Object face_table,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4632 Lisp_Object window_table)
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 Lisp_Object tail;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4635
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4636 /* Loop over FACE_TABLE, and then over WINDOW_TABLE. */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4637 for (tail = face_table; 1; tail = XCDR (tail))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4638 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4639 Lisp_Object table;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4640 if (NILP (tail))
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 if (!NILP (window_table))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4643 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4644 tail = window_table;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4645 window_table = Qnil;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4646 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4647 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4648 return Qnil;
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 table = XCAR (tail);
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 (VECTORP (table))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4653 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4654 if (ch < XVECTOR_LENGTH (table) && !NILP (XVECTOR_DATA (table)[ch]))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4655 return XVECTOR_DATA (table)[ch];
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4656 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4657 continue;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4658 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4659 else if (CHAR_TABLEP (table)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4660 && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_CHAR)
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 return get_char_table (ch, XCHAR_TABLE (table));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4663 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4664 else if (CHAR_TABLEP (table)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4665 && XCHAR_TABLE_TYPE (table) == CHAR_TABLE_TYPE_GENERIC)
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4666 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4667 Lisp_Object gotit = get_char_table (ch, XCHAR_TABLE (table));
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4668 if (!NILP (gotit))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4669 return gotit;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4670 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4671 continue;
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 else if (RANGE_TABLEP (table))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4674 {
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4675 Lisp_Object gotit = Fget_range_table (make_char (ch), table, Qnil);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4676 if (!NILP (gotit))
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4677 return gotit;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4678 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4679 continue;
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4680 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4681 else
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4682 abort ();
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4683 }
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4684 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4685
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 * timeouts for animated glyphs *
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 static Lisp_Object Qglyph_animated_timeout_handler;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4690
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4691 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
4692 Callback function for updating animated images.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4693 Don't use this.
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 (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 CHECK_WEAK_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 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
4700 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4701 Lisp_Object value = XCAR (XWEAK_LIST_LIST (arg));
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 if (IMAGE_INSTANCEP (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 Lisp_Image_Instance* ii = XIMAGE_INSTANCE (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 if (COLOR_PIXMAP_IMAGE_INSTANCEP (value)
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 IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii) > 1
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 !disable_animated_pixmaps)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4712 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4713 /* Increment the index of the image slice we are currently
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4714 viewing. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4715 IMAGE_INSTANCE_PIXMAP_SLICE (ii) =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4716 (IMAGE_INSTANCE_PIXMAP_SLICE (ii) + 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4717 % IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4718 /* We might need to kick redisplay at this point - but we
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4719 also might not. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4720 MARK_DEVICE_FRAMES_GLYPHS_CHANGED
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4721 (XDEVICE (image_instance_device (value)));
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4722 /* 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
4723 for instance. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4724 set_image_instance_dirty_p (value, 1);
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 }
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 return Qnil;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4729 }
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 add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object image)
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 Lisp_Object ret = Qnil;
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 if (tickms > 0 && IMAGE_INSTANCEP (image))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4736 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4737 double ms = ((double)tickms) / 1000.0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4738 struct gcpro gcpro1;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4739 Lisp_Object holder = make_weak_list (WEAK_LIST_SIMPLE);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4740
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4741 GCPRO1 (holder);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4742 XWEAK_LIST_LIST (holder) = Fcons (image, Qnil);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4743
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4744 ret = Fadd_timeout (make_float (ms),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4745 Qglyph_animated_timeout_handler,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4746 holder, make_float (ms));
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 UNGCPRO;
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 return ret;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4751 }
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 void disable_glyph_animated_timeout (int i)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4754 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4755 Lisp_Object id;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4756 XSETINT (id, i);
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 Fdisable_timeout (id);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4759 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4760
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4762 /*****************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4763 * initialization *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4764 *****************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4766 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4767 syms_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4768 {
400
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4769 INIT_LRECORD_IMPLEMENTATION (glyph);
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4770 INIT_LRECORD_IMPLEMENTATION (image_instance);
a86b2b5e0111 Import from CVS: tag r21-2-30
cvs
parents: 398
diff changeset
4771
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4772 /* image instantiators */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4773
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4774 DEFSUBR (Fimage_instantiator_format_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4775 DEFSUBR (Fvalid_image_instantiator_format_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4776 DEFSUBR (Fset_console_type_image_conversion_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4777 DEFSUBR (Fconsole_type_image_conversion_list);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4778
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4779 defkeyword (&Q_file, ":file");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4780 defkeyword (&Q_data, ":data");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4781 defkeyword (&Q_face, ":face");
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4782 defkeyword (&Q_pixel_height, ":pixel-height");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4783 defkeyword (&Q_pixel_width, ":pixel-width");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4784
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
4785 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
4786 defkeyword (&Q_color_symbols, ":color-symbols");
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
4787 #endif
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4788 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4789 defkeyword (&Q_mask_file, ":mask-file");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4790 defkeyword (&Q_mask_data, ":mask-data");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4791 defkeyword (&Q_hotspot_x, ":hotspot-x");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4792 defkeyword (&Q_hotspot_y, ":hotspot-y");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4793 defkeyword (&Q_foreground, ":foreground");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4794 defkeyword (&Q_background, ":background");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
4795 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4796 /* image specifiers */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4797
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4798 DEFSUBR (Fimage_specifier_p);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4799 /* Qimage in general.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4801 /* image instances */
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 (&Qimage_instancep, "image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4804
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4805 defsymbol (&Qnothing_image_instance_p, "nothing-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4806 defsymbol (&Qtext_image_instance_p, "text-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4807 defsymbol (&Qmono_pixmap_image_instance_p, "mono-pixmap-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4808 defsymbol (&Qcolor_pixmap_image_instance_p, "color-pixmap-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4809 defsymbol (&Qpointer_image_instance_p, "pointer-image-instance-p");
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4810 defsymbol (&Qwidget_image_instance_p, "widget-image-instance-p");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4811 defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4812
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4813 DEFSUBR (Fmake_image_instance);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4814 DEFSUBR (Fimage_instance_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4815 DEFSUBR (Fimage_instance_type);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4816 DEFSUBR (Fvalid_image_instance_type_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4817 DEFSUBR (Fimage_instance_type_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4818 DEFSUBR (Fimage_instance_name);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4819 DEFSUBR (Fimage_instance_domain);
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4820 DEFSUBR (Fimage_instance_string);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4821 DEFSUBR (Fimage_instance_file_name);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4822 DEFSUBR (Fimage_instance_mask_file_name);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4823 DEFSUBR (Fimage_instance_depth);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4824 DEFSUBR (Fimage_instance_height);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4825 DEFSUBR (Fimage_instance_width);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4826 DEFSUBR (Fimage_instance_hotspot_x);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4827 DEFSUBR (Fimage_instance_hotspot_y);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4828 DEFSUBR (Fimage_instance_foreground);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4829 DEFSUBR (Fimage_instance_background);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4830 DEFSUBR (Fimage_instance_property);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4831 DEFSUBR (Fset_image_instance_property);
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4832 DEFSUBR (Fcolorize_image_instance);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4833 /* subwindows */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4834 DEFSUBR (Fsubwindowp);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4835 DEFSUBR (Fimage_instance_subwindow_id);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4836 DEFSUBR (Fresize_subwindow);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
4837 DEFSUBR (Fforce_subwindow_map);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4839 /* Qnothing defined as part of the "nothing" image-instantiator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4840 type. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4841 /* Qtext defined in general.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4842 defsymbol (&Qmono_pixmap, "mono-pixmap");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4843 defsymbol (&Qcolor_pixmap, "color-pixmap");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4844 /* Qpointer defined in general.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4846 /* glyphs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4847
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4848 defsymbol (&Qglyphp, "glyphp");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4849 defsymbol (&Qcontrib_p, "contrib-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4850 defsymbol (&Qbaseline, "baseline");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4851
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4852 defsymbol (&Qbuffer_glyph_p, "buffer-glyph-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4853 defsymbol (&Qpointer_glyph_p, "pointer-glyph-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4854 defsymbol (&Qicon_glyph_p, "icon-glyph-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4856 defsymbol (&Qconst_glyph_variable, "const-glyph-variable");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4857
20
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4858 DEFSUBR (Fglyph_type);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4859 DEFSUBR (Fvalid_glyph_type_p);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4860 DEFSUBR (Fglyph_type_list);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4861 DEFSUBR (Fglyphp);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4862 DEFSUBR (Fmake_glyph_internal);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4863 DEFSUBR (Fglyph_width);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4864 DEFSUBR (Fglyph_ascent);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4865 DEFSUBR (Fglyph_descent);
859a2309aef8 Import from CVS: tag r19-15b93
cvs
parents: 16
diff changeset
4866 DEFSUBR (Fglyph_height);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4868 /* Qbuffer defined in general.c. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4869 /* Qpointer defined above */
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4870
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4871 /* Unfortunately, timeout handlers must be lisp functions. This is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4872 for animated glyphs. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4873 defsymbol (&Qglyph_animated_timeout_handler,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4874 "glyph-animated-timeout-handler");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4875 DEFSUBR (Fglyph_animated_timeout_handler);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4876
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4877 /* Errors */
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4878 deferror (&Qimage_conversion_error,
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4879 "image-conversion-error",
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4880 "image-conversion error", Qio_error);
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 249
diff changeset
4881
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4882 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4883
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4884 static const struct lrecord_description image_specifier_description[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4885 { XD_LISP_OBJECT, specifier_data_offset + offsetof (struct image_specifier, attachee) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4886 { 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
4887 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4888 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4889
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4890 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4891 specifier_type_create_image (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4892 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4893 /* image specifiers */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4895 INITIALIZE_SPECIFIER_TYPE_WITH_DATA (image, "image", "imagep");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4896
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4897 SPECIFIER_HAS_METHOD (image, create);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4898 SPECIFIER_HAS_METHOD (image, mark);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4899 SPECIFIER_HAS_METHOD (image, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4900 SPECIFIER_HAS_METHOD (image, validate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4901 SPECIFIER_HAS_METHOD (image, after_change);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4902 SPECIFIER_HAS_METHOD (image, going_to_add);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4903 SPECIFIER_HAS_METHOD (image, copy_instantiator);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4904 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4905
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4906 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4907 reinit_specifier_type_create_image (void)
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 REINITIALIZE_SPECIFIER_TYPE (image);
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4912
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4913 static const struct lrecord_description iike_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4914 { XD_LISP_OBJECT, offsetof (ii_keyword_entry, keyword) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4915 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4916 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4917
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4918 static const struct struct_description iike_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4919 sizeof (ii_keyword_entry),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4920 iike_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4921 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4922
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4923 static const struct lrecord_description iiked_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4924 XD_DYNARR_DESC (ii_keyword_entry_dynarr, &iike_description),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4925 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4926 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4927
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4928 static const struct struct_description iiked_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4929 sizeof (ii_keyword_entry_dynarr),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4930 iiked_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4931 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4932
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4933 static const struct lrecord_description iife_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4934 { XD_LISP_OBJECT, offsetof (image_instantiator_format_entry, symbol) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4935 { XD_LISP_OBJECT, offsetof (image_instantiator_format_entry, device) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4936 { 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
4937 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4938 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4939
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4940 static const struct struct_description iife_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4941 sizeof (image_instantiator_format_entry),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4942 iife_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4943 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4944
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4945 static const struct lrecord_description iifed_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4946 XD_DYNARR_DESC (image_instantiator_format_entry_dynarr, &iife_description),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4947 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4948 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4949
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4950 static const struct struct_description iifed_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4951 sizeof (image_instantiator_format_entry_dynarr),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4952 iifed_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4953 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4954
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4955 static const struct lrecord_description iim_description_1[] = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4956 { XD_LISP_OBJECT, offsetof (struct image_instantiator_methods, symbol) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4957 { XD_LISP_OBJECT, offsetof (struct image_instantiator_methods, device) },
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4958 { 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
4959 { 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
4960 { XD_END }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4961 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4962
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4963 const struct struct_description iim_description = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4964 sizeof(struct image_instantiator_methods),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4965 iim_description_1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4966 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4967
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4968 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4969 image_instantiator_format_create (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4970 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4971 /* image instantiators */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4973 the_image_instantiator_format_entry_dynarr =
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
4974 Dynarr_new (image_instantiator_format_entry);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4975
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4976 Vimage_instantiator_format_list = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4977 staticpro (&Vimage_instantiator_format_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4978
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4979 dumpstruct (&the_image_instantiator_format_entry_dynarr, &iifed_description);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
4980
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4981 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (nothing, "nothing");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4983 IIFORMAT_HAS_METHOD (nothing, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4984 IIFORMAT_HAS_METHOD (nothing, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4986 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (inherit, "inherit");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4988 IIFORMAT_HAS_METHOD (inherit, validate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4989 IIFORMAT_HAS_METHOD (inherit, normalize);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4990 IIFORMAT_HAS_METHOD (inherit, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4991 IIFORMAT_HAS_METHOD (inherit, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4993 IIFORMAT_VALID_KEYWORD (inherit, Q_face, check_valid_face);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4995 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (string, "string");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4996
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4997 IIFORMAT_HAS_METHOD (string, validate);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
4998 IIFORMAT_HAS_SHARED_METHOD (string, governing_domain, subwindow);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4999 IIFORMAT_HAS_METHOD (string, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5000 IIFORMAT_HAS_METHOD (string, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5002 IIFORMAT_VALID_KEYWORD (string, Q_data, check_valid_string);
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5003 /* Do this so we can set strings. */
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5004 /* #### 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
5005 visible to the user. */
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5006 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (text, "text");
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5007 IIFORMAT_HAS_METHOD (text, set_property);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5008 IIFORMAT_HAS_METHOD (text, query_geometry);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5010 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (formatted_string, "formatted-string");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5011
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5012 IIFORMAT_HAS_METHOD (formatted_string, validate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5013 IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5014 IIFORMAT_HAS_METHOD (formatted_string, instantiate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5015 IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string);
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5016
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5017 /* Do this so pointers have geometry. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5018 /* #### 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
5019 visible to the user. */
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5020 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (pointer, "pointer");
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5021 IIFORMAT_HAS_SHARED_METHOD (pointer, query_geometry, subwindow);
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5022
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5023 /* subwindows */
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5024 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (subwindow, "subwindow");
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5025 IIFORMAT_HAS_METHOD (subwindow, possible_dest_types);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5026 IIFORMAT_HAS_METHOD (subwindow, governing_domain);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5027 IIFORMAT_HAS_METHOD (subwindow, instantiate);
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5028 IIFORMAT_HAS_METHOD (subwindow, query_geometry);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5029 IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_width, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5030 IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_height, check_valid_int);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5031
288
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5032 #ifdef HAVE_WINDOW_SYSTEM
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5033 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xbm, "xbm");
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5034
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5035 IIFORMAT_HAS_METHOD (xbm, validate);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5036 IIFORMAT_HAS_METHOD (xbm, normalize);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5037 IIFORMAT_HAS_METHOD (xbm, possible_dest_types);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5038
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5039 IIFORMAT_VALID_KEYWORD (xbm, Q_data, check_valid_xbm_inline);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5040 IIFORMAT_VALID_KEYWORD (xbm, Q_file, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5041 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_data, check_valid_xbm_inline);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5042 IIFORMAT_VALID_KEYWORD (xbm, Q_mask_file, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5043 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_x, check_valid_int);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5044 IIFORMAT_VALID_KEYWORD (xbm, Q_hotspot_y, check_valid_int);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5045 IIFORMAT_VALID_KEYWORD (xbm, Q_foreground, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5046 IIFORMAT_VALID_KEYWORD (xbm, Q_background, check_valid_string);
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5047 #endif /* HAVE_WINDOW_SYSTEM */
e11d67e05968 Import from CVS: tag r21-0b42
cvs
parents: 284
diff changeset
5048
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5049 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5050 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5051
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5052 IIFORMAT_HAS_METHOD (xface, validate);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5053 IIFORMAT_HAS_METHOD (xface, normalize);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5054 IIFORMAT_HAS_METHOD (xface, possible_dest_types);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5055
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5056 IIFORMAT_VALID_KEYWORD (xface, Q_data, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5057 IIFORMAT_VALID_KEYWORD (xface, Q_file, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5058 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_x, check_valid_int);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5059 IIFORMAT_VALID_KEYWORD (xface, Q_hotspot_y, check_valid_int);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5060 IIFORMAT_VALID_KEYWORD (xface, Q_foreground, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5061 IIFORMAT_VALID_KEYWORD (xface, Q_background, check_valid_string);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5062 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5063
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5064 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5065 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm");
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5066
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5067 IIFORMAT_HAS_METHOD (xpm, validate);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5068 IIFORMAT_HAS_METHOD (xpm, normalize);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5069 IIFORMAT_HAS_METHOD (xpm, possible_dest_types);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5070
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5071 IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5072 IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5073 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
5074 #endif /* HAVE_XPM */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5075 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5076
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5077 void
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5078 reinit_vars_of_glyphs (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5079 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5080 the_expose_ignore_blocktype =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5081 Blocktype_new (struct expose_ignore_blocktype);
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 hold_ignored_expose_registration = 0;
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5086
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5087 void
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5088 vars_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5089 {
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5090 reinit_vars_of_glyphs ();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5091
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5092 Vthe_nothing_vector = vector1 (Qnothing);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5093 staticpro (&Vthe_nothing_vector);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5095 /* image instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5096
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5097 Vimage_instance_type_list = Fcons (Qnothing,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5098 list6 (Qtext, Qmono_pixmap, Qcolor_pixmap,
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5099 Qpointer, Qsubwindow, Qwidget));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5100 staticpro (&Vimage_instance_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5102 /* glyphs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5104 Vglyph_type_list = list3 (Qbuffer, Qpointer, Qicon);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5105 staticpro (&Vglyph_type_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5107 /* The octal-escape glyph, control-arrow-glyph and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5108 invisible-text-glyph are completely initialized in glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5110 DEFVAR_LISP ("octal-escape-glyph", &Voctal_escape_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5111 What to prefix character codes displayed in octal with.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5112 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5113 Voctal_escape_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5115 DEFVAR_LISP ("control-arrow-glyph", &Vcontrol_arrow_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5116 What to use as an arrow for control characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5117 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5118 Vcontrol_arrow_glyph = allocate_glyph (GLYPH_BUFFER,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5119 redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5121 DEFVAR_LISP ("invisible-text-glyph", &Vinvisible_text_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5122 What to use to indicate the presence of invisible text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5123 This is the glyph that is displayed when an ellipsis is called for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5124 \(see `selective-display-ellipses' and `buffer-invisibility-spec').
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 173
diff changeset
5125 Normally this is three dots ("...").
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5126 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5127 Vinvisible_text_glyph = allocate_glyph (GLYPH_BUFFER,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5128 redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5130 /* Partially initialized in glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5131 DEFVAR_LISP ("hscroll-glyph", &Vhscroll_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5132 What to display at the beginning of horizontally scrolled lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5133 */);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5134 Vhscroll_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5135 #ifdef HAVE_WINDOW_SYSTEM
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5136 Fprovide (Qxbm);
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 380
diff changeset
5137 #endif
276
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5138 #ifdef HAVE_XPM
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5139 Fprovide (Qxpm);
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5140
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5141 DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /*
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5142 Definitions of logical color-names used when reading XPM files.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5143 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
5144 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
5145 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
5146 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
5147 color called COLOR-NAME, it will display as the computed color instead.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5148
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5149 The default value of this variable defines the logical color names
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5150 \"foreground\" and \"background\" to be the colors of the `default' face.
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5151 */ );
6330739388db Import from CVS: tag r21-0b36
cvs
parents: 272
diff changeset
5152 Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 280
diff changeset
5153 #endif /* HAVE_XPM */
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5154 #ifdef HAVE_XFACE
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5155 Fprovide (Qxface);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents: 384
diff changeset
5156 #endif
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5157
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5158 DEFVAR_BOOL ("disable-animated-pixmaps", &disable_animated_pixmaps /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5159 Whether animated pixmaps should be animated.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5160 Default is t.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5161 */);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5162 disable_animated_pixmaps = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5163 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5165 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5166 specifier_vars_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5167 {
249
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
5168 /* #### Can we GC here? The set_specifier_* calls definitely need */
83b3d10dcba9 Import from CVS: tag r20-5b23
cvs
parents: 223
diff changeset
5169 /* protection. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5170 /* display tables */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5172 DEFVAR_SPECIFIER ("current-display-table", &Vcurrent_display_table /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5173 *The display table currently in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5174 This is a specifier; use `set-specifier' to change it.
408
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5175
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5176 Display tables are used to control how characters are displayed. Each
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5177 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
5178 display tables that apply (obtained by calling `specifier-instance' on
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5179 `current-display-table' and any overriding display tables specified in
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5180 currently active faces). The first entry found that matches the
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5181 character determines how the character is displayed. If there is no
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5182 matching entry, the default display method is used. (Non-control
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5183 characters are displayed as themselves and control characters are
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5184 displayed according to the buffer-local variable `ctl-arrow'. Control
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5185 characters are further affected by `control-arrow-glyph' and
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5186 `octal-escape-glyph'.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5187
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5188 Each instantiator in this specifier and the display-table specifiers
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5189 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
5190 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
5191 character. Each display table is one of
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5192
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5193 -- a vector, specifying values for characters starting at 0
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5194 -- a char table, either of type `char' or `generic'
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5195 -- a range table
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 Each entry in a display table should be one of
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5198
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5199 -- nil (this entry is ignored and the search continues)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5200 -- 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
5201 the original character, default processing happens, otherwise
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5202 redisplay attempts to display this character directly;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5203 #### At some point recursive display-table lookup will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5204 implemented.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5205 -- a string (display each character in the string directly;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5206 #### At some point recursive display-table lookup will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5207 implemented.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5208 -- a glyph (display the glyph;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5209 #### At some point recursive display-table lookup will be
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5210 implemented when a string glyph is being processed.)
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5211 -- 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
5212 spec used to process the character. #### Unfortunately no
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5213 formatting directives other than %% are implemented.
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5214 -- a vector (each element of the vector is processed recursively;
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5215 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
5216
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5217 #### 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
5218 be expanded to include other features, such as referencing characters
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5219 in particular fonts and allowing the character search to continue
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5220 all the way up the chain of specifier instantiators. These features
501cfd01ee6d Import from CVS: tag r21-2-34
cvs
parents: 406
diff changeset
5221 are necessary to properly display Unicode characters.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5222 */ );
116
9f59509498e1 Import from CVS: tag r20-1b10
cvs
parents: 84
diff changeset
5223 Vcurrent_display_table = Fmake_specifier (Qdisplay_table);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5224 set_specifier_fallback (Vcurrent_display_table,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5225 list1 (Fcons (Qnil, Qnil)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5226 set_specifier_caching (Vcurrent_display_table,
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 388
diff changeset
5227 offsetof (struct window, display_table),
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5228 some_window_value_changed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5229 0, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5230 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5232 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5233 complex_vars_of_glyphs (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5234 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5235 /* Partially initialized in glyphs-x.c, glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5236 DEFVAR_LISP ("truncation-glyph", &Vtruncation_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5237 What to display at the end of truncated lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5238 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5239 Vtruncation_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5241 /* Partially initialized in glyphs-x.c, glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5242 DEFVAR_LISP ("continuation-glyph", &Vcontinuation_glyph /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5243 What to display at the end of wrapped lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5244 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5245 Vcontinuation_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5247 /* Partially initialized in glyphs-x.c, glyphs.el */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5248 DEFVAR_LISP ("xemacs-logo", &Vxemacs_logo /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5249 The glyph used to display the XEmacs logo at startup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5250 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5251 Vxemacs_logo = allocate_glyph (GLYPH_BUFFER, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5252 }