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