comparison src/glyphs.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 6719134a07c2
children 2f8bb876ab1d
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */ 20 Boston, MA 02111-1307, USA. */
21 21
22 /* Synched up with: Not in FSF. */ 22 /* Synched up with: Not in FSF. */
23 23
24 #ifndef _XEMACS_GLYPHS_H_ 24 #ifndef INCLUDED_glyphs_h_
25 #define _XEMACS_GLYPHS_H_ 25 #define INCLUDED_glyphs_h_
26 26
27 #include "specifier.h" 27 #include "specifier.h"
28 #include "gui.h" 28 #include "gui.h"
29 29
30 /************************************************************************/ 30 /************************************************************************/
53 mswindows-resource pointer 53 mswindows-resource pointer
54 font pointer 54 font pointer
55 subwindow subwindow 55 subwindow subwindow
56 inherit mono-pixmap 56 inherit mono-pixmap
57 autodetect mono-pixmap, color-pixmap, pointer, text 57 autodetect mono-pixmap, color-pixmap, pointer, text
58 button widget 58 button widget
59 edit widget 59 edit-field widget
60 combo widget 60 combo -box widget
61 progress-gauge widget
62 tab-control widget
63 tree-view widget
61 scrollbar widget 64 scrollbar widget
62 static widget 65 static widget
63 */ 66 */
64 67
65 /* These are methods specific to a particular format of image instantiator 68 /* These are methods specific to a particular format of image instantiator
66 (e.g. xpm, string, etc.). */ 69 (e.g. xpm, string, etc.). */
67 70
69 struct ii_keyword_entry 72 struct ii_keyword_entry
70 { 73 {
71 Lisp_Object keyword; 74 Lisp_Object keyword;
72 void (*validate) (Lisp_Object data); 75 void (*validate) (Lisp_Object data);
73 int multiple_p; 76 int multiple_p;
77 int copy_p;
74 }; 78 };
75 79
76 typedef struct 80 typedef struct
77 { 81 {
78 Dynarr_declare (ii_keyword_entry); 82 Dynarr_declare (ii_keyword_entry);
79 } ii_keyword_entry_dynarr; 83 } ii_keyword_entry_dynarr;
80 84
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
81 struct image_instantiator_methods 99 struct image_instantiator_methods
82 { 100 {
83 Lisp_Object symbol; 101 Lisp_Object symbol;
84 102
85 Lisp_Object device; /* sometimes used */ 103 Lisp_Object device; /* sometimes used */
86 104
87 ii_keyword_entry_dynarr *keywords; 105 ii_keyword_entry_dynarr *keywords;
106 /* consoles this ii is supported on */
107 console_type_entry_dynarr *consoles;
88 /* Implementation specific methods: */ 108 /* Implementation specific methods: */
89 109
90 /* Validate method: Given an instantiator vector, signal an error if 110 /* Validate method: Given an instantiator vector, signal an error if
91 it's invalid for this image-instantiator format. Note that this 111 it's invalid for this image-instantiator format. Note that this
92 validation only occurs after all the keyword-specific validation 112 validation only occurs after all the keyword-specific validation
121 /* Set-property method: Given an image instance, set device specific 141 /* Set-property method: Given an image instance, set device specific
122 properties. */ 142 properties. */
123 Lisp_Object (*set_property_method) (Lisp_Object image_instance, 143 Lisp_Object (*set_property_method) (Lisp_Object image_instance,
124 Lisp_Object property, 144 Lisp_Object property,
125 Lisp_Object val); 145 Lisp_Object val);
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);
126 }; 162 };
127 163
128 /***** Calling an image-instantiator method *****/ 164 /***** Calling an image-instantiator method *****/
129 165
130 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) 166 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0)
168 xnew_and_zero (struct image_instantiator_methods); \ 204 xnew_and_zero (struct image_instantiator_methods); \
169 format##_image_instantiator_methods->symbol = Q##format; \ 205 format##_image_instantiator_methods->symbol = Q##format; \
170 format##_image_instantiator_methods->device = Qnil; \ 206 format##_image_instantiator_methods->device = Qnil; \
171 format##_image_instantiator_methods->keywords = \ 207 format##_image_instantiator_methods->keywords = \
172 Dynarr_new (ii_keyword_entry); \ 208 Dynarr_new (ii_keyword_entry); \
209 format##_image_instantiator_methods->consoles = \
210 Dynarr_new (console_type_entry); \
173 add_entry_to_image_instantiator_format_list \ 211 add_entry_to_image_instantiator_format_list \
174 (Q##format, format##_image_instantiator_methods); \ 212 (Q##format, format##_image_instantiator_methods); \
213 dumpstruct (&format##_image_instantiator_methods, \
214 &iim_description); \
175 } while (0) 215 } while (0)
176 216
177 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \ 217 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \
178 do { \ 218 do { \
179 defsymbol (&Q##format, obj_name); \ 219 defsymbol (&Q##format, obj_name); \
180 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name); \ 220 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name);\
181 } while (0) 221 } while (0)
182 222
183 /* Declare that image-instantiator format FORMAT has method M; used in 223 /* Declare that image-instantiator format FORMAT has method M; used in
184 initialization routines */ 224 initialization routines */
185 #define IIFORMAT_HAS_METHOD(format, m) \ 225 #define IIFORMAT_HAS_METHOD(format, m) \
189 (format##_image_instantiator_methods->m##_method = type##_##m) 229 (format##_image_instantiator_methods->m##_method = type##_##m)
190 230
191 /* Declare that KEYW is a valid keyword for image-instantiator format 231 /* Declare that KEYW is a valid keyword for image-instantiator format
192 FORMAT. VALIDATE_FUN if a function that returns whether the data 232 FORMAT. VALIDATE_FUN if a function that returns whether the data
193 is valid. The keyword may not appear more than once. */ 233 is valid. The keyword may not appear more than once. */
194 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \ 234 #define IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, copy, multi) \
195 do { \ 235 do { \
196 struct ii_keyword_entry entry; \ 236 struct ii_keyword_entry entry; \
197 \ 237 \
198 entry.keyword = keyw; \ 238 entry.keyword = keyw; \
199 entry.validate = validate_fun; \ 239 entry.validate = validate_fun; \
200 entry.multiple_p = 0; \ 240 entry.multiple_p = multi; \
241 entry.copy_p = copy; \
201 Dynarr_add (format##_image_instantiator_methods->keywords, \ 242 Dynarr_add (format##_image_instantiator_methods->keywords, \
202 entry); \ 243 entry); \
203 } while (0) 244 } while (0)
204 245
246 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \
247 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 0)
248
205 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may 249 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may
206 appear multiple times. */ 250 appear multiple times. */
207 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyword, validate_fun) \ 251 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \
208 do { \ 252 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1)
209 struct ii_keyword_entry entry; \ 253
210 \ 254 /* Same as IIFORMAT_VALID_KEYWORD execpt that the argument is not
211 entry.keyword = keyword; \ 255 copied by the specifier functions. This is necessary for things
212 entry.validate = validate_fun; \ 256 like callbacks etc. */
213 entry.multiple_p = 1; \ 257 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \
214 Dynarr_add (format##_image_instantiator_methods->keywords, \ 258 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0)
215 entry); \ 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); \
216 } while (0) 270 } while (0)
217 271
218 #define DEFINE_DEVICE_IIFORMAT(type, format)\ 272 #define DEFINE_DEVICE_IIFORMAT(type, format) \
273 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format); \
219 struct image_instantiator_methods *type##_##format##_image_instantiator_methods 274 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
220 275
221 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \ 276 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \
222 do { \ 277 do { \
223 type##_##format##_image_instantiator_methods = \ 278 type##_##format##_image_instantiator_methods = \
224 xnew_and_zero (struct image_instantiator_methods); \ 279 xnew_and_zero (struct image_instantiator_methods); \
225 type##_##format##_image_instantiator_methods->symbol = Q##format; \ 280 type##_##format##_image_instantiator_methods->symbol = Q##format; \
226 type##_##format##_image_instantiator_methods->device = Q##type; \ 281 type##_##format##_image_instantiator_methods->device = Q##type; \
227 type##_##format##_image_instantiator_methods->keywords = \ 282 type##_##format##_image_instantiator_methods->keywords = \
228 Dynarr_new (ii_keyword_entry); \ 283 Dynarr_new (ii_keyword_entry); \
229 add_entry_to_device_ii_format_list \ 284 add_entry_to_device_ii_format_list \
230 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \ 285 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \
286 IIFORMAT_VALID_CONSOLE(type,format); \
287 dumpstruct (&type##_##format##_image_instantiator_methods, \
288 &iim_description); \
231 } while (0) 289 } while (0)
232 290
233 /* Declare that image-instantiator format FORMAT has method M; used in 291 /* Declare that image-instantiator format FORMAT has method M; used in
234 initialization routines */ 292 initialization routines */
235 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \ 293 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \
236 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m) 294 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m)
295 #define IIFORMAT_HAS_SHARED_DEVMETHOD(type, format, m, fromformat) \
296 (type##_##format##_image_instantiator_methods->m##_method = type##_##fromformat##_##m)
237 297
238 struct image_instantiator_methods * 298 struct image_instantiator_methods *
239 decode_device_ii_format (Lisp_Object device, Lisp_Object format, 299 decode_device_ii_format (Lisp_Object device, Lisp_Object format,
240 Error_behavior errb); 300 Error_behavior errb);
241 struct image_instantiator_methods * 301 struct image_instantiator_methods *
259 Lisp_Object console_type); 319 Lisp_Object console_type);
260 void check_valid_string (Lisp_Object data); 320 void check_valid_string (Lisp_Object data);
261 void check_valid_int (Lisp_Object data); 321 void check_valid_int (Lisp_Object data);
262 void check_valid_face (Lisp_Object data); 322 void check_valid_face (Lisp_Object data);
263 void check_valid_vector (Lisp_Object data); 323 void check_valid_vector (Lisp_Object data);
264 324 void check_valid_item_list_1 (Lisp_Object items);
265 void initialize_subwindow_image_instance (struct Lisp_Image_Instance*); 325
326 void initialize_subwindow_image_instance (Lisp_Image_Instance*);
266 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, 327 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
267 Lisp_Object pointer_fg, Lisp_Object pointer_bg, 328 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
268 int dest_mask, Lisp_Object domain); 329 int dest_mask, Lisp_Object domain);
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);
269 341
270 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, 342 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator,
271 int given_dest_mask, 343 int given_dest_mask,
272 int desired_dest_mask)); 344 int desired_dest_mask));
273 DECLARE_DOESNT_RETURN (signal_image_error (CONST char *, Lisp_Object)); 345 DECLARE_DOESNT_RETURN (signal_image_error (const char *, Lisp_Object));
274 DECLARE_DOESNT_RETURN (signal_image_error_2 (CONST char *, Lisp_Object, Lisp_Object)); 346 DECLARE_DOESNT_RETURN (signal_image_error_2 (const char *, Lisp_Object, Lisp_Object));
275 347
276 /************************************************************************/ 348 /************************************************************************/
277 /* Image Specifier Object */ 349 /* Image Specifier Object */
278 /************************************************************************/ 350 /************************************************************************/
279 351
305 377
306 /************************************************************************/ 378 /************************************************************************/
307 /* Image Instance Object */ 379 /* Image Instance Object */
308 /************************************************************************/ 380 /************************************************************************/
309 381
310 DECLARE_LRECORD (image_instance, struct Lisp_Image_Instance); 382 DECLARE_LRECORD (image_instance, Lisp_Image_Instance);
311 #define XIMAGE_INSTANCE(x) \ 383 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance)
312 XRECORD (x, image_instance, struct Lisp_Image_Instance)
313 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance) 384 #define XSETIMAGE_INSTANCE(x, p) XSETRECORD (x, p, image_instance)
314 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) 385 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance)
315 #define GC_IMAGE_INSTANCEP(x) GC_RECORDP (x, image_instance)
316 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) 386 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance)
317 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) 387 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance)
318 388
319 enum image_instance_type 389 enum image_instance_type
320 { 390 {
323 IMAGE_TEXT, 393 IMAGE_TEXT,
324 IMAGE_MONO_PIXMAP, 394 IMAGE_MONO_PIXMAP,
325 IMAGE_COLOR_PIXMAP, 395 IMAGE_COLOR_PIXMAP,
326 IMAGE_POINTER, 396 IMAGE_POINTER,
327 IMAGE_SUBWINDOW, 397 IMAGE_SUBWINDOW,
328 IMAGE_WIDGET 398 IMAGE_WIDGET,
399 IMAGE_LAYOUT
329 }; 400 };
330 401
331 #define IMAGE_NOTHING_MASK (1 << 0) 402 #define IMAGE_NOTHING_MASK (1 << 0)
332 #define IMAGE_TEXT_MASK (1 << 1) 403 #define IMAGE_TEXT_MASK (1 << 1)
333 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) 404 #define IMAGE_MONO_PIXMAP_MASK (1 << 2)
334 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) 405 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3)
335 #define IMAGE_POINTER_MASK (1 << 4) 406 #define IMAGE_POINTER_MASK (1 << 4)
336 #define IMAGE_SUBWINDOW_MASK (1 << 5) 407 #define IMAGE_SUBWINDOW_MASK (1 << 5)
337 #define IMAGE_WIDGET_MASK (1 << 6) 408 #define IMAGE_WIDGET_MASK (1 << 6)
409 #define IMAGE_LAYOUT_MASK (1 << 7)
338 410
339 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ 411 #define IMAGE_INSTANCE_TYPE_P(ii, type) \
340 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) 412 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type)
341 413
342 #define NOTHING_IMAGE_INSTANCEP(ii) \ 414 #define NOTHING_IMAGE_INSTANCEP(ii) \
351 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) 423 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER)
352 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ 424 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \
353 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) 425 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW)
354 #define WIDGET_IMAGE_INSTANCEP(ii) \ 426 #define WIDGET_IMAGE_INSTANCEP(ii) \
355 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) 427 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET)
428 #define LAYOUT_IMAGE_INSTANCEP(ii) \
429 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_LAYOUT)
356 430
357 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ 431 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \
358 CHECK_IMAGE_INSTANCE (x); \ 432 CHECK_IMAGE_INSTANCE (x); \
359 if (!NOTHING_IMAGE_INSTANCEP (x)) \ 433 if (!NOTHING_IMAGE_INSTANCEP (x)) \
360 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ 434 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \
395 CHECK_IMAGE_INSTANCE (x); \ 469 CHECK_IMAGE_INSTANCE (x); \
396 if (!WIDGET_IMAGE_INSTANCEP (x)) \ 470 if (!WIDGET_IMAGE_INSTANCEP (x)) \
397 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ 471 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \
398 } while (0) 472 } while (0)
399 473
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
400 struct Lisp_Image_Instance 480 struct Lisp_Image_Instance
401 { 481 {
402 struct lcrecord_header header; 482 struct lcrecord_header header;
403 Lisp_Object device; 483 Lisp_Object device;
404 Lisp_Object name; 484 Lisp_Object name;
485 /* The glyph from which we were instantiated. This is a weak
486 reference. */
487 Lisp_Object parent;
405 enum image_instance_type type; 488 enum image_instance_type type;
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
406 union 496 union
407 { 497 {
408 struct 498 struct
409 { 499 {
500 unsigned int descent;
410 Lisp_Object string; 501 Lisp_Object string;
411 } text; 502 } text;
412 struct 503 struct
413 { 504 {
414 int width, height, depth; 505 unsigned int depth;
506 unsigned int slice, maxslice, timeout;
415 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */ 507 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */
416 Lisp_Object filename; /* string or Qnil */ 508 Lisp_Object filename; /* string or Qnil */
417 Lisp_Object mask_filename; /* string or Qnil */ 509 Lisp_Object mask_filename; /* string or Qnil */
418 Lisp_Object fg, bg; /* foreground and background colors, 510 Lisp_Object fg, bg; /* foreground and background colors,
419 if this is a colorized mono-pixmap 511 if this is a colorized mono-pixmap
420 or a pointer */ 512 or a pointer */
421 Lisp_Object auxdata; /* list or Qnil: any additional data 513 Lisp_Object auxdata; /* list or Qnil: any additional data
422 to be seen from lisp */ 514 to be seen from lisp */
515 void* mask; /* mask that can be seen from all windowing systems */
423 } pixmap; /* used for pointers as well */ 516 } pixmap; /* used for pointers as well */
424 struct 517 struct
425 { 518 {
426 Lisp_Object frame; 519 Lisp_Object frame;
427 unsigned int width, height;
428 void* subwindow; /* specific devices can use this as necessary */ 520 void* subwindow; /* specific devices can use this as necessary */
429 int being_displayed; /* used to detect when needs to be unmapped */ 521 unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */
430 struct 522 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */
431 { 523 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */
432 Lisp_Object face; /* foreground and background colors */ 524 unsigned int orientation : 1; /* Vertical or horizontal. */
433 Lisp_Object type; 525 unsigned int justification : 2; /* Left, right or center. */
434 Lisp_Object props; /* properties */ 526 /* Face for colors and font. We specify this here becuase we
435 struct gui_item gui_item; 527 want people to be able to put :face in the instantiator
436 } widget; /* widgets are subwindows */ 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;
437 } subwindow; 538 } subwindow;
438 } u; 539 } u;
439 540
440 /* console-type- and image-type-specific data */ 541 /* console-type- and image-type-specific data */
441 void *data; 542 void *data;
442 }; 543 };
443 544
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. */
444 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) 554 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device)
445 #define IMAGE_INSTANCE_NAME(i) ((i)->name) 555 #define IMAGE_INSTANCE_NAME(i) ((i)->name)
556 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent)
557 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i))
446 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) 558 #define IMAGE_INSTANCE_TYPE(i) ((i)->type)
447 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ 559 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset)
448 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ 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) \
449 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) 565 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP))
450 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))
571
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)
583
584 /* Text properties */
451 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) 585 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string)
452 586 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \
453 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) ((i)->u.pixmap.width) 587 IMAGE_INSTANCE_WIDTH(i)
454 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) ((i)->u.pixmap.height) 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)
455 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) 599 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth)
456 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename) 600 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename)
457 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename) 601 #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) 602 #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) 603 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y)
460 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg) 604 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg)
461 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg) 605 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg)
462 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata) 606 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata)
463 607 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask)
464 #define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) ((i)->u.subwindow.width) 608 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice)
465 #define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) ((i)->u.subwindow.height) 609 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice)
610 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout)
611
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)
466 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) 617 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow)
467 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame) 618 #define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame)
468 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ 619 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
469 ((i)->u.subwindow.being_displayed) 620 ((i)->u.subwindow.being_displayed)
470 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)
629
630 /* Widget properties */
471 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \ 631 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \
472 IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) 632 IMAGE_INSTANCE_WIDTH(i)
473 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \ 633 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \
474 IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) 634 IMAGE_INSTANCE_HEIGHT(i)
475 #define IMAGE_INSTANCE_WIDGET_CALLBACK(i) \ 635 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.type)
476 ((i)->u.subwindow.widget.gui_item.callback) 636 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.props)
477 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.widget.type) 637 #define SET_IMAGE_INSTANCE_WIDGET_FACE(i,f) \
478 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.widget.props) 638 ((i)->u.subwindow.face = f)
479 #define IMAGE_INSTANCE_WIDGET_FACE(i) ((i)->u.subwindow.widget.face) 639 #define IMAGE_INSTANCE_WIDGET_FACE(i) \
480 #define IMAGE_INSTANCE_WIDGET_TEXT(i) ((i)->u.subwindow.widget.gui_item.name) 640 (!NILP ((i)->u.subwindow.face) ? (i)->u.subwindow.face : \
481 #define IMAGE_INSTANCE_WIDGET_ITEM(i) ((i)->u.subwindow.widget.gui_item) 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)
482 653
483 #define XIMAGE_INSTANCE_DEVICE(i) \ 654 #define XIMAGE_INSTANCE_DEVICE(i) \
484 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) 655 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i))
485 #define XIMAGE_INSTANCE_NAME(i) \ 656 #define XIMAGE_INSTANCE_NAME(i) \
486 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) 657 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i))
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))
487 #define XIMAGE_INSTANCE_TYPE(i) \ 662 #define XIMAGE_INSTANCE_TYPE(i) \
488 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i)) 663 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i))
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))
489 678
490 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ 679 #define XIMAGE_INSTANCE_TEXT_STRING(i) \
491 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) 680 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i))
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))
492 689
493 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \ 690 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \
494 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i)) 691 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i))
495 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ 692 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \
496 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i)) 693 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i))
506 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i)) 703 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i))
507 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \ 704 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \
508 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i)) 705 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i))
509 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \ 706 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \
510 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i)) 707 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i))
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))
511 716
512 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \ 717 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \
513 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i)) 718 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i))
514 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \ 719 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \
515 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i)) 720 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i))
516 #define XIMAGE_INSTANCE_WIDGET_CALLBACK(i) \
517 IMAGE_INSTANCE_WIDGET_CALLBACK (XIMAGE_INSTANCE (i))
518 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \ 721 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \
519 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i)) 722 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i))
520 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \ 723 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \
521 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i)) 724 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i))
522 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \ 725 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \
523 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i)) 726 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i))
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))
524 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \ 733 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \
525 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i)) 734 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i))
526 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \ 735
527 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i)) 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))
528 740
529 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ 741 #define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \
530 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i)) 742 IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i))
531 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ 743 #define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \
532 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i)) 744 IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i))
534 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) 746 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i))
535 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \ 747 #define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \
536 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i)) 748 IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i))
537 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ 749 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \
538 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) 750 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i))
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);
539 758
540 #ifdef HAVE_XPM 759 #ifdef HAVE_XPM
541 Lisp_Object evaluate_xpm_color_symbols (void); 760 Lisp_Object evaluate_xpm_color_symbols (void);
542 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); 761 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid);
543 #endif /* HAVE_XPM */ 762 #endif /* HAVE_XPM */
544 #ifdef HAVE_WINDOW_SYSTEM 763 #ifdef HAVE_WINDOW_SYSTEM
545 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot, 764 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot,
546 int ok_if_data_invalid); 765 int ok_if_data_invalid);
547 int read_bitmap_data_from_file (CONST char *filename, unsigned int *width, 766 int read_bitmap_data_from_file (const char *filename, unsigned int *width,
548 unsigned int *height, unsigned char **datap, 767 unsigned int *height, unsigned char **datap,
549 int *x_hot, int *y_hot); 768 int *x_hot, int *y_hot);
550 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file, 769 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file,
551 Lisp_Object mask_file, 770 Lisp_Object mask_file,
552 Lisp_Object console_type); 771 Lisp_Object console_type);
578 Lisp_Object face; /* if non-nil, face to use when displaying */ 797 Lisp_Object face; /* if non-nil, face to use when displaying */
579 798
580 Lisp_Object plist; 799 Lisp_Object plist;
581 void (*after_change) (Lisp_Object glyph, Lisp_Object property, 800 void (*after_change) (Lisp_Object glyph, Lisp_Object property,
582 Lisp_Object locale); 801 Lisp_Object locale);
583 }; 802
584 803 unsigned int dirty : 1; /* So that we can selectively
585 DECLARE_LRECORD (glyph, struct Lisp_Glyph); 804 redisplay changed glyphs. */
586 #define XGLYPH(x) XRECORD (x, glyph, struct Lisp_Glyph) 805 };
806 typedef struct Lisp_Glyph Lisp_Glyph;
807
808 DECLARE_LRECORD (glyph, Lisp_Glyph);
809 #define XGLYPH(x) XRECORD (x, glyph, Lisp_Glyph)
587 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph) 810 #define XSETGLYPH(x, p) XSETRECORD (x, p, glyph)
588 #define GLYPHP(x) RECORDP (x, glyph) 811 #define GLYPHP(x) RECORDP (x, glyph)
589 #define GC_GLYPHP(x) GC_RECORDP (x, glyph)
590 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph) 812 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph)
591 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph) 813 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph)
592 814
593 #define CHECK_BUFFER_GLYPH(x) do { \ 815 #define CHECK_BUFFER_GLYPH(x) do { \
594 CHECK_GLYPH (x); \ 816 CHECK_GLYPH (x); \
611 #define GLYPH_TYPE(g) ((g)->type) 833 #define GLYPH_TYPE(g) ((g)->type)
612 #define GLYPH_IMAGE(g) ((g)->image) 834 #define GLYPH_IMAGE(g) ((g)->image)
613 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p) 835 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p)
614 #define GLYPH_BASELINE(g) ((g)->baseline) 836 #define GLYPH_BASELINE(g) ((g)->baseline)
615 #define GLYPH_FACE(g) ((g)->face) 837 #define GLYPH_FACE(g) ((g)->face)
838 #define GLYPH_DIRTYP(g) ((g)->dirty)
616 839
617 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g)) 840 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g))
618 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g)) 841 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g))
619 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g)) 842 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g))
620 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g)) 843 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g))
621 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g)) 844 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g))
622 845 #define XGLYPH_DIRTYP(g) GLYPH_DIRTYP (XGLYPH (g))
623 extern Lisp_Object Qxpm, Qxface; 846
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;
624 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable; 850 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
625 extern Lisp_Object Qxbm, Qedit, Qgroup, Qlabel, Qcombo, Qscrollbar, Qprogress; 851 extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar;
852 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge, Q_border;
626 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; 853 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
627 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group; 854 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
628 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text; 855 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
629 extern Lisp_Object Q_items, Q_properties, Q_image, Q_percent, Qimage_conversion_error; 856 extern Lisp_Object Q_items, Q_properties, Q_image, Q_percent, Qimage_conversion_error;
857 extern Lisp_Object Q_orientation;
630 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; 858 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph;
631 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; 859 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph;
632 extern Lisp_Object Vxemacs_logo; 860 extern Lisp_Object Vxemacs_logo;
633 861
634 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object frame_face, 862 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object domain);
635 face_index window_findex, 863 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object domain);
636 Lisp_Object window); 864 unsigned short glyph_descent (Lisp_Object glyph, Lisp_Object domain);
637 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object frame_face, 865 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object domain);
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);
647 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain); 866 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain);
648 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain); 867 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain);
649 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain); 868 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain);
650 Lisp_Object glyph_image_instance (Lisp_Object glyph, 869 Lisp_Object glyph_image_instance (Lisp_Object glyph,
651 Lisp_Object domain, 870 Lisp_Object domain,
660 int dest_mask, Lisp_Object domain); 879 int dest_mask, Lisp_Object domain);
661 Lisp_Object allocate_glyph (enum glyph_type type, 880 Lisp_Object allocate_glyph (enum glyph_type type,
662 void (*after_change) (Lisp_Object glyph, 881 void (*after_change) (Lisp_Object glyph,
663 Lisp_Object property, 882 Lisp_Object property,
664 Lisp_Object locale)); 883 Lisp_Object locale));
665 Lisp_Object widget_face_font_info (Lisp_Object domain, Lisp_Object face, 884 void query_string_geometry ( Lisp_Object string, Lisp_Object face,
666 int *height, int *width); 885 unsigned int* width, unsigned int* height,
667 void widget_text_to_pixel_conversion (Lisp_Object domain, Lisp_Object face, 886 unsigned int* descent, Lisp_Object domain);
668 int th, int tw, 887 Lisp_Object query_string_font (Lisp_Object string,
669 int* height, int* width); 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);
670 891
671 /************************************************************************/ 892 /************************************************************************/
672 /* Glyph Cachels */ 893 /* Glyph Cachels */
673 /************************************************************************/ 894 /************************************************************************/
674 895
675 typedef struct glyph_cachel glyph_cachel; 896 typedef struct glyph_cachel glyph_cachel;
676 struct glyph_cachel 897 struct glyph_cachel
677 { 898 {
678 Lisp_Object glyph; 899 Lisp_Object glyph;
679 900
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. */
680 unsigned int updated :1; 907 unsigned int updated :1;
908
681 unsigned short width; 909 unsigned short width;
682 unsigned short ascent; 910 unsigned short ascent;
683 unsigned short descent; 911 unsigned short descent;
684 }; 912 };
685 913
698 Dynarr_atp (window->glyph_cachels, index)->width 926 Dynarr_atp (window->glyph_cachels, index)->width
699 #define GLYPH_CACHEL_ASCENT(window, index) \ 927 #define GLYPH_CACHEL_ASCENT(window, index) \
700 Dynarr_atp (window->glyph_cachels, index)->ascent 928 Dynarr_atp (window->glyph_cachels, index)->ascent
701 #define GLYPH_CACHEL_DESCENT(window, index) \ 929 #define GLYPH_CACHEL_DESCENT(window, index) \
702 Dynarr_atp (window->glyph_cachels, index)->descent 930 Dynarr_atp (window->glyph_cachels, index)->descent
703 931 #define GLYPH_CACHEL_DIRTYP(window, index) \
704 void mark_glyph_cachels (glyph_cachel_dynarr *elements, 932 Dynarr_atp (window->glyph_cachels, index)->dirty
705 void (*markobj) (Lisp_Object)); 933
934 void mark_glyph_cachels (glyph_cachel_dynarr *elements);
706 void mark_glyph_cachels_as_not_updated (struct window *w); 935 void mark_glyph_cachels_as_not_updated (struct window *w);
936 void mark_glyph_cachels_as_clean (struct window *w);
707 void reset_glyph_cachels (struct window *w); 937 void reset_glyph_cachels (struct window *w);
938 glyph_index get_glyph_cachel_index (struct window *w, Lisp_Object glyph);
708 939
709 #ifdef MEMORY_USAGE_STATS 940 #ifdef MEMORY_USAGE_STATS
710 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels, 941 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels,
711 struct overhead_stats *ovstats); 942 struct overhead_stats *ovstats);
712 #endif /* MEMORY_USAGE_STATS */ 943 #endif /* MEMORY_USAGE_STATS */
727 * that we known when to unmap them */ 958 * that we known when to unmap them */
728 typedef struct subwindow_cachel subwindow_cachel; 959 typedef struct subwindow_cachel subwindow_cachel;
729 struct subwindow_cachel 960 struct subwindow_cachel
730 { 961 {
731 Lisp_Object subwindow; 962 Lisp_Object subwindow;
732 int x, y; 963 unsigned int x, y;
733 int width, height; 964 unsigned int width, height;
734 int being_displayed; 965 unsigned int being_displayed : 1;
735 int updated; 966 unsigned int updated : 1;
736 }; 967 };
737 968
738 typedef struct 969 typedef struct
739 { 970 {
740 Dynarr_declare (subwindow_cachel); 971 Dynarr_declare (subwindow_cachel);
741 } subwindow_cachel_dynarr; 972 } subwindow_cachel_dynarr;
742 973
743 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements, 974 void mark_subwindow_cachels (subwindow_cachel_dynarr *elements);
744 void (*markobj) (Lisp_Object));
745 void mark_subwindow_cachels_as_not_updated (struct frame *f); 975 void mark_subwindow_cachels_as_not_updated (struct frame *f);
746 void reset_subwindow_cachels (struct frame *f); 976 void reset_subwindow_cachels (struct frame *f);
747 void unmap_subwindow (Lisp_Object subwindow); 977 void unmap_subwindow (Lisp_Object subwindow);
748 void map_subwindow (Lisp_Object subwindow, int x, int y); 978 void map_subwindow (Lisp_Object subwindow, int x, int y,
979 struct display_glyph_area *dga);
749 void update_frame_subwindows (struct frame *f); 980 void update_frame_subwindows (struct frame *f);
750 981 int find_matching_subwindow (struct frame* f, int x, int y, int width, int height);
751 #endif /* _XEMACS_GLYPHS_H_ */ 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*);
985
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_ */