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
|
412
|
24 #ifndef _XEMACS_GLYPHS_H_
|
|
25 #define _XEMACS_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
|
412
|
53 mswindows-resource pointer
|
272
|
54 font pointer
|
|
55 subwindow subwindow
|
|
56 inherit mono-pixmap
|
|
57 autodetect mono-pixmap, color-pixmap, pointer, text
|
412
|
58 button widget
|
|
59 edit widget
|
|
60 combo widget
|
384
|
61 scrollbar widget
|
412
|
62 static widget
|
0
|
63 */
|
|
64
|
|
65 /* These are methods specific to a particular format of image instantiator
|
|
66 (e.g. xpm, string, etc.). */
|
|
67
|
185
|
68 typedef struct ii_keyword_entry ii_keyword_entry;
|
|
69 struct ii_keyword_entry
|
|
70 {
|
|
71 Lisp_Object keyword;
|
|
72 void (*validate) (Lisp_Object data);
|
|
73 int multiple_p;
|
|
74 };
|
|
75
|
|
76 typedef struct
|
|
77 {
|
|
78 Dynarr_declare (ii_keyword_entry);
|
|
79 } ii_keyword_entry_dynarr;
|
|
80
|
0
|
81 struct image_instantiator_methods
|
|
82 {
|
|
83 Lisp_Object symbol;
|
|
84
|
384
|
85 Lisp_Object device; /* sometimes used */
|
|
86
|
185
|
87 ii_keyword_entry_dynarr *keywords;
|
0
|
88 /* Implementation specific methods: */
|
|
89
|
|
90 /* Validate method: Given an instantiator vector, signal an error if
|
|
91 it's invalid for this image-instantiator format. Note that this
|
|
92 validation only occurs after all the keyword-specific validation
|
|
93 has already been performed. This is chiefly useful for making
|
|
94 sure that certain required keywords are present. */
|
|
95 void (*validate_method) (Lisp_Object instantiator);
|
|
96
|
|
97 /* Normalize method: Given an instantiator, convert it to the form
|
|
98 that should be used in a glyph, for devices of type CONSOLE_TYPE.
|
|
99 Signal an error if conversion fails. */
|
|
100 Lisp_Object (*normalize_method) (Lisp_Object instantiator,
|
|
101 Lisp_Object console_type);
|
|
102
|
|
103 /* Possible-dest-types method: Return a mask indicating what dest types
|
|
104 are compatible with this format. */
|
|
105 int (*possible_dest_types_method) (void);
|
|
106
|
|
107 /* Instantiate method: Given an instantiator and a partially
|
|
108 filled-in image instance, complete the filling-in. Return
|
|
109 non-zero if the instantiation succeeds, 0 if it fails.
|
|
110 This must be present. */
|
|
111 void (*instantiate_method) (Lisp_Object image_instance,
|
|
112 Lisp_Object instantiator,
|
|
113 Lisp_Object pointer_fg,
|
|
114 Lisp_Object pointer_bg,
|
124
|
115 int dest_mask,
|
|
116 Lisp_Object domain);
|
384
|
117 /* Property method: Given an image instance, return device specific
|
|
118 properties. */
|
|
119 Lisp_Object (*property_method) (Lisp_Object image_instance,
|
|
120 Lisp_Object property);
|
|
121 /* Set-property method: Given an image instance, set device specific
|
|
122 properties. */
|
|
123 Lisp_Object (*set_property_method) (Lisp_Object image_instance,
|
|
124 Lisp_Object property,
|
|
125 Lisp_Object val);
|
0
|
126 };
|
|
127
|
|
128 /***** Calling an image-instantiator method *****/
|
|
129
|
396
|
130 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0)
|
0
|
131 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args)
|
|
132
|
|
133 /* Call a void-returning specifier method, if it exists */
|
396
|
134 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \
|
|
135 do { \
|
|
136 struct image_instantiator_methods *MIM_mstruc = (mstruc); \
|
|
137 if (MIM_mstruc && HAS_IIFORMAT_METH_P (MIM_mstruc, m)) \
|
|
138 IIFORMAT_METH (MIM_mstruc, m, args); \
|
0
|
139 } while (0)
|
|
140
|
396
|
141 #define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \
|
|
142 do { \
|
|
143 struct image_instantiator_methods *MID_mstruc = \
|
|
144 decode_ii_device (device, mstruc); \
|
|
145 if (MID_mstruc) \
|
|
146 MAYBE_IIFORMAT_METH(MID_mstruc, m, args); \
|
384
|
147 } while (0)
|
|
148
|
|
149
|
0
|
150 /* Call a specifier method, if it exists; otherwise return
|
|
151 the specified value */
|
|
152
|
272
|
153 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \
|
412
|
154 (HAS_IIFORMAT_METH_P (mstruc, m) ? \
|
272
|
155 IIFORMAT_METH (mstruc, m, args) : (given))
|
0
|
156
|
|
157 /***** Defining new image-instantiator types *****/
|
|
158
|
185
|
159 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \
|
0
|
160 extern struct image_instantiator_methods *format##_image_instantiator_methods
|
|
161
|
185
|
162 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \
|
0
|
163 struct image_instantiator_methods *format##_image_instantiator_methods
|
|
164
|
384
|
165 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name) \
|
185
|
166 do { \
|
|
167 format##_image_instantiator_methods = \
|
272
|
168 xnew_and_zero (struct image_instantiator_methods); \
|
185
|
169 format##_image_instantiator_methods->symbol = Q##format; \
|
384
|
170 format##_image_instantiator_methods->device = Qnil; \
|
185
|
171 format##_image_instantiator_methods->keywords = \
|
|
172 Dynarr_new (ii_keyword_entry); \
|
|
173 add_entry_to_image_instantiator_format_list \
|
|
174 (Q##format, format##_image_instantiator_methods); \
|
|
175 } while (0)
|
0
|
176
|
384
|
177 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
|
|
178 do { \
|
|
179 defsymbol (&Q##format, obj_name); \
|
412
|
180 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name); \
|
384
|
181 } while (0)
|
|
182
|
0
|
183 /* Declare that image-instantiator format FORMAT has method M; used in
|
|
184 initialization routines */
|
|
185 #define IIFORMAT_HAS_METHOD(format, m) \
|
|
186 (format##_image_instantiator_methods->m##_method = format##_##m)
|
|
187
|
384
|
188 #define IIFORMAT_HAS_SHARED_METHOD(format, m, type) \
|
|
189 (format##_image_instantiator_methods->m##_method = type##_##m)
|
|
190
|
0
|
191 /* Declare that KEYW is a valid keyword for image-instantiator format
|
|
192 FORMAT. VALIDATE_FUN if a function that returns whether the data
|
|
193 is valid. The keyword may not appear more than once. */
|
412
|
194 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \
|
0
|
195 do { \
|
|
196 struct ii_keyword_entry entry; \
|
|
197 \
|
|
198 entry.keyword = keyw; \
|
|
199 entry.validate = validate_fun; \
|
412
|
200 entry.multiple_p = 0; \
|
0
|
201 Dynarr_add (format##_image_instantiator_methods->keywords, \
|
|
202 entry); \
|
|
203 } while (0)
|
|
204
|
|
205 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may
|
|
206 appear multiple times. */
|
412
|
207 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyword, validate_fun) \
|
|
208 do { \
|
|
209 struct ii_keyword_entry entry; \
|
|
210 \
|
|
211 entry.keyword = keyword; \
|
|
212 entry.validate = validate_fun; \
|
|
213 entry.multiple_p = 1; \
|
|
214 Dynarr_add (format##_image_instantiator_methods->keywords, \
|
|
215 entry); \
|
0
|
216 } while (0)
|
|
217
|
412
|
218 #define DEFINE_DEVICE_IIFORMAT(type, format)\
|
384
|
219 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
|
|
220
|
412
|
221 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \
|
|
222 do { \
|
|
223 type##_##format##_image_instantiator_methods = \
|
|
224 xnew_and_zero (struct image_instantiator_methods); \
|
384
|
225 type##_##format##_image_instantiator_methods->symbol = Q##format; \
|
|
226 type##_##format##_image_instantiator_methods->device = Q##type; \
|
|
227 type##_##format##_image_instantiator_methods->keywords = \
|
412
|
228 Dynarr_new (ii_keyword_entry); \
|
|
229 add_entry_to_device_ii_format_list \
|
384
|
230 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \
|
|
231 } while (0)
|
|
232
|
|
233 /* Declare that image-instantiator format FORMAT has method M; used in
|
|
234 initialization routines */
|
|
235 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \
|
|
236 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m)
|
404
|
237
|
384
|
238 struct image_instantiator_methods *
|
|
239 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
|
|
240 Error_behavior errb);
|
|
241 struct image_instantiator_methods *
|
|
242 decode_image_instantiator_format (Lisp_Object format, Error_behavior errb);
|
|
243
|
0
|
244 void add_entry_to_image_instantiator_format_list (Lisp_Object symbol,
|
|
245 struct image_instantiator_methods *meths);
|
384
|
246 void add_entry_to_device_ii_format_list (Lisp_Object device, Lisp_Object symbol,
|
|
247 struct image_instantiator_methods *meths);
|
0
|
248 Lisp_Object find_keyword_in_vector (Lisp_Object vector,
|
|
249 Lisp_Object keyword);
|
|
250 Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector,
|
|
251 Lisp_Object keyword,
|
173
|
252 Lisp_Object default_);
|
380
|
253 Lisp_Object simple_image_type_normalize (Lisp_Object inst,
|
278
|
254 Lisp_Object console_type,
|
|
255 Lisp_Object image_type_tag);
|
|
256 Lisp_Object potential_pixmap_file_instantiator (Lisp_Object instantiator,
|
|
257 Lisp_Object file_keyword,
|
|
258 Lisp_Object data_keyword,
|
|
259 Lisp_Object console_type);
|
0
|
260 void check_valid_string (Lisp_Object data);
|
|
261 void check_valid_int (Lisp_Object data);
|
384
|
262 void check_valid_face (Lisp_Object data);
|
|
263 void check_valid_vector (Lisp_Object data);
|
|
264
|
412
|
265 void initialize_subwindow_image_instance (struct Lisp_Image_Instance*);
|
384
|
266 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
267 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
|
268 int dest_mask, Lisp_Object domain);
|
|
269
|
0
|
270 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
|
|
271 int given_dest_mask,
|
|
272 int desired_dest_mask));
|
412
|
273 DECLARE_DOESNT_RETURN (signal_image_error (CONST char *, Lisp_Object));
|
|
274 DECLARE_DOESNT_RETURN (signal_image_error_2 (CONST char *, Lisp_Object, Lisp_Object));
|
0
|
275
|
272
|
276 /************************************************************************/
|
|
277 /* Image Specifier Object */
|
|
278 /************************************************************************/
|
0
|
279
|
|
280 DECLARE_SPECIFIER_TYPE (image);
|
|
281 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image)
|
|
282 #define XSETIMAGE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, image)
|
|
283 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image)
|
|
284 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image)
|
|
285 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image)
|
|
286
|
|
287 void set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph,
|
|
288 Lisp_Object property);
|
|
289
|
|
290 struct image_specifier
|
|
291 {
|
|
292 int allowed;
|
|
293 Lisp_Object attachee; /* face or glyph this is attached to, or nil */
|
|
294 Lisp_Object attachee_property;/* property of that face or glyph */
|
|
295 };
|
|
296
|
|
297 #define IMAGE_SPECIFIER_DATA(g) (SPECIFIER_TYPE_DATA (g, image))
|
|
298 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed)
|
|
299 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee)
|
|
300 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \
|
|
301 (IMAGE_SPECIFIER_DATA (g)->attachee_property)
|
|
302
|
|
303 #define XIMAGE_SPECIFIER_ALLOWED(g) \
|
|
304 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g))
|
|
305
|
272
|
306 /************************************************************************/
|
|
307 /* Image Instance Object */
|
|
308 /************************************************************************/
|
0
|
309
|
412
|
310 DECLARE_LRECORD (image_instance, struct Lisp_Image_Instance);
|
|
311 #define XIMAGE_INSTANCE(x) \
|
|
312 XRECORD (x, image_instance, struct Lisp_Image_Instance)
|
0
|
313 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance)
|
|
314 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance)
|
412
|
315 #define GC_IMAGE_INSTANCEP(x) GC_RECORDP (x, image_instance)
|
0
|
316 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance)
|
|
317 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance)
|
|
318
|
|
319 enum image_instance_type
|
|
320 {
|
|
321 IMAGE_UNKNOWN,
|
|
322 IMAGE_NOTHING,
|
|
323 IMAGE_TEXT,
|
|
324 IMAGE_MONO_PIXMAP,
|
|
325 IMAGE_COLOR_PIXMAP,
|
|
326 IMAGE_POINTER,
|
384
|
327 IMAGE_SUBWINDOW,
|
408
|
328 IMAGE_WIDGET
|
0
|
329 };
|
|
330
|
|
331 #define IMAGE_NOTHING_MASK (1 << 0)
|
|
332 #define IMAGE_TEXT_MASK (1 << 1)
|
|
333 #define IMAGE_MONO_PIXMAP_MASK (1 << 2)
|
|
334 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3)
|
|
335 #define IMAGE_POINTER_MASK (1 << 4)
|
|
336 #define IMAGE_SUBWINDOW_MASK (1 << 5)
|
384
|
337 #define IMAGE_WIDGET_MASK (1 << 6)
|
408
|
338
|
0
|
339 #define IMAGE_INSTANCE_TYPE_P(ii, type) \
|
187
|
340 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type)
|
0
|
341
|
187
|
342 #define NOTHING_IMAGE_INSTANCEP(ii) \
|
|
343 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING)
|
|
344 #define TEXT_IMAGE_INSTANCEP(ii) \
|
|
345 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT)
|
|
346 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \
|
|
347 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP)
|
|
348 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \
|
|
349 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP)
|
|
350 #define POINTER_IMAGE_INSTANCEP(ii) \
|
|
351 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER)
|
|
352 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \
|
|
353 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW)
|
384
|
354 #define WIDGET_IMAGE_INSTANCEP(ii) \
|
|
355 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET)
|
0
|
356
|
187
|
357 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \
|
|
358 CHECK_IMAGE_INSTANCE (x); \
|
|
359 if (!NOTHING_IMAGE_INSTANCEP (x)) \
|
|
360 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \
|
|
361 } while (0)
|
0
|
362
|
187
|
363 #define CHECK_TEXT_IMAGE_INSTANCE(x) do { \
|
|
364 CHECK_IMAGE_INSTANCE (x); \
|
|
365 if (!TEXT_IMAGE_INSTANCEP (x)) \
|
|
366 x = wrong_type_argument (Qtext_image_instance_p, (x)); \
|
|
367 } while (0)
|
0
|
368
|
187
|
369 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) do { \
|
|
370 CHECK_IMAGE_INSTANCE (x); \
|
|
371 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \
|
|
372 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \
|
|
373 } while (0)
|
0
|
374
|
187
|
375 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) do { \
|
|
376 CHECK_IMAGE_INSTANCE (x); \
|
|
377 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \
|
|
378 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \
|
|
379 } while (0)
|
0
|
380
|
187
|
381 #define CHECK_POINTER_IMAGE_INSTANCE(x) do { \
|
|
382 CHECK_IMAGE_INSTANCE (x); \
|
|
383 if (!POINTER_IMAGE_INSTANCEP (x)) \
|
|
384 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \
|
|
385 } while (0)
|
|
386
|
|
387 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) do { \
|
|
388 CHECK_IMAGE_INSTANCE (x); \
|
384
|
389 if (!SUBWINDOW_IMAGE_INSTANCEP (x) \
|
|
390 && !WIDGET_IMAGE_INSTANCEP (x)) \
|
187
|
391 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \
|
|
392 } while (0)
|
0
|
393
|
384
|
394 #define CHECK_WIDGET_IMAGE_INSTANCE(x) do { \
|
|
395 CHECK_IMAGE_INSTANCE (x); \
|
|
396 if (!WIDGET_IMAGE_INSTANCEP (x)) \
|
|
397 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \
|
|
398 } while (0)
|
|
399
|
0
|
400 struct Lisp_Image_Instance
|
|
401 {
|
|
402 struct lcrecord_header header;
|
412
|
403 Lisp_Object device;
|
0
|
404 Lisp_Object name;
|
|
405 enum image_instance_type type;
|
|
406 union
|
187
|
407 {
|
|
408 struct
|
0
|
409 {
|
187
|
410 Lisp_Object string;
|
|
411 } text;
|
|
412 struct
|
|
413 {
|
412
|
414 int width, height, depth;
|
187
|
415 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */
|
|
416 Lisp_Object filename; /* string or Qnil */
|
|
417 Lisp_Object mask_filename; /* string or Qnil */
|
|
418 Lisp_Object fg, bg; /* foreground and background colors,
|
|
419 if this is a colorized mono-pixmap
|
|
420 or a pointer */
|
265
|
421 Lisp_Object auxdata; /* list or Qnil: any additional data
|
|
422 to be seen from lisp */
|
187
|
423 } pixmap; /* used for pointers as well */
|
|
424 struct
|
|
425 {
|
412
|
426 Lisp_Object frame;
|
|
427 unsigned int width, height;
|
384
|
428 void* subwindow; /* specific devices can use this as necessary */
|
412
|
429 int being_displayed; /* used to detect when needs to be unmapped */
|
|
430 struct
|
|
431 {
|
|
432 Lisp_Object face; /* foreground and background colors */
|
|
433 Lisp_Object type;
|
|
434 Lisp_Object props; /* properties */
|
|
435 struct gui_item gui_item;
|
|
436 } widget; /* widgets are subwindows */
|
187
|
437 } subwindow;
|
|
438 } u;
|
0
|
439
|
|
440 /* console-type- and image-type-specific data */
|
|
441 void *data;
|
|
442 };
|
|
443
|
|
444 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device)
|
|
445 #define IMAGE_INSTANCE_NAME(i) ((i)->name)
|
|
446 #define IMAGE_INSTANCE_TYPE(i) ((i)->type)
|
412
|
447 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \
|
|
448 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \
|
0
|
449 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP))
|
412
|
450
|
|
451 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string)
|
0
|
452
|
412
|
453 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) ((i)->u.pixmap.width)
|
|
454 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) ((i)->u.pixmap.height)
|
0
|
455 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth)
|
|
456 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename)
|
|
457 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename)
|
|
458 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x)
|
|
459 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y)
|
|
460 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg)
|
|
461 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg)
|
265
|
462 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata)
|
0
|
463
|
412
|
464 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) ((i)->u.subwindow.width)
|
|
465 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) ((i)->u.subwindow.height)
|
384
|
466 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow)
|
412
|
467 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame)
|
384
|
468 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
|
|
469 ((i)->u.subwindow.being_displayed)
|
|
470
|
|
471 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \
|
412
|
472 IMAGE_INSTANCE_SUBWINDOW_WIDTH(i)
|
384
|
473 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \
|
412
|
474 IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i)
|
|
475 #define IMAGE_INSTANCE_WIDGET_CALLBACK(i) \
|
|
476 ((i)->u.subwindow.widget.gui_item.callback)
|
|
477 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.widget.type)
|
|
478 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.widget.props)
|
|
479 #define IMAGE_INSTANCE_WIDGET_FACE(i) ((i)->u.subwindow.widget.face)
|
|
480 #define IMAGE_INSTANCE_WIDGET_TEXT(i) ((i)->u.subwindow.widget.gui_item.name)
|
|
481 #define IMAGE_INSTANCE_WIDGET_ITEM(i) ((i)->u.subwindow.widget.gui_item)
|
398
|
482
|
0
|
483 #define XIMAGE_INSTANCE_DEVICE(i) \
|
|
484 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i))
|
|
485 #define XIMAGE_INSTANCE_NAME(i) \
|
|
486 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i))
|
|
487 #define XIMAGE_INSTANCE_TYPE(i) \
|
|
488 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i))
|
|
489
|
|
490 #define XIMAGE_INSTANCE_TEXT_STRING(i) \
|
|
491 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i))
|
|
492
|
|
493 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \
|
|
494 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i))
|
|
495 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
|
|
496 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i))
|
|
497 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \
|
|
498 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i))
|
|
499 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \
|
|
500 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i))
|
|
501 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \
|
|
502 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i))
|
|
503 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \
|
|
504 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i))
|
|
505 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \
|
|
506 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i))
|
|
507 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \
|
|
508 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i))
|
|
509 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \
|
|
510 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i))
|
|
511
|
384
|
512 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \
|
|
513 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i))
|
|
514 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \
|
|
515 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i))
|
412
|
516 #define XIMAGE_INSTANCE_WIDGET_CALLBACK(i) \
|
|
517 IMAGE_INSTANCE_WIDGET_CALLBACK (XIMAGE_INSTANCE (i))
|
384
|
518 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \
|
|
519 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i))
|
|
520 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \
|
|
521 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i))
|
|
522 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \
|
|
523 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
|
412
|
524 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \
|
|
525 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i))
|
398
|
526 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \
|
|
527 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i))
|
|
528
|
412
|
529 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \
|
|
530 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i))
|
|
531 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \
|
|
532 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i))
|
384
|
533 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \
|
|
534 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i))
|
412
|
535 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \
|
|
536 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i))
|
384
|
537 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
|
|
538 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i))
|
408
|
539
|
288
|
540 #ifdef HAVE_XPM
|
|
541 Lisp_Object evaluate_xpm_color_symbols (void);
|
|
542 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid);
|
|
543 #endif /* HAVE_XPM */
|
|
544 #ifdef HAVE_WINDOW_SYSTEM
|
|
545 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
|
|
546 int ok_if_data_invalid);
|
412
|
547 int read_bitmap_data_from_file (CONST char *filename, unsigned int *width,
|
288
|
548 unsigned int *height, unsigned char **datap,
|
|
549 int *x_hot, int *y_hot);
|
|
550 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
|
380
|
551 Lisp_Object mask_file,
|
288
|
552 Lisp_Object console_type);
|
|
553 #endif
|
|
554
|
272
|
555 /************************************************************************/
|
|
556 /* Glyph Object */
|
|
557 /************************************************************************/
|
0
|
558
|
|
559 enum glyph_type
|
|
560 {
|
|
561 GLYPH_UNKNOWN,
|
|
562 GLYPH_BUFFER,
|
|
563 GLYPH_POINTER,
|
|
564 GLYPH_ICON
|
|
565 };
|
|
566
|
|
567 struct Lisp_Glyph
|
|
568 {
|
|
569 struct lcrecord_header header;
|
|
570
|
|
571 enum glyph_type type;
|
|
572
|
|
573 /* specifiers: */
|
|
574 Lisp_Object image; /* the actual image */
|
|
575 Lisp_Object contrib_p; /* whether to figure into line height */
|
|
576 Lisp_Object baseline; /* percent above baseline */
|
|
577
|
|
578 Lisp_Object face; /* if non-nil, face to use when displaying */
|
|
579
|
|
580 Lisp_Object plist;
|
|
581 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
|
|
582 Lisp_Object locale);
|
412
|
583 };
|
0
|
584
|
412
|
585 DECLARE_LRECORD (glyph, struct Lisp_Glyph);
|
|
586 #define XGLYPH(x) XRECORD (x, glyph, struct Lisp_Glyph)
|
0
|
587 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph)
|
|
588 #define GLYPHP(x) RECORDP (x, glyph)
|
412
|
589 #define GC_GLYPHP(x) GC_RECORDP (x, glyph)
|
0
|
590 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph)
|
|
591 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph)
|
|
592
|
187
|
593 #define CHECK_BUFFER_GLYPH(x) do { \
|
|
594 CHECK_GLYPH (x); \
|
|
595 if (XGLYPH (x)->type != GLYPH_BUFFER) \
|
|
596 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \
|
|
597 } while (0)
|
0
|
598
|
187
|
599 #define CHECK_POINTER_GLYPH(x) do { \
|
|
600 CHECK_GLYPH (x); \
|
|
601 if (XGLYPH (x)->type != GLYPH_POINTER) \
|
|
602 x = wrong_type_argument (Qpointer_glyph_p, (x)); \
|
|
603 } while (0)
|
0
|
604
|
187
|
605 #define CHECK_ICON_GLYPH(x) do { \
|
|
606 CHECK_GLYPH (x); \
|
|
607 if (XGLYPH (x)->type != GLYPH_ICON) \
|
|
608 x = wrong_type_argument (Qicon_glyph_p, (x)); \
|
|
609 } while (0)
|
0
|
610
|
|
611 #define GLYPH_TYPE(g) ((g)->type)
|
|
612 #define GLYPH_IMAGE(g) ((g)->image)
|
|
613 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p)
|
|
614 #define GLYPH_BASELINE(g) ((g)->baseline)
|
|
615 #define GLYPH_FACE(g) ((g)->face)
|
|
616
|
|
617 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g))
|
|
618 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g))
|
|
619 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g))
|
|
620 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g))
|
|
621 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g))
|
|
622
|
412
|
623 extern Lisp_Object Qxpm, Qxface;
|
288
|
624 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
|
412
|
625 extern Lisp_Object Qxbm, Qedit, Qgroup, Qlabel, Qcombo, Qscrollbar, Qprogress;
|
288
|
626 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
|
384
|
627 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
|
388
|
628 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
|
412
|
629 extern Lisp_Object Q_items, Q_properties, Q_image, Q_percent, Qimage_conversion_error;
|
272
|
630 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph;
|
|
631 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph;
|
0
|
632 extern Lisp_Object Vxemacs_logo;
|
|
633
|
412
|
634 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object frame_face,
|
|
635 face_index window_findex,
|
|
636 Lisp_Object window);
|
|
637 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object frame_face,
|
|
638 face_index window_findex,
|
|
639 Lisp_Object window);
|
|
640 unsigned short glyph_descent (Lisp_Object glyph,
|
|
641 Lisp_Object frame_face,
|
|
642 face_index window_findex,
|
|
643 Lisp_Object window);
|
|
644 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object frame_face,
|
|
645 face_index window_findex,
|
|
646 Lisp_Object window);
|
0
|
647 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain);
|
|
648 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain);
|
|
649 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain);
|
|
650 Lisp_Object glyph_image_instance (Lisp_Object glyph,
|
|
651 Lisp_Object domain,
|
|
652 Error_behavior errb, int no_quit);
|
|
653 void file_or_data_must_be_present (Lisp_Object instantiator);
|
|
654 void data_must_be_present (Lisp_Object instantiator);
|
|
655 Lisp_Object make_string_from_file (Lisp_Object file);
|
|
656 Lisp_Object tagged_vector_to_alist (Lisp_Object vector);
|
|
657 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist);
|
|
658 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
|
|
659 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
|
124
|
660 int dest_mask, Lisp_Object domain);
|
0
|
661 Lisp_Object allocate_glyph (enum glyph_type type,
|
|
662 void (*after_change) (Lisp_Object glyph,
|
|
663 Lisp_Object property,
|
|
664 Lisp_Object locale));
|
412
|
665 Lisp_Object widget_face_font_info (Lisp_Object domain, Lisp_Object face,
|
|
666 int *height, int *width);
|
|
667 void widget_text_to_pixel_conversion (Lisp_Object domain, Lisp_Object face,
|
|
668 int th, int tw,
|
|
669 int* height, int* width);
|
0
|
670
|
272
|
671 /************************************************************************/
|
|
672 /* Glyph Cachels */
|
|
673 /************************************************************************/
|
0
|
674
|
185
|
675 typedef struct glyph_cachel glyph_cachel;
|
0
|
676 struct glyph_cachel
|
|
677 {
|
|
678 Lisp_Object glyph;
|
|
679
|
|
680 unsigned int updated :1;
|
|
681 unsigned short width;
|
|
682 unsigned short ascent;
|
|
683 unsigned short descent;
|
|
684 };
|
|
685
|
|
686 #define CONT_GLYPH_INDEX (glyph_index) 0
|
|
687 #define TRUN_GLYPH_INDEX (glyph_index) 1
|
|
688 #define HSCROLL_GLYPH_INDEX (glyph_index) 2
|
|
689 #define CONTROL_GLYPH_INDEX (glyph_index) 3
|
|
690 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4
|
|
691 #define INVIS_GLYPH_INDEX (glyph_index) 5
|
|
692
|
412
|
693 #define GLYPH_CACHEL(window, index) \
|
|
694 Dynarr_atp (window->glyph_cachels, index)
|
|
695 #define GLYPH_CACHEL_GLYPH(window, index) \
|
|
696 Dynarr_atp (window->glyph_cachels, index)->glyph
|
|
697 #define GLYPH_CACHEL_WIDTH(window, index) \
|
|
698 Dynarr_atp (window->glyph_cachels, index)->width
|
|
699 #define GLYPH_CACHEL_ASCENT(window, index) \
|
|
700 Dynarr_atp (window->glyph_cachels, index)->ascent
|
|
701 #define GLYPH_CACHEL_DESCENT(window, index) \
|
|
702 Dynarr_atp (window->glyph_cachels, index)->descent
|
408
|
703
|
412
|
704 void mark_glyph_cachels (glyph_cachel_dynarr *elements,
|
|
705 void (*markobj) (Lisp_Object));
|
0
|
706 void mark_glyph_cachels_as_not_updated (struct window *w);
|
|
707 void reset_glyph_cachels (struct window *w);
|
384
|
708
|
0
|
709 #ifdef MEMORY_USAGE_STATS
|
|
710 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
|
|
711 struct overhead_stats *ovstats);
|
|
712 #endif /* MEMORY_USAGE_STATS */
|
|
713
|
272
|
714 /************************************************************************/
|
|
715 /* Display Tables */
|
|
716 /************************************************************************/
|
0
|
717
|
384
|
718 Lisp_Object display_table_entry (Emchar, Lisp_Object, Lisp_Object);
|
|
719 void get_display_tables (struct window *, face_index,
|
|
720 Lisp_Object *, Lisp_Object *);
|
|
721
|
|
722 /****************************************************************************
|
|
723 * Subwindow Object *
|
|
724 ****************************************************************************/
|
0
|
725
|
412
|
726 /* redisplay needs a per-frame cache of subwindows being displayed so
|
|
727 * that we known when to unmap them */
|
|
728 typedef struct subwindow_cachel subwindow_cachel;
|
|
729 struct subwindow_cachel
|
398
|
730 {
|
412
|
731 Lisp_Object subwindow;
|
|
732 int x, y;
|
|
733 int width, height;
|
|
734 int being_displayed;
|
|
735 int updated;
|
398
|
736 };
|
|
737
|
412
|
738 typedef struct
|
|
739 {
|
|
740 Dynarr_declare (subwindow_cachel);
|
|
741 } subwindow_cachel_dynarr;
|
398
|
742
|
412
|
743 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements,
|
|
744 void (*markobj) (Lisp_Object));
|
|
745 void mark_subwindow_cachels_as_not_updated (struct frame *f);
|
|
746 void reset_subwindow_cachels (struct frame *f);
|
|
747 void unmap_subwindow (Lisp_Object subwindow);
|
|
748 void map_subwindow (Lisp_Object subwindow, int x, int y);
|
|
749 void update_frame_subwindows (struct frame *f);
|
|
750
|
|
751 #endif /* _XEMACS_GLYPHS_H_ */
|