0
|
1 /* Generic glyph data structures + display tables
|
|
2 Copyright (C) 1994 Board of Trustees, University of Illinois.
|
|
3 Copyright (C) 1995, 1996 Ben Wing
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
398
|
24 #ifndef INCLUDED_glyphs_h_
|
|
25 #define INCLUDED_glyphs_h_
|
0
|
26
|
|
27 #include "specifier.h"
|
384
|
28 #include "gui.h"
|
0
|
29
|
272
|
30 /************************************************************************/
|
|
31 /* Image Instantiators */
|
|
32 /************************************************************************/
|
0
|
33
|
|
34 struct image_instantiator_methods;
|
|
35
|
|
36 /* Remember the distinction between image instantiator formats and
|
|
37 image instance types. Here's an approximate mapping:
|
|
38
|
272
|
39 image instantiator format image instance type
|
|
40 ------------------------- -------------------
|
|
41 nothing nothing
|
|
42 string text
|
|
43 formatted-string text
|
|
44 xbm mono-pixmap, color-pixmap, pointer
|
|
45 xpm color-pixmap, mono-pixmap, pointer
|
|
46 xface mono-pixmap, color-pixmap, pointer
|
|
47 gif color-pixmap
|
|
48 jpeg color-pixmap
|
|
49 png color-pixmap
|
|
50 tiff color-pixmap
|
384
|
51 bmp color-pixmap
|
272
|
52 cursor-font pointer
|
384
|
53 mswindows-resource pointer
|
272
|
54 font pointer
|
|
55 subwindow subwindow
|
|
56 inherit mono-pixmap
|
|
57 autodetect mono-pixmap, color-pixmap, pointer, text
|
398
|
58 button widget
|
|
59 edit-field widget
|
|
60 combo -box widget
|
|
61 progress-gauge widget
|
|
62 tab-control widget
|
|
63 tree-view widget
|
384
|
64 scrollbar widget
|
398
|
65 static widget
|
0
|
66 */
|
|
67
|
|
68 /* These are methods specific to a particular format of image instantiator
|
|
69 (e.g. xpm, string, etc.). */
|
|
70
|
185
|
71 typedef struct ii_keyword_entry ii_keyword_entry;
|
|
72 struct ii_keyword_entry
|
|
73 {
|
|
74 Lisp_Object keyword;
|
|
75 void (*validate) (Lisp_Object data);
|
|
76 int multiple_p;
|
398
|
77 int copy_p;
|
185
|
78 };
|
|
79
|
|
80 typedef struct
|
|
81 {
|
|
82 Dynarr_declare (ii_keyword_entry);
|
|
83 } ii_keyword_entry_dynarr;
|
|
84
|
398
|
85 extern const struct struct_description iim_description;
|
|
86
|
|
87 enum image_instance_geometry
|
|
88 {
|
|
89 IMAGE_GEOMETRY,
|
|
90 IMAGE_DESIRED_GEOMETRY,
|
|
91 IMAGE_MIN_GEOMETRY,
|
|
92 IMAGE_MAX_GEOMETRY,
|
|
93 IMAGE_UNSPECIFIED_GEOMETRY = ~0
|
|
94 };
|
|
95
|
|
96 #define WIDGET_BORDER_HEIGHT 4
|
|
97 #define WIDGET_BORDER_WIDTH 4
|
|
98
|
0
|
99 struct image_instantiator_methods
|
|
100 {
|
|
101 Lisp_Object symbol;
|
|
102
|
384
|
103 Lisp_Object device; /* sometimes used */
|
|
104
|
185
|
105 ii_keyword_entry_dynarr *keywords;
|
398
|
106 /* consoles this ii is supported on */
|
|
107 console_type_entry_dynarr *consoles;
|
0
|
108 /* Implementation specific methods: */
|
|
109
|
|
110 /* Validate method: Given an instantiator vector, signal an error if
|
|
111 it's invalid for this image-instantiator format. Note that this
|
|
112 validation only occurs after all the keyword-specific validation
|
|
113 has already been performed. This is chiefly useful for making
|
|
114 sure that certain required keywords are present. */
|
|
115 void (*validate_method) (Lisp_Object instantiator);
|
|
116
|
|
117 /* Normalize method: Given an instantiator, convert it to the form
|
|
118 that should be used in a glyph, for devices of type CONSOLE_TYPE.
|
|
119 Signal an error if conversion fails. */
|
|
120 Lisp_Object (*normalize_method) (Lisp_Object instantiator,
|
|
121 Lisp_Object console_type);
|
|
122
|
|
123 /* Possible-dest-types method: Return a mask indicating what dest types
|
|
124 are compatible with this format. */
|
|
125 int (*possible_dest_types_method) (void);
|
|
126
|
|
127 /* Instantiate method: Given an instantiator and a partially
|
|
128 filled-in image instance, complete the filling-in. Return
|
|
129 non-zero if the instantiation succeeds, 0 if it fails.
|
|
130 This must be present. */
|
|
131 void (*instantiate_method) (Lisp_Object image_instance,
|
|
132 Lisp_Object instantiator,
|
|
133 Lisp_Object pointer_fg,
|
|
134 Lisp_Object pointer_bg,
|
124
|
135 int dest_mask,
|
|
136 Lisp_Object domain);
|
384
|
137 /* Property method: Given an image instance, return device specific
|
|
138 properties. */
|
|
139 Lisp_Object (*property_method) (Lisp_Object image_instance,
|
|
140 Lisp_Object property);
|
|
141 /* Set-property method: Given an image instance, set device specific
|
|
142 properties. */
|
|
143 Lisp_Object (*set_property_method) (Lisp_Object image_instance,
|
|
144 Lisp_Object property,
|
|
145 Lisp_Object val);
|
398
|
146 /* Asynchronously update properties. */
|
|
147 void (*update_method) (Lisp_Object image_instance);
|
|
148
|
|
149 /* Find out the desired geometry, as given by disp, of this image
|
|
150 instance. Actual geometry is stored in the appropriate slots in the
|
|
151 image instance. */
|
|
152 void (*query_geometry_method) (Lisp_Object image_instance,
|
|
153 unsigned int* width, unsigned int* height,
|
|
154 enum image_instance_geometry disp,
|
|
155 Lisp_Object domain);
|
|
156
|
|
157 /* Layout the instance and its children bounded by the provided
|
|
158 dimensions. */
|
|
159 void (*layout_method) (Lisp_Object image_instance,
|
|
160 unsigned int width, unsigned int height,
|
|
161 Lisp_Object domain);
|
0
|
162 };
|
|
163
|
|
164 /***** Calling an image-instantiator method *****/
|
|
165
|
396
|
166 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0)
|
0
|
167 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args)
|
|
168
|
|
169 /* Call a void-returning specifier method, if it exists */
|
396
|
170 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \
|
|
171 do { \
|
|
172 struct image_instantiator_methods *MIM_mstruc = (mstruc); \
|
|
173 if (MIM_mstruc && HAS_IIFORMAT_METH_P (MIM_mstruc, m)) \
|
|
174 IIFORMAT_METH (MIM_mstruc, m, args); \
|
0
|
175 } while (0)
|
|
176
|
396
|
177 #define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \
|
|
178 do { \
|
|
179 struct image_instantiator_methods *MID_mstruc = \
|
|
180 decode_ii_device (device, mstruc); \
|
|
181 if (MID_mstruc) \
|
|
182 MAYBE_IIFORMAT_METH(MID_mstruc, m, args); \
|
384
|
183 } while (0)
|
|
184
|
|
185
|
0
|
186 /* Call a specifier method, if it exists; otherwise return
|
|
187 the specified value */
|
|
188
|
272
|
189 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \
|
|
190 (HAS_IIFORMAT_METH_P (mstruc, m) ? \
|
|
191 IIFORMAT_METH (mstruc, m, args) : (given))
|
0
|
192
|
|
193 /***** Defining new image-instantiator types *****/
|
|
194
|
185
|
195 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \
|
0
|
196 extern struct image_instantiator_methods *format##_image_instantiator_methods
|
|
197
|
185
|
198 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \
|
0
|
199 struct image_instantiator_methods *format##_image_instantiator_methods
|
|
200
|
384
|
201 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name) \
|
185
|
202 do { \
|
|
203 format##_image_instantiator_methods = \
|
272
|
204 xnew_and_zero (struct image_instantiator_methods); \
|
185
|
205 format##_image_instantiator_methods->symbol = Q##format; \
|
384
|
206 format##_image_instantiator_methods->device = Qnil; \
|
185
|
207 format##_image_instantiator_methods->keywords = \
|
|
208 Dynarr_new (ii_keyword_entry); \
|
398
|
209 format##_image_instantiator_methods->consoles = \
|
|
210 Dynarr_new (console_type_entry); \
|
185
|
211 add_entry_to_image_instantiator_format_list \
|
|
212 (Q##format, format##_image_instantiator_methods); \
|
398
|
213 dumpstruct (&format##_image_instantiator_methods, \
|
|
214 &iim_description); \
|
185
|
215 } while (0)
|
0
|
216
|
384
|
217 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
|
|
218 do { \
|
|
219 defsymbol (&Q##format, obj_name); \
|
398
|
220 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name);\
|
384
|
221 } while (0)
|
|
222
|
0
|
223 /* Declare that image-instantiator format FORMAT has method M; used in
|
|
224 initialization routines */
|
|
225 #define IIFORMAT_HAS_METHOD(format, m) \
|
|
226 (format##_image_instantiator_methods->m##_method = format##_##m)
|
|
227
|
384
|
228 #define IIFORMAT_HAS_SHARED_METHOD(format, m, type) \
|
|
229 (format##_image_instantiator_methods->m##_method = type##_##m)
|
|
230
|
0
|
231 /* Declare that KEYW is a valid keyword for image-instantiator format
|
|
232 FORMAT. VALIDATE_FUN if a function that returns whether the data
|
|
233 is valid. The keyword may not appear more than once. */
|
398
|
234 #define IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, copy, multi) \
|
0
|
235 do { \
|
|
236 struct ii_keyword_entry entry; \
|
|
237 \
|
|
238 entry.keyword = keyw; \
|
|
239 entry.validate = validate_fun; \
|
398
|
240 entry.multiple_p = multi; \
|
|
241 entry.copy_p = copy; \
|
0
|
242 Dynarr_add (format##_image_instantiator_methods->keywords, \
|
|
243 entry); \
|
|
244 } while (0)
|
|
245
|
398
|
246 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \
|
|
247 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 0)
|
|
248
|
0
|
249 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may
|
|
250 appear multiple times. */
|
398
|
251 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \
|
|
252 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1)
|
|
253
|
|
254 /* Same as IIFORMAT_VALID_KEYWORD execpt that the argument is not
|
|
255 copied by the specifier functions. This is necessary for things
|
|
256 like callbacks etc. */
|
|
257 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \
|
|
258 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0)
|
|
259
|
|
260 /* Declare that image-instantiator format FORMAT is supported on
|
|
261 CONSOLE type. */
|
|
262 #define IIFORMAT_VALID_CONSOLE(console, format) \
|
|
263 do { \
|
|
264 struct console_type_entry entry; \
|
|
265 \
|
|
266 entry.symbol = Q##console; \
|
|
267 entry.meths = console##_console_methods; \
|
|
268 Dynarr_add (format##_image_instantiator_methods->consoles, \
|
|
269 entry); \
|
0
|
270 } while (0)
|
|
271
|
398
|
272 #define DEFINE_DEVICE_IIFORMAT(type, format) \
|
|
273 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format); \
|
384
|
274 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
|
|
275
|
398
|
276 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \
|
|
277 do { \
|
|
278 type##_##format##_image_instantiator_methods = \
|
|
279 xnew_and_zero (struct image_instantiator_methods); \
|
384
|
280 type##_##format##_image_instantiator_methods->symbol = Q##format; \
|
|
281 type##_##format##_image_instantiator_methods->device = Q##type; \
|
|
282 type##_##format##_image_instantiator_methods->keywords = \
|
398
|
283 Dynarr_new (ii_keyword_entry); \
|
|
284 add_entry_to_device_ii_format_list \
|
384
|
285 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \
|
398
|
286 IIFORMAT_VALID_CONSOLE(type,format); \
|
|
287 dumpstruct (&type##_##format##_image_instantiator_methods, \
|
|
288 &iim_description); \
|
384
|
289 } while (0)
|
|
290
|
|
291 /* Declare that image-instantiator format FORMAT has method M; used in
|
|
292 initialization routines */
|
|
293 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \
|
|
294 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m)
|
398
|
295 #define IIFORMAT_HAS_SHARED_DEVMETHOD(type, format, m, fromformat) \
|
|
296 (type##_##format##_image_instantiator_methods->m##_method = type##_##fromformat##_##m)
|
384
|
297
|
|
298 struct image_instantiator_methods *
|
|
299 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
|
|
300 Error_behavior errb);
|
|
301 struct image_instantiator_methods *
|
|
302 decode_image_instantiator_format (Lisp_Object format, Error_behavior errb);
|
|
303
|
0
|
304 void add_entry_to_image_instantiator_format_list (Lisp_Object symbol,
|
|
305 struct image_instantiator_methods *meths);
|
384
|
306 void add_entry_to_device_ii_format_list (Lisp_Object device, Lisp_Object symbol,
|
|
307 struct image_instantiator_methods *meths);
|
0
|
308 Lisp_Object find_keyword_in_vector (Lisp_Object vector,
|
|
309 Lisp_Object keyword);
|
|
310 Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector,
|
|
311 Lisp_Object keyword,
|
173
|
312 Lisp_Object default_);
|
380
|
313 Lisp_Object simple_image_type_normalize (Lisp_Object inst,
|
278
|
314 Lisp_Object console_type,
|
|
315 Lisp_Object image_type_tag);
|
|
316 Lisp_Object potential_pixmap_file_instantiator (Lisp_Object instantiator,
|
|
317 Lisp_Object file_keyword,
|
|
318 Lisp_Object data_keyword,
|
|
319 Lisp_Object console_type);
|
0
|
320 void check_valid_string (Lisp_Object data);
|
|
321 void check_valid_int (Lisp_Object data);
|
384
|
322 void check_valid_face (Lisp_Object data);
|
|
323 void check_valid_vector (Lisp_Object data);
|
398
|
324 void check_valid_item_list_1 (Lisp_Object items);
|
384
|
325
|
398
|
326 void initialize_subwindow_image_instance (Lisp_Image_Instance*);
|
384
|
327 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
328 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
329 int dest_mask, Lisp_Object domain);
|
398
|
330 void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
331 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
332 int dest_mask, Lisp_Object domain);
|
|
333 void image_instance_query_geometry (Lisp_Object image_instance,
|
|
334 unsigned int* width, unsigned int* height,
|
|
335 enum image_instance_geometry disp,
|
|
336 Lisp_Object domain);
|
|
337 void image_instance_layout (Lisp_Object image_instance,
|
|
338 unsigned int width, unsigned int height,
|
|
339 Lisp_Object domain);
|
|
340 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w);
|
384
|
341
|
0
|
342 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
|
|
343 int given_dest_mask,
|
|
344 int desired_dest_mask));
|
398
|
345 DECLARE_DOESNT_RETURN (signal_image_error (const char *, Lisp_Object));
|
|
346 DECLARE_DOESNT_RETURN (signal_image_error_2 (const char *, Lisp_Object, Lisp_Object));
|
0
|
347
|
272
|
348 /************************************************************************/
|
|
349 /* Image Specifier Object */
|
|
350 /************************************************************************/
|
0
|
351
|
|
352 DECLARE_SPECIFIER_TYPE (image);
|
|
353 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image)
|
|
354 #define XSETIMAGE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, image)
|
|
355 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image)
|
|
356 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image)
|
|
357 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image)
|
|
358
|
|
359 void set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph,
|
|
360 Lisp_Object property);
|
|
361
|
|
362 struct image_specifier
|
|
363 {
|
|
364 int allowed;
|
|
365 Lisp_Object attachee; /* face or glyph this is attached to, or nil */
|
|
366 Lisp_Object attachee_property;/* property of that face or glyph */
|
|
367 };
|
|
368
|
|
369 #define IMAGE_SPECIFIER_DATA(g) (SPECIFIER_TYPE_DATA (g, image))
|
|
370 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed)
|
|
371 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee)
|
|
372 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \
|
|
373 (IMAGE_SPECIFIER_DATA (g)->attachee_property)
|
|
374
|
|
375 #define XIMAGE_SPECIFIER_ALLOWED(g) \
|
|
376 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g))
|
|
377
|
272
|
378 /************************************************************************/
|
|
379 /* Image Instance Object */
|
|
380 /************************************************************************/
|
0
|
381
|
398
|
382 DECLARE_LRECORD (image_instance, Lisp_Image_Instance);
|
|
383 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance)
|
0
|
384 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance)
|
|
385 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance)
|
|
386 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance)
|
|
387 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance)
|
|
388
|
|
389 enum image_instance_type
|
|
390 {
|
|
391 IMAGE_UNKNOWN,
|
|
392 IMAGE_NOTHING,
|
|
393 IMAGE_TEXT,
|
|
394 IMAGE_MONO_PIXMAP,
|
|
395 IMAGE_COLOR_PIXMAP,
|
|
396 IMAGE_POINTER,
|
384
|
397 IMAGE_SUBWINDOW,
|
398
|
398 IMAGE_WIDGET,
|
|
399 IMAGE_LAYOUT
|
0
|
400 };
|
|
401
|
|
402 #define IMAGE_NOTHING_MASK (1 << 0)
|
|
403 #define IMAGE_TEXT_MASK (1 << 1)
|
|
404 #define IMAGE_MONO_PIXMAP_MASK (1 << 2)
|
|
405 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3)
|
|
406 #define IMAGE_POINTER_MASK (1 << 4)
|
|
407 #define IMAGE_SUBWINDOW_MASK (1 << 5)
|
384
|
408 #define IMAGE_WIDGET_MASK (1 << 6)
|
398
|
409 #define IMAGE_LAYOUT_MASK (1 << 7)
|
0
|
410
|
|
411 #define IMAGE_INSTANCE_TYPE_P(ii, type) \
|
187
|
412 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type)
|
0
|
413
|
187
|
414 #define NOTHING_IMAGE_INSTANCEP(ii) \
|
|
415 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING)
|
|
416 #define TEXT_IMAGE_INSTANCEP(ii) \
|
|
417 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT)
|
|
418 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \
|
|
419 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP)
|
|
420 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \
|
|
421 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP)
|
|
422 #define POINTER_IMAGE_INSTANCEP(ii) \
|
|
423 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER)
|
|
424 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \
|
|
425 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW)
|
384
|
426 #define WIDGET_IMAGE_INSTANCEP(ii) \
|
|
427 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET)
|
398
|
428 #define LAYOUT_IMAGE_INSTANCEP(ii) \
|
|
429 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_LAYOUT)
|
0
|
430
|
187
|
431 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \
|
|
432 CHECK_IMAGE_INSTANCE (x); \
|
|
433 if (!NOTHING_IMAGE_INSTANCEP (x)) \
|
|
434 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \
|
|
435 } while (0)
|
0
|
436
|
187
|
437 #define CHECK_TEXT_IMAGE_INSTANCE(x) do { \
|
|
438 CHECK_IMAGE_INSTANCE (x); \
|
|
439 if (!TEXT_IMAGE_INSTANCEP (x)) \
|
|
440 x = wrong_type_argument (Qtext_image_instance_p, (x)); \
|
|
441 } while (0)
|
0
|
442
|
187
|
443 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) do { \
|
|
444 CHECK_IMAGE_INSTANCE (x); \
|
|
445 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \
|
|
446 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \
|
|
447 } while (0)
|
0
|
448
|
187
|
449 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) do { \
|
|
450 CHECK_IMAGE_INSTANCE (x); \
|
|
451 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \
|
|
452 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \
|
|
453 } while (0)
|
0
|
454
|
187
|
455 #define CHECK_POINTER_IMAGE_INSTANCE(x) do { \
|
|
456 CHECK_IMAGE_INSTANCE (x); \
|
|
457 if (!POINTER_IMAGE_INSTANCEP (x)) \
|
|
458 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \
|
|
459 } while (0)
|
|
460
|
|
461 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) do { \
|
|
462 CHECK_IMAGE_INSTANCE (x); \
|
384
|
463 if (!SUBWINDOW_IMAGE_INSTANCEP (x) \
|
|
464 && !WIDGET_IMAGE_INSTANCEP (x)) \
|
187
|
465 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \
|
|
466 } while (0)
|
0
|
467
|
384
|
468 #define CHECK_WIDGET_IMAGE_INSTANCE(x) do { \
|
|
469 CHECK_IMAGE_INSTANCE (x); \
|
|
470 if (!WIDGET_IMAGE_INSTANCEP (x)) \
|
|
471 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \
|
|
472 } while (0)
|
|
473
|
398
|
474 #define CHECK_LAYOUT_IMAGE_INSTANCE(x) do { \
|
|
475 CHECK_IMAGE_INSTANCE (x); \
|
|
476 if (!LAYOUT_IMAGE_INSTANCEP (x)) \
|
|
477 x = wrong_type_argument (Qlayout_image_instance_p, (x)); \
|
|
478 } while (0)
|
|
479
|
0
|
480 struct Lisp_Image_Instance
|
|
481 {
|
|
482 struct lcrecord_header header;
|
|
483 Lisp_Object device;
|
|
484 Lisp_Object name;
|
398
|
485 /* The glyph from which we were instantiated. This is a weak
|
|
486 reference. */
|
|
487 Lisp_Object parent;
|
0
|
488 enum image_instance_type type;
|
398
|
489 unsigned int x_offset, y_offset; /* for layout purposes */
|
|
490 unsigned int width, height;
|
|
491 unsigned int dirty : 1;
|
|
492 unsigned int size_changed : 1;
|
|
493 unsigned int text_changed : 1;
|
|
494 unsigned int layout_changed : 1;
|
|
495
|
0
|
496 union
|
187
|
497 {
|
|
498 struct
|
0
|
499 {
|
398
|
500 unsigned int descent;
|
187
|
501 Lisp_Object string;
|
|
502 } text;
|
|
503 struct
|
|
504 {
|
398
|
505 unsigned int depth;
|
|
506 unsigned int slice, maxslice, timeout;
|
187
|
507 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */
|
|
508 Lisp_Object filename; /* string or Qnil */
|
|
509 Lisp_Object mask_filename; /* string or Qnil */
|
|
510 Lisp_Object fg, bg; /* foreground and background colors,
|
|
511 if this is a colorized mono-pixmap
|
|
512 or a pointer */
|
265
|
513 Lisp_Object auxdata; /* list or Qnil: any additional data
|
|
514 to be seen from lisp */
|
398
|
515 void* mask; /* mask that can be seen from all windowing systems */
|
187
|
516 } pixmap; /* used for pointers as well */
|
|
517 struct
|
|
518 {
|
384
|
519 Lisp_Object frame;
|
|
520 void* subwindow; /* specific devices can use this as necessary */
|
398
|
521 unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */
|
|
522 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */
|
|
523 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */
|
|
524 unsigned int orientation : 1; /* Vertical or horizontal. */
|
|
525 unsigned int justification : 2; /* Left, right or center. */
|
|
526 /* Face for colors and font. We specify this here becuase we
|
|
527 want people to be able to put :face in the instantiator
|
|
528 spec. Using gyph-face is more inconvenient, although more
|
|
529 general. */
|
|
530 Lisp_Object face;
|
|
531 Lisp_Object type;
|
|
532 Lisp_Object props; /* properties or border*/
|
|
533 Lisp_Object items; /* a list of gui_items or children */
|
|
534 /* Change flags to augment dirty. */
|
|
535 unsigned int face_changed : 1;
|
|
536 unsigned int items_changed : 1;
|
|
537 unsigned int percent_changed : 1;
|
187
|
538 } subwindow;
|
|
539 } u;
|
0
|
540
|
|
541 /* console-type- and image-type-specific data */
|
|
542 void *data;
|
|
543 };
|
|
544
|
398
|
545 /* Layout bit-fields. */
|
|
546 #define LAYOUT_HORIZONTAL 0
|
|
547 #define LAYOUT_VERTICAL 1
|
|
548
|
|
549 #define LAYOUT_JUSTIFY_LEFT 0
|
|
550 #define LAYOUT_JUSTIFY_RIGHT 1
|
|
551 #define LAYOUT_JUSTIFY_CENTER 2
|
|
552
|
|
553 /* Accessor macros. */
|
0
|
554 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device)
|
|
555 #define IMAGE_INSTANCE_NAME(i) ((i)->name)
|
398
|
556 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent)
|
|
557 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i))
|
0
|
558 #define IMAGE_INSTANCE_TYPE(i) ((i)->type)
|
398
|
559 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset)
|
|
560 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset)
|
|
561 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width)
|
|
562 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height)
|
|
563 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \
|
|
564 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \
|
0
|
565 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP))
|
398
|
566 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty)
|
|
567 #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \
|
|
568 (IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i))
|
|
569 #define IMAGE_INSTANCE_FACE(i) \
|
|
570 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i))
|
0
|
571
|
398
|
572 /* Changed flags */
|
|
573 #define IMAGE_INSTANCE_TEXT_CHANGED(i) ((i)->text_changed)
|
|
574 #define IMAGE_INSTANCE_SIZE_CHANGED(i) ((i)->size_changed)
|
|
575 #define IMAGE_INSTANCE_WIDGET_FACE_CHANGED(i) \
|
|
576 ((i)->u.subwindow.face_changed)
|
|
577 #define IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED(i) \
|
|
578 ((i)->u.subwindow.items_changed)
|
|
579 #define IMAGE_INSTANCE_WIDGET_PERCENT_CHANGED(i) \
|
|
580 ((i)->u.subwindow.percent_changed)
|
|
581 #define IMAGE_INSTANCE_LAYOUT_CHANGED(i) \
|
|
582 ((i)->layout_changed)
|
0
|
583
|
398
|
584 /* Text properties */
|
|
585 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string)
|
|
586 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \
|
|
587 IMAGE_INSTANCE_WIDTH(i)
|
|
588 #define IMAGE_INSTANCE_TEXT_HEIGHT(i) \
|
|
589 IMAGE_INSTANCE_HEIGHT(i)
|
|
590 #define IMAGE_INSTANCE_TEXT_DESCENT(i) ((i)->u.text.descent)
|
|
591 #define IMAGE_INSTANCE_TEXT_ASCENT(i) \
|
|
592 (IMAGE_INSTANCE_TEXT_HEIGHT(i) - IMAGE_INSTANCE_TEXT_DESCENT(i))
|
|
593
|
|
594 /* Pixmap properties */
|
|
595 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) \
|
|
596 IMAGE_INSTANCE_WIDTH(i)
|
|
597 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
|
|
598 IMAGE_INSTANCE_HEIGHT(i)
|
0
|
599 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth)
|
|
600 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename)
|
|
601 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename)
|
|
602 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x)
|
|
603 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y)
|
|
604 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg)
|
|
605 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg)
|
265
|
606 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata)
|
398
|
607 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask)
|
|
608 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice)
|
|
609 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice)
|
|
610 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout)
|
0
|
611
|
398
|
612 /* Subwindow properties */
|
|
613 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \
|
|
614 IMAGE_INSTANCE_WIDTH(i)
|
|
615 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \
|
|
616 IMAGE_INSTANCE_HEIGHT(i)
|
384
|
617 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow)
|
|
618 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame)
|
|
619 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
|
|
620 ((i)->u.subwindow.being_displayed)
|
398
|
621 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \
|
|
622 ((i)->u.subwindow.v_resize)
|
|
623 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \
|
|
624 ((i)->u.subwindow.h_resize)
|
|
625 #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \
|
|
626 ((i)->u.subwindow.orientation)
|
|
627 #define IMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \
|
|
628 ((i)->u.subwindow.justification)
|
384
|
629
|
398
|
630 /* Widget properties */
|
384
|
631 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \
|
398
|
632 IMAGE_INSTANCE_WIDTH(i)
|
384
|
633 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \
|
398
|
634 IMAGE_INSTANCE_HEIGHT(i)
|
|
635 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.type)
|
|
636 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.props)
|
|
637 #define SET_IMAGE_INSTANCE_WIDGET_FACE(i,f) \
|
|
638 ((i)->u.subwindow.face = f)
|
|
639 #define IMAGE_INSTANCE_WIDGET_FACE(i) \
|
|
640 (!NILP ((i)->u.subwindow.face) ? (i)->u.subwindow.face : \
|
|
641 !NILP (IMAGE_INSTANCE_FACE (i)) ? IMAGE_INSTANCE_FACE (i) : \
|
|
642 Vwidget_face)
|
|
643 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.items)
|
|
644 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \
|
|
645 (CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ? \
|
|
646 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \
|
|
647 IMAGE_INSTANCE_WIDGET_ITEMS (i))
|
|
648 #define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name
|
|
649
|
|
650 /* Layout properties */
|
|
651 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.items)
|
|
652 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props)
|
384
|
653
|
0
|
654 #define XIMAGE_INSTANCE_DEVICE(i) \
|
|
655 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i))
|
|
656 #define XIMAGE_INSTANCE_NAME(i) \
|
|
657 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i))
|
398
|
658 #define XIMAGE_INSTANCE_GLYPH(i) \
|
|
659 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i))
|
|
660 #define XIMAGE_INSTANCE_PARENT(i) \
|
|
661 IMAGE_INSTANCE_PARENT (XIMAGE_INSTANCE (i))
|
0
|
662 #define XIMAGE_INSTANCE_TYPE(i) \
|
|
663 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i))
|
398
|
664 #define XIMAGE_INSTANCE_XOFFSET(i) \
|
|
665 IMAGE_INSTANCE_XOFFSET (XIMAGE_INSTANCE (i))
|
|
666 #define XIMAGE_INSTANCE_YOFFSET(i) \
|
|
667 IMAGE_INSTANCE_YOFFSET (XIMAGE_INSTANCE (i))
|
|
668 #define XIMAGE_INSTANCE_DIRTYP(i) \
|
|
669 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i))
|
|
670 #define XIMAGE_INSTANCE_NEEDS_LAYOUT(i) \
|
|
671 IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i))
|
|
672 #define XIMAGE_INSTANCE_WIDTH(i) \
|
|
673 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i))
|
|
674 #define XIMAGE_INSTANCE_HEIGHT(i) \
|
|
675 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i))
|
|
676 #define XIMAGE_INSTANCE_FACE(i) \
|
|
677 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i))
|
0
|
678
|
|
679 #define XIMAGE_INSTANCE_TEXT_STRING(i) \
|
|
680 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i))
|
398
|
681 #define XIMAGE_INSTANCE_TEXT_WIDTH(i) \
|
|
682 IMAGE_INSTANCE_TEXT_WIDTH (XIMAGE_INSTANCE (i))
|
|
683 #define XIMAGE_INSTANCE_TEXT_HEIGHT(i) \
|
|
684 IMAGE_INSTANCE_TEXT_HEIGHT (XIMAGE_INSTANCE (i))
|
|
685 #define XIMAGE_INSTANCE_TEXT_ASCENT(i) \
|
|
686 IMAGE_INSTANCE_TEXT_ASCENT (XIMAGE_INSTANCE (i))
|
|
687 #define XIMAGE_INSTANCE_TEXT_DESCENT(i) \
|
|
688 IMAGE_INSTANCE_TEXT_DESCENT (XIMAGE_INSTANCE (i))
|
0
|
689
|
|
690 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \
|
|
691 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i))
|
|
692 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
|
|
693 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i))
|
|
694 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \
|
|
695 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i))
|
|
696 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \
|
|
697 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i))
|
|
698 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \
|
|
699 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i))
|
|
700 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \
|
|
701 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i))
|
|
702 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \
|
|
703 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i))
|
|
704 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \
|
|
705 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i))
|
|
706 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \
|
|
707 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i))
|
398
|
708 #define XIMAGE_INSTANCE_PIXMAP_MASK(i) \
|
|
709 IMAGE_INSTANCE_PIXMAP_MASK (XIMAGE_INSTANCE (i))
|
|
710 #define XIMAGE_INSTANCE_PIXMAP_SLICE(i) \
|
|
711 IMAGE_INSTANCE_PIXMAP_SLICE (XIMAGE_INSTANCE (i))
|
|
712 #define XIMAGE_INSTANCE_PIXMAP_MAXSLICE(i) \
|
|
713 IMAGE_INSTANCE_PIXMAP_MAXSLICE (XIMAGE_INSTANCE (i))
|
|
714 #define XIMAGE_INSTANCE_PIXMAP_TIMEOUT(i) \
|
|
715 IMAGE_INSTANCE_PIXMAP_TIMEOUT (XIMAGE_INSTANCE (i))
|
0
|
716
|
384
|
717 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \
|
|
718 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i))
|
|
719 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \
|
|
720 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i))
|
|
721 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \
|
|
722 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i))
|
|
723 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \
|
|
724 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i))
|
|
725 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \
|
|
726 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
|
398
|
727 #define XSET_IMAGE_INSTANCE_WIDGET_FACE(i) \
|
|
728 SET_IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
|
|
729 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \
|
|
730 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i))
|
|
731 #define XIMAGE_INSTANCE_WIDGET_ITEMS(i) \
|
|
732 IMAGE_INSTANCE_WIDGET_ITEMS (XIMAGE_INSTANCE (i))
|
384
|
733 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \
|
|
734 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i))
|
398
|
735
|
|
736 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \
|
|
737 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i))
|
|
738 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \
|
|
739 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i))
|
384
|
740
|
|
741 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \
|
|
742 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i))
|
|
743 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \
|
|
744 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i))
|
|
745 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \
|
|
746 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i))
|
|
747 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \
|
|
748 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i))
|
|
749 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
|
|
750 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i))
|
398
|
751 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \
|
|
752 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i))
|
|
753 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \
|
|
754 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i))
|
|
755
|
|
756 #define MARK_IMAGE_INSTANCE_CHANGED(i) \
|
|
757 (IMAGE_INSTANCE_DIRTYP (i) = 1);
|
384
|
758
|
288
|
759 #ifdef HAVE_XPM
|
|
760 Lisp_Object evaluate_xpm_color_symbols (void);
|
|
761 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid);
|
|
762 #endif /* HAVE_XPM */
|
|
763 #ifdef HAVE_WINDOW_SYSTEM
|
|
764 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
|
|
765 int ok_if_data_invalid);
|
398
|
766 int read_bitmap_data_from_file (const char *filename, unsigned int *width,
|
288
|
767 unsigned int *height, unsigned char **datap,
|
|
768 int *x_hot, int *y_hot);
|
|
769 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
|
380
|
770 Lisp_Object mask_file,
|
288
|
771 Lisp_Object console_type);
|
|
772 #endif
|
|
773
|
272
|
774 /************************************************************************/
|
|
775 /* Glyph Object */
|
|
776 /************************************************************************/
|
0
|
777
|
|
778 enum glyph_type
|
|
779 {
|
|
780 GLYPH_UNKNOWN,
|
|
781 GLYPH_BUFFER,
|
|
782 GLYPH_POINTER,
|
|
783 GLYPH_ICON
|
|
784 };
|
|
785
|
|
786 struct Lisp_Glyph
|
|
787 {
|
|
788 struct lcrecord_header header;
|
|
789
|
|
790 enum glyph_type type;
|
|
791
|
|
792 /* specifiers: */
|
|
793 Lisp_Object image; /* the actual image */
|
|
794 Lisp_Object contrib_p; /* whether to figure into line height */
|
|
795 Lisp_Object baseline; /* percent above baseline */
|
|
796
|
|
797 Lisp_Object face; /* if non-nil, face to use when displaying */
|
|
798
|
|
799 Lisp_Object plist;
|
|
800 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
|
|
801 Lisp_Object locale);
|
|
802
|
398
|
803 unsigned int dirty : 1; /* So that we can selectively
|
|
804 redisplay changed glyphs. */
|
|
805 };
|
|
806 typedef struct Lisp_Glyph Lisp_Glyph;
|
|
807
|
|
808 DECLARE_LRECORD (glyph, Lisp_Glyph);
|
|
809 #define XGLYPH(x) XRECORD (x, glyph, Lisp_Glyph)
|
0
|
810 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph)
|
|
811 #define GLYPHP(x) RECORDP (x, glyph)
|
|
812 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph)
|
|
813 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph)
|
|
814
|
187
|
815 #define CHECK_BUFFER_GLYPH(x) do { \
|
|
816 CHECK_GLYPH (x); \
|
|
817 if (XGLYPH (x)->type != GLYPH_BUFFER) \
|
|
818 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \
|
|
819 } while (0)
|
0
|
820
|
187
|
821 #define CHECK_POINTER_GLYPH(x) do { \
|
|
822 CHECK_GLYPH (x); \
|
|
823 if (XGLYPH (x)->type != GLYPH_POINTER) \
|
|
824 x = wrong_type_argument (Qpointer_glyph_p, (x)); \
|
|
825 } while (0)
|
0
|
826
|
187
|
827 #define CHECK_ICON_GLYPH(x) do { \
|
|
828 CHECK_GLYPH (x); \
|
|
829 if (XGLYPH (x)->type != GLYPH_ICON) \
|
|
830 x = wrong_type_argument (Qicon_glyph_p, (x)); \
|
|
831 } while (0)
|
0
|
832
|
|
833 #define GLYPH_TYPE(g) ((g)->type)
|
|
834 #define GLYPH_IMAGE(g) ((g)->image)
|
|
835 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p)
|
|
836 #define GLYPH_BASELINE(g) ((g)->baseline)
|
|
837 #define GLYPH_FACE(g) ((g)->face)
|
398
|
838 #define GLYPH_DIRTYP(g) ((g)->dirty)
|
0
|
839
|
|
840 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g))
|
|
841 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g))
|
|
842 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g))
|
|
843 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g))
|
|
844 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g))
|
398
|
845 #define XGLYPH_DIRTYP(g) GLYPH_DIRTYP (XGLYPH (g))
|
0
|
846
|
398
|
847 #define MARK_GLYPH_CHANGED(g) (GLYPH_DIRTYP (g) = 1);
|
|
848
|
|
849 extern Lisp_Object Qxpm, Qxface, Qetched_in, Qetched_out, Qbevel_in, Qbevel_out;
|
288
|
850 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
|
398
|
851 extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar;
|
|
852 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border;
|
288
|
853 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
|
384
|
854 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
|
388
|
855 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
|
|
856 extern Lisp_Object Q_items, Q_properties, Q_image, Q_percent, Qimage_conversion_error;
|
398
|
857 extern Lisp_Object Q_orientation;
|
272
|
858 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph;
|
|
859 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph;
|
0
|
860 extern Lisp_Object Vxemacs_logo;
|
|
861
|
398
|
862 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object domain);
|
|
863 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object domain);
|
|
864 unsigned short glyph_descent (Lisp_Object glyph, Lisp_Object domain);
|
|
865 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object domain);
|
0
|
866 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain);
|
|
867 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain);
|
|
868 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain);
|
|
869 Lisp_Object glyph_image_instance (Lisp_Object glyph,
|
|
870 Lisp_Object domain,
|
|
871 Error_behavior errb, int no_quit);
|
|
872 void file_or_data_must_be_present (Lisp_Object instantiator);
|
|
873 void data_must_be_present (Lisp_Object instantiator);
|
|
874 Lisp_Object make_string_from_file (Lisp_Object file);
|
|
875 Lisp_Object tagged_vector_to_alist (Lisp_Object vector);
|
|
876 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist);
|
|
877 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
878 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
879 int dest_mask, Lisp_Object domain);
|
0
|
880 Lisp_Object allocate_glyph (enum glyph_type type,
|
|
881 void (*after_change) (Lisp_Object glyph,
|
|
882 Lisp_Object property,
|
|
883 Lisp_Object locale));
|
398
|
884 void query_string_geometry ( Lisp_Object string, Lisp_Object face,
|
|
885 unsigned int* width, unsigned int* height,
|
|
886 unsigned int* descent, Lisp_Object domain);
|
|
887 Lisp_Object query_string_font (Lisp_Object string,
|
|
888 Lisp_Object face, Lisp_Object domain);
|
|
889 Lisp_Object add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object device);
|
|
890 void disable_glyph_animated_timeout (int i);
|
0
|
891
|
272
|
892 /************************************************************************/
|
|
893 /* Glyph Cachels */
|
|
894 /************************************************************************/
|
0
|
895
|
185
|
896 typedef struct glyph_cachel glyph_cachel;
|
0
|
897 struct glyph_cachel
|
|
898 {
|
|
899 Lisp_Object glyph;
|
|
900
|
398
|
901 unsigned int dirty :1; /* I'm copying faces here. I'm not
|
|
902 sure why we need two dirty
|
|
903 flags. Maybe because an image
|
|
904 instance can be dirty and so we
|
|
905 need to frob this in the same way
|
|
906 as other image instance properties. */
|
0
|
907 unsigned int updated :1;
|
398
|
908
|
0
|
909 unsigned short width;
|
|
910 unsigned short ascent;
|
|
911 unsigned short descent;
|
|
912 };
|
|
913
|
|
914 #define CONT_GLYPH_INDEX (glyph_index) 0
|
|
915 #define TRUN_GLYPH_INDEX (glyph_index) 1
|
|
916 #define HSCROLL_GLYPH_INDEX (glyph_index) 2
|
|
917 #define CONTROL_GLYPH_INDEX (glyph_index) 3
|
|
918 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4
|
|
919 #define INVIS_GLYPH_INDEX (glyph_index) 5
|
|
920
|
272
|
921 #define GLYPH_CACHEL(window, index) \
|
0
|
922 Dynarr_atp (window->glyph_cachels, index)
|
272
|
923 #define GLYPH_CACHEL_GLYPH(window, index) \
|
0
|
924 Dynarr_atp (window->glyph_cachels, index)->glyph
|
272
|
925 #define GLYPH_CACHEL_WIDTH(window, index) \
|
0
|
926 Dynarr_atp (window->glyph_cachels, index)->width
|
272
|
927 #define GLYPH_CACHEL_ASCENT(window, index) \
|
0
|
928 Dynarr_atp (window->glyph_cachels, index)->ascent
|
272
|
929 #define GLYPH_CACHEL_DESCENT(window, index) \
|
0
|
930 Dynarr_atp (window->glyph_cachels, index)->descent
|
398
|
931 #define GLYPH_CACHEL_DIRTYP(window, index) \
|
|
932 Dynarr_atp (window->glyph_cachels, index)->dirty
|
0
|
933
|
398
|
934 void mark_glyph_cachels (glyph_cachel_dynarr *elements);
|
0
|
935 void mark_glyph_cachels_as_not_updated (struct window *w);
|
398
|
936 void mark_glyph_cachels_as_clean (struct window *w);
|
0
|
937 void reset_glyph_cachels (struct window *w);
|
398
|
938 glyph_index get_glyph_cachel_index (struct window *w, Lisp_Object glyph);
|
384
|
939
|
0
|
940 #ifdef MEMORY_USAGE_STATS
|
|
941 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
|
|
942 struct overhead_stats *ovstats);
|
|
943 #endif /* MEMORY_USAGE_STATS */
|
|
944
|
272
|
945 /************************************************************************/
|
|
946 /* Display Tables */
|
|
947 /************************************************************************/
|
0
|
948
|
384
|
949 Lisp_Object display_table_entry (Emchar, Lisp_Object, Lisp_Object);
|
|
950 void get_display_tables (struct window *, face_index,
|
|
951 Lisp_Object *, Lisp_Object *);
|
|
952
|
|
953 /****************************************************************************
|
|
954 * Subwindow Object *
|
|
955 ****************************************************************************/
|
0
|
956
|
384
|
957 /* redisplay needs a per-frame cache of subwindows being displayed so
|
|
958 * that we known when to unmap them */
|
|
959 typedef struct subwindow_cachel subwindow_cachel;
|
|
960 struct subwindow_cachel
|
|
961 {
|
|
962 Lisp_Object subwindow;
|
398
|
963 unsigned int x, y;
|
|
964 unsigned int width, height;
|
|
965 unsigned int being_displayed : 1;
|
|
966 unsigned int updated : 1;
|
384
|
967 };
|
|
968
|
|
969 typedef struct
|
|
970 {
|
|
971 Dynarr_declare (subwindow_cachel);
|
|
972 } subwindow_cachel_dynarr;
|
|
973
|
398
|
974 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements);
|
384
|
975 void mark_subwindow_cachels_as_not_updated (struct frame *f);
|
|
976 void reset_subwindow_cachels (struct frame *f);
|
|
977 void unmap_subwindow (Lisp_Object subwindow);
|
398
|
978 void map_subwindow (Lisp_Object subwindow, int x, int y,
|
|
979 struct display_glyph_area *dga);
|
384
|
980 void update_frame_subwindows (struct frame *f);
|
398
|
981 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height);
|
|
982 void update_widget (Lisp_Object widget);
|
|
983 void update_subwindow (Lisp_Object subwindow);
|
|
984 Lisp_Object image_instance_parent_glyph (struct Lisp_Image_Instance*);
|
0
|
985
|
398
|
986 struct expose_ignore
|
|
987 {
|
|
988 unsigned int x, y;
|
|
989 unsigned int width, height;
|
|
990 struct expose_ignore *next;
|
|
991 };
|
|
992
|
|
993 int check_for_ignored_expose (struct frame* f, int x, int y, int width, int height);
|
|
994 extern int hold_ignored_expose_registration;
|
|
995
|
|
996 #endif /* INCLUDED_glyphs_h_ */
|