Mercurial > hg > xemacs-beta
annotate src/glyphs.h @ 5157:1fae11d56ad2
redo memory-usage mechanism, add way of dynamically initializing Lisp objects
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-03-18 Ben Wing <ben@xemacs.org>
* diagnose.el (show-memory-usage):
Rewrite to take into account API changes in memory-usage functions.
src/ChangeLog addition:
2010-03-18 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (disksave_object_finalization_1):
* alloc.c (lisp_object_storage_size):
* alloc.c (listu):
* alloc.c (listn):
* alloc.c (Fobject_memory_usage_stats):
* alloc.c (compute_memusage_stats_length):
* alloc.c (Fobject_memory_usage):
* alloc.c (Ftotal_object_memory_usage):
* alloc.c (malloced_storage_size):
* alloc.c (common_init_alloc_early):
* alloc.c (reinit_alloc_objects_early):
* alloc.c (reinit_alloc_early):
* alloc.c (init_alloc_once_early):
* alloc.c (syms_of_alloc):
* alloc.c (reinit_vars_of_alloc):
* buffer.c:
* buffer.c (struct buffer_stats):
* buffer.c (compute_buffer_text_usage):
* buffer.c (compute_buffer_usage):
* buffer.c (buffer_memory_usage):
* buffer.c (buffer_objects_create):
* buffer.c (syms_of_buffer):
* buffer.c (vars_of_buffer):
* console-impl.h (struct console_methods):
* dynarr.c (Dynarr_memory_usage):
* emacs.c (main_1):
* events.c (clear_event_resource):
* extents.c:
* extents.c (compute_buffer_extent_usage):
* extents.c (extent_objects_create):
* extents.h:
* faces.c:
* faces.c (compute_face_cachel_usage):
* faces.c (face_objects_create):
* faces.h:
* general-slots.h:
* glyphs.c:
* glyphs.c (compute_glyph_cachel_usage):
* glyphs.c (glyph_objects_create):
* glyphs.h:
* lisp.h:
* lisp.h (struct usage_stats):
* lrecord.h:
* lrecord.h (enum lrecord_type):
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE):
* lrecord.h (DEFINE_DUMPABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (MAKE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_SIZABLE_LISP_OBJECT):
* lrecord.h (MAKE_MODULE_LISP_OBJECT):
* lrecord.h (INIT_LISP_OBJECT):
* lrecord.h (INIT_MODULE_LISP_OBJECT):
* lrecord.h (UNDEF_LISP_OBJECT):
* lrecord.h (UNDEF_MODULE_LISP_OBJECT):
* lrecord.h (DECLARE_LISP_OBJECT):
* lrecord.h (DECLARE_MODULE_API_LISP_OBJECT):
* lrecord.h (DECLARE_MODULE_LISP_OBJECT):
* lstream.c:
* lstream.c (syms_of_lstream):
* lstream.c (vars_of_lstream):
* marker.c:
* marker.c (compute_buffer_marker_usage):
* mc-alloc.c (mc_alloced_storage_size):
* mc-alloc.h:
* mule-charset.c:
* mule-charset.c (struct charset_stats):
* mule-charset.c (compute_charset_usage):
* mule-charset.c (charset_memory_usage):
* mule-charset.c (mule_charset_objects_create):
* mule-charset.c (syms_of_mule_charset):
* mule-charset.c (vars_of_mule_charset):
* redisplay.c:
* redisplay.c (compute_rune_dynarr_usage):
* redisplay.c (compute_display_block_dynarr_usage):
* redisplay.c (compute_glyph_block_dynarr_usage):
* redisplay.c (compute_display_line_dynarr_usage):
* redisplay.c (compute_line_start_cache_dynarr_usage):
* redisplay.h:
* scrollbar-gtk.c (gtk_compute_scrollbar_instance_usage):
* scrollbar-msw.c (mswindows_compute_scrollbar_instance_usage):
* scrollbar-x.c (x_compute_scrollbar_instance_usage):
* scrollbar.c (compute_scrollbar_instance_usage):
* scrollbar.h:
* symbols.c:
* symbols.c (reinit_symbol_objects_early):
* symbols.c (init_symbols_once_early):
* symbols.c (reinit_symbols_early):
* symbols.c (defsymbol_massage_name_1):
* symsinit.h:
* ui-gtk.c:
* ui-gtk.c (emacs_gtk_object_getprop):
* ui-gtk.c (emacs_gtk_object_putprop):
* ui-gtk.c (ui_gtk_objects_create):
* unicode.c (compute_from_unicode_table_size_1):
* unicode.c (compute_to_unicode_table_size_1):
* unicode.c (compute_from_unicode_table_size):
* unicode.c (compute_to_unicode_table_size):
* window.c:
* window.c (struct window_stats):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
* window.c (window_memory_usage):
* window.c (window_objects_create):
* window.c (syms_of_window):
* window.c (vars_of_window):
* window.h:
Redo memory-usage mechanism, make it general; add way of dynamically
initializing Lisp object types -- OBJECT_HAS_METHOD(), similar to
CONSOLE_HAS_METHOD().
(1) Create OBJECT_HAS_METHOD(), OBJECT_HAS_PROPERTY() etc. for
specifying that a Lisp object type has a particular method or
property. Call such methods with OBJECT_METH, MAYBE_OBJECT_METH,
OBJECT_METH_OR_GIVEN; retrieve properties with OBJECT_PROPERTY.
Methods that formerly required a DEFINE_*GENERAL_LISP_OBJECT() to
specify them (getprop, putprop, remprop, plist, disksave) now
instead use the dynamic-method mechanism. The main benefit of
this is that new methods or properties can be added without
requiring that the declaration statements of all existing methods
be modified. We have to make the `struct lrecord_implementation'
non-const, but I don't think this should have any effect on speed --
the only possible method that's really speed-critical is the
mark method, and we already extract those out into a separate
(non-const) array for increased cache locality.
Object methods need to be reinitialized after pdump, so we put
them in separate functions such as face_objects_create(),
extent_objects_create() and call them appropriately from emacs.c
The only current object property (`memusage_stats_list') that
objects can specify is a Lisp object and gets staticpro()ed so it
only needs to be set during dump time, but because it references
symbols that might not exist in a syms_of_() function, we
initialize it in vars_of_(). There is also an object property
(`num_extra_memusage_stats') that is automatically initialized based
on `memusage_stats_list'; we do that in reinit_vars_of_alloc(),
which is called after all vars_of_() functions are called.
`disksaver' method was renamed `disksave' to correspond with the
name normally given to the function (e.g. disksave_lstream()).
(2) Generalize the memory-usage mechanism in `buffer-memory-usage',
`window-memory-usage', `charset-memory-usage' into an object-type-
specific mechanism called by a single function
`object-memory-usage'. (Former function `object-memory-usage'
renamed to `total-object-memory-usage'). Generalize the mechanism
of different "slices" so that we can have different "classes" of
memory described and different "slices" onto each class; `t'
separates classes, `nil' separates slices. Currently we have
three classes defined: the memory of an object itself,
non-Lisp-object memory associated with the object (e.g. arrays or
dynarrs stored as fields in the object), and Lisp-object memory
associated with the object (other internal Lisp objects stored in
the object). This isn't completely finished yet and we might need
to further separate the "other internal Lisp objects" class into
two classes.
The memory-usage mechanism uses a `struct usage_stats' (renamed
from `struct overhead_stats') to describe a malloc-view onto a set
of allocated memory (listing how much was requested and various
types of overhead) and a more general `struct generic_usage_stats'
(with a `struct usage_stats' in it) to hold all statistics about
object memory. `struct generic_usage_stats' contains an array of
32 Bytecounts, which are statistics of unspecified semantics. The
intention is that individual types declare a corresponding struct
(e.g. `struct window_stats') with the same structure but with
specific fields in place of the array, corresponding to specific
statistics. The number of such statistics is an object property
computed from the list of tags (Lisp symbols describing the
statistics) stored in `memusage_stats_list'. The idea here is to
allow particular object types to customize the number and
semantics of the statistics where completely avoiding consing.
This doesn't matter so much yet, but the intention is to have the
memory usage of all objects computed at the end of GC, at the same
time as other statistics are currently computed. The values for
all statistics for a single type would be added up to compute
aggregate values for all objects of a specific type. To make this
efficient, we can't allow any memory allocation at all.
(3) Create some additional functions for creating lists that
specify the elements directly as args rather than indirectly through
an array: listn() (number of args given), listu() (list terminated
by Qunbound).
(4) Delete a bit of remaining unused C window_config stuff, also
unused lrecord_type_popup_data.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Thu, 18 Mar 2010 10:50:06 -0500 |
parents | a9c41067dd88 |
children | 18c0b5909d16 |
rev | line source |
---|---|
800 | 1 /* Generic glyph data structures + display tables |
428 | 2 Copyright (C) 1994 Board of Trustees, University of Illinois. |
826 | 3 Copyright (C) 1995, 1996, 2002 Ben Wing |
428 | 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 | |
440 | 24 #ifndef INCLUDED_glyphs_h_ |
25 #define INCLUDED_glyphs_h_ | |
428 | 26 |
27 #include "specifier.h" | |
872 | 28 #include "window-impl.h" /* need for GLYPH_CACHEL_WIDTH */ |
428 | 29 |
30 /************************************************************************/ | |
31 /* Image Instantiators */ | |
32 /************************************************************************/ | |
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 | |
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 | |
51 bmp color-pixmap | |
52 cursor-font pointer | |
442 | 53 mswindows-resource pointer, color-pixmap |
428 | 54 font pointer |
55 subwindow subwindow | |
56 inherit mono-pixmap | |
57 autodetect mono-pixmap, color-pixmap, pointer, text | |
440 | 58 button widget |
428 | 59 edit-field widget |
442 | 60 combo-box widget |
428 | 61 progress-gauge widget |
62 tab-control widget | |
63 tree-view widget | |
64 scrollbar widget | |
442 | 65 label widget |
66 layout widget | |
67 native-layout widget | |
428 | 68 */ |
69 | |
70 /* These are methods specific to a particular format of image instantiator | |
71 (e.g. xpm, string, etc.). */ | |
72 | |
73 typedef struct ii_keyword_entry ii_keyword_entry; | |
74 struct ii_keyword_entry | |
75 { | |
76 Lisp_Object keyword; | |
77 void (*validate) (Lisp_Object data); | |
78 int multiple_p; | |
434 | 79 int copy_p; |
428 | 80 }; |
81 | |
82 typedef struct | |
83 { | |
84 Dynarr_declare (ii_keyword_entry); | |
85 } ii_keyword_entry_dynarr; | |
86 | |
1204 | 87 extern const struct sized_memory_description iim_description; |
428 | 88 |
438 | 89 enum image_instance_geometry |
90 { | |
91 IMAGE_GEOMETRY, | |
92 IMAGE_DESIRED_GEOMETRY, | |
93 IMAGE_MIN_GEOMETRY, | |
442 | 94 IMAGE_MAX_GEOMETRY |
438 | 95 }; |
96 | |
442 | 97 #define IMAGE_UNSPECIFIED_GEOMETRY -1 |
98 #define IMAGE_UNCHANGED_GEOMETRY -2 | |
99 | |
863 | 100 #define DEFAULT_WIDGET_BORDER_WIDTH 2 |
101 #define DEFAULT_WIDGET_SPACING 3 | |
102 #define DEFAULT_WIDGET_SHADOW_WIDTH 2 | |
438 | 103 |
442 | 104 enum governing_domain |
105 { | |
106 GOVERNING_DOMAIN_WINDOW, | |
107 GOVERNING_DOMAIN_FRAME, | |
108 GOVERNING_DOMAIN_DEVICE | |
109 }; | |
110 | |
428 | 111 struct image_instantiator_methods |
112 { | |
113 Lisp_Object symbol; | |
114 | |
115 Lisp_Object device; /* sometimes used */ | |
116 | |
117 ii_keyword_entry_dynarr *keywords; | |
118 /* consoles this ii is supported on */ | |
119 console_type_entry_dynarr *consoles; | |
120 /* Implementation specific methods: */ | |
121 | |
122 /* Validate method: Given an instantiator vector, signal an error if | |
123 it's invalid for this image-instantiator format. Note that this | |
124 validation only occurs after all the keyword-specific validation | |
125 has already been performed. This is chiefly useful for making | |
126 sure that certain required keywords are present. */ | |
127 void (*validate_method) (Lisp_Object instantiator); | |
128 | |
129 /* Normalize method: Given an instantiator, convert it to the form | |
130 that should be used in a glyph, for devices of type CONSOLE_TYPE. | |
131 Signal an error if conversion fails. */ | |
132 Lisp_Object (*normalize_method) (Lisp_Object instantiator, | |
442 | 133 Lisp_Object console_type, |
134 Lisp_Object dest_mask); | |
135 | |
136 /* Governing domain method: Return an int indicating what type of | |
137 domain an instance in this format is governed by. */ | |
138 int (*governing_domain_method) (void); | |
428 | 139 |
140 /* Possible-dest-types method: Return a mask indicating what dest types | |
141 are compatible with this format. */ | |
142 int (*possible_dest_types_method) (void); | |
143 | |
144 /* Instantiate method: Given an instantiator and a partially | |
145 filled-in image instance, complete the filling-in. Return | |
146 non-zero if the instantiation succeeds, 0 if it fails. | |
147 This must be present. */ | |
148 void (*instantiate_method) (Lisp_Object image_instance, | |
149 Lisp_Object instantiator, | |
150 Lisp_Object pointer_fg, | |
151 Lisp_Object pointer_bg, | |
152 int dest_mask, | |
153 Lisp_Object domain); | |
442 | 154 /* Post instantiate method: finish instantiation of the image |
155 instance. */ | |
156 void (*post_instantiate_method) (Lisp_Object image_instance, | |
157 Lisp_Object instantiator, | |
158 Lisp_Object domain); | |
428 | 159 /* Property method: Given an image instance, return device specific |
160 properties. */ | |
161 Lisp_Object (*property_method) (Lisp_Object image_instance, | |
162 Lisp_Object property); | |
163 /* Set-property method: Given an image instance, set device specific | |
164 properties. */ | |
165 Lisp_Object (*set_property_method) (Lisp_Object image_instance, | |
166 Lisp_Object property, | |
167 Lisp_Object val); | |
442 | 168 /* Asynchronously update properties. */ |
169 void (*update_method) (Lisp_Object image_instance, | |
170 Lisp_Object instantiator); | |
171 void (*redisplay_method) (Lisp_Object image_instance); | |
434 | 172 |
438 | 173 /* Find out the desired geometry, as given by disp, of this image |
174 instance. Actual geometry is stored in the appropriate slots in the | |
175 image instance. */ | |
434 | 176 void (*query_geometry_method) (Lisp_Object image_instance, |
442 | 177 int* width, int* height, |
440 | 178 enum image_instance_geometry disp, |
438 | 179 Lisp_Object domain); |
440 | 180 |
438 | 181 /* Layout the instance and its children bounded by the provided |
442 | 182 dimensions. Returns success or failure. */ |
183 int (*layout_method) (Lisp_Object image_instance, | |
184 int width, int height, int xoffset, int yoffset, | |
185 Lisp_Object domain); | |
428 | 186 }; |
187 | |
188 /***** Calling an image-instantiator method *****/ | |
189 | |
190 #define HAS_IIFORMAT_METH_P(mstruc, m) (((mstruc)->m##_method) != 0) | |
191 #define IIFORMAT_METH(mstruc, m, args) (((mstruc)->m##_method) args) | |
192 | |
193 /* Call a void-returning specifier method, if it exists */ | |
194 #define MAYBE_IIFORMAT_METH(mstruc, m, args) \ | |
195 do { \ | |
196 struct image_instantiator_methods *MIM_mstruc = (mstruc); \ | |
197 if (MIM_mstruc && HAS_IIFORMAT_METH_P (MIM_mstruc, m)) \ | |
198 IIFORMAT_METH (MIM_mstruc, m, args); \ | |
199 } while (0) | |
200 | |
201 #define MAYBE_IIFORMAT_DEVMETH(device, mstruc, m, args) \ | |
202 do { \ | |
203 struct image_instantiator_methods *MID_mstruc = \ | |
204 decode_ii_device (device, mstruc); \ | |
205 if (MID_mstruc) \ | |
206 MAYBE_IIFORMAT_METH(MID_mstruc, m, args); \ | |
207 } while (0) | |
208 | |
209 | |
210 /* Call a specifier method, if it exists; otherwise return | |
211 the specified value */ | |
212 | |
213 #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ | |
442 | 214 ((mstruc && HAS_IIFORMAT_METH_P (mstruc, m)) ? \ |
428 | 215 IIFORMAT_METH (mstruc, m, args) : (given)) |
216 | |
217 /***** Defining new image-instantiator types *****/ | |
218 | |
219 #define DECLARE_IMAGE_INSTANTIATOR_FORMAT(format) \ | |
220 extern struct image_instantiator_methods *format##_image_instantiator_methods | |
221 | |
222 #define DEFINE_IMAGE_INSTANTIATOR_FORMAT(format) \ | |
223 struct image_instantiator_methods *format##_image_instantiator_methods | |
224 | |
225 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name) \ | |
452 | 226 do { \ |
227 format##_image_instantiator_methods = \ | |
228 xnew_and_zero (struct image_instantiator_methods); \ | |
229 format##_image_instantiator_methods->symbol = Q##format; \ | |
230 format##_image_instantiator_methods->device = Qnil; \ | |
231 format##_image_instantiator_methods->keywords = \ | |
232 Dynarr_new (ii_keyword_entry); \ | |
233 format##_image_instantiator_methods->consoles = \ | |
234 Dynarr_new (console_type_entry); \ | |
235 add_entry_to_image_instantiator_format_list \ | |
236 (Q##format, format##_image_instantiator_methods); \ | |
2367 | 237 dump_add_root_block_ptr (&format##_image_instantiator_methods, \ |
452 | 238 &iim_description); \ |
428 | 239 } while (0) |
240 | |
241 #define INITIALIZE_IMAGE_INSTANTIATOR_FORMAT(format, obj_name) \ | |
242 do { \ | |
243 defsymbol (&Q##format, obj_name); \ | |
244 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM(format, obj_name);\ | |
245 } while (0) | |
246 | |
247 /* Declare that image-instantiator format FORMAT has method M; used in | |
248 initialization routines */ | |
249 #define IIFORMAT_HAS_METHOD(format, m) \ | |
250 (format##_image_instantiator_methods->m##_method = format##_##m) | |
251 | |
252 #define IIFORMAT_HAS_SHARED_METHOD(format, m, type) \ | |
253 (format##_image_instantiator_methods->m##_method = type##_##m) | |
254 | |
255 /* Declare that KEYW is a valid keyword for image-instantiator format | |
256 FORMAT. VALIDATE_FUN if a function that returns whether the data | |
257 is valid. The keyword may not appear more than once. */ | |
434 | 258 #define IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, copy, multi) \ |
440 | 259 do { \ |
428 | 260 struct ii_keyword_entry entry; \ |
440 | 261 \ |
262 entry.keyword = keyw; \ | |
428 | 263 entry.validate = validate_fun; \ |
440 | 264 entry.multiple_p = multi; \ |
434 | 265 entry.copy_p = copy; \ |
428 | 266 Dynarr_add (format##_image_instantiator_methods->keywords, \ |
267 entry); \ | |
268 } while (0) | |
269 | |
434 | 270 #define IIFORMAT_VALID_KEYWORD(format, keyw, validate_fun) \ |
271 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 0) | |
272 | |
428 | 273 /* Same as IIFORMAT_VALID_KEYWORD except that the keyword may |
274 appear multiple times. */ | |
434 | 275 #define IIFORMAT_VALID_MULTI_KEYWORD(format, keyw, validate_fun) \ |
276 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 1, 1) | |
277 | |
442 | 278 /* Same as IIFORMAT_VALID_KEYWORD except that the argument is not |
434 | 279 copied by the specifier functions. This is necessary for things |
280 like callbacks etc. */ | |
281 #define IIFORMAT_VALID_NONCOPY_KEYWORD(format, keyw, validate_fun) \ | |
282 IIFORMAT_VALID_GENERIC_KEYWORD(format, keyw, validate_fun, 0, 0) | |
428 | 283 |
440 | 284 /* Declare that image-instantiator format FORMAT is supported on |
428 | 285 CONSOLE type. */ |
440 | 286 #define IIFORMAT_VALID_CONSOLE(console, format) \ |
428 | 287 do { \ |
288 struct console_type_entry entry; \ | |
289 \ | |
290 entry.symbol = Q##console; \ | |
291 entry.meths = console##_console_methods; \ | |
292 Dynarr_add (format##_image_instantiator_methods->consoles, \ | |
293 entry); \ | |
294 } while (0) | |
295 | |
442 | 296 #define IIFORMAT_VALID_CONSOLE2(con1, con2, format) \ |
297 IIFORMAT_VALID_CONSOLE (con1, format); \ | |
298 IIFORMAT_VALID_CONSOLE (con2, format); | |
299 | |
440 | 300 #define DEFINE_DEVICE_IIFORMAT(type, format) \ |
301 DECLARE_IMAGE_INSTANTIATOR_FORMAT(format); \ | |
428 | 302 struct image_instantiator_methods *type##_##format##_image_instantiator_methods |
303 | |
647 | 304 #define INITIALIZE_DEVICE_IIFORMAT(type, format) \ |
305 do { \ | |
306 type##_##format##_image_instantiator_methods = \ | |
307 xnew_and_zero (struct image_instantiator_methods); \ | |
308 type##_##format##_image_instantiator_methods->symbol = Q##format; \ | |
309 type##_##format##_image_instantiator_methods->device = Q##type; \ | |
310 type##_##format##_image_instantiator_methods->keywords = \ | |
311 Dynarr_new (ii_keyword_entry); \ | |
312 add_entry_to_device_ii_format_list \ | |
313 (Q##type, Q##format, type##_##format##_image_instantiator_methods); \ | |
314 IIFORMAT_VALID_CONSOLE(type,format); \ | |
2367 | 315 dump_add_root_block_ptr (&type##_##format##_image_instantiator_methods, \ |
647 | 316 &iim_description); \ |
428 | 317 } while (0) |
318 | |
319 /* Declare that image-instantiator format FORMAT has method M; used in | |
320 initialization routines */ | |
321 #define IIFORMAT_HAS_DEVMETHOD(type, format, m) \ | |
322 (type##_##format##_image_instantiator_methods->m##_method = type##_##format##_##m) | |
323 #define IIFORMAT_HAS_SHARED_DEVMETHOD(type, format, m, fromformat) \ | |
324 (type##_##format##_image_instantiator_methods->m##_method = type##_##fromformat##_##m) | |
325 | |
442 | 326 #define IIFORMAT_INHERITS_DEVMETHOD(type, from, format, m) \ |
327 (type##_##format##_image_instantiator_methods->m##_method = from##_##format##_##m) | |
328 #define IIFORMAT_INHERITS_SHARED_DEVMETHOD(type, from, format, m, fromformat) \ | |
329 (type##_##format##_image_instantiator_methods->m##_method = from##_##fromformat##_##m) | |
330 | |
450 | 331 #define INSTANTIATOR_TYPE(inst) (XVECTOR_DATA ((inst))[0]) |
332 | |
826 | 333 struct image_instantiator_methods *decode_device_ii_format (Lisp_Object device, |
334 Lisp_Object format, | |
335 Error_Behavior | |
336 errb); | |
337 struct image_instantiator_methods *decode_image_instantiator_format | |
338 (Lisp_Object format, Error_Behavior errb); | |
428 | 339 |
340 void add_entry_to_image_instantiator_format_list (Lisp_Object symbol, | |
826 | 341 struct |
342 image_instantiator_methods * | |
343 meths); | |
344 void add_entry_to_device_ii_format_list (Lisp_Object device, | |
345 Lisp_Object symbol, | |
346 struct image_instantiator_methods * | |
347 meths); | |
428 | 348 Lisp_Object find_keyword_in_vector (Lisp_Object vector, |
349 Lisp_Object keyword); | |
350 Lisp_Object find_keyword_in_vector_or_given (Lisp_Object vector, | |
351 Lisp_Object keyword, | |
352 Lisp_Object default_); | |
353 Lisp_Object simple_image_type_normalize (Lisp_Object inst, | |
354 Lisp_Object console_type, | |
355 Lisp_Object image_type_tag); | |
356 Lisp_Object potential_pixmap_file_instantiator (Lisp_Object instantiator, | |
357 Lisp_Object file_keyword, | |
358 Lisp_Object data_keyword, | |
359 Lisp_Object console_type); | |
360 void check_valid_string (Lisp_Object data); | |
361 void check_valid_int (Lisp_Object data); | |
362 void check_valid_face (Lisp_Object data); | |
363 void check_valid_vector (Lisp_Object data); | |
364 | |
440 | 365 void initialize_subwindow_image_instance (Lisp_Image_Instance*); |
428 | 366 void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
367 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
368 int dest_mask, Lisp_Object domain); | |
442 | 369 int subwindow_governing_domain (void); |
438 | 370 void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
371 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
372 int dest_mask, Lisp_Object domain); | |
440 | 373 void image_instance_query_geometry (Lisp_Object image_instance, |
442 | 374 int* width, int* height, |
438 | 375 enum image_instance_geometry disp, |
376 Lisp_Object domain); | |
440 | 377 void image_instance_layout (Lisp_Object image_instance, |
442 | 378 int width, int height, int xoffset, int yoffset, |
438 | 379 Lisp_Object domain); |
442 | 380 int layout_layout (Lisp_Object image_instance, |
381 int width, int height, int xoffset, int yoffset, | |
382 Lisp_Object domain); | |
440 | 383 int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w); |
450 | 384 Lisp_Object make_image_instance_cache_hash_table (void); |
428 | 385 |
386 DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, | |
387 int given_dest_mask, | |
388 int desired_dest_mask)); | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
389 DECLARE_DOESNT_RETURN (signal_image_error (const Ascbyte *reason, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
390 Lisp_Object frob)); |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
391 DECLARE_DOESNT_RETURN (signal_image_error_2 (const Ascbyte *reason, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
392 Lisp_Object frob0, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
393 Lisp_Object frob1)); |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
394 DECLARE_DOESNT_RETURN (signal_double_image_error (const Ascbyte *reason1, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
395 const Ascbyte *reason2, |
563 | 396 Lisp_Object data)); |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
397 DECLARE_DOESNT_RETURN (signal_double_image_error_2 (const Ascbyte *reason1, |
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
398 const Ascbyte *reason2, |
563 | 399 Lisp_Object data1, |
400 Lisp_Object data2)); | |
428 | 401 |
402 /************************************************************************/ | |
403 /* Image Specifier Object */ | |
404 /************************************************************************/ | |
405 | |
406 DECLARE_SPECIFIER_TYPE (image); | |
407 #define XIMAGE_SPECIFIER(x) XSPECIFIER_TYPE (x, image) | |
408 #define IMAGE_SPECIFIERP(x) SPECIFIER_TYPEP (x, image) | |
409 #define CHECK_IMAGE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, image) | |
410 #define CONCHECK_IMAGE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, image) | |
411 | |
412 void set_image_attached_to (Lisp_Object obj, Lisp_Object face_or_glyph, | |
413 Lisp_Object property); | |
414 | |
415 struct image_specifier | |
416 { | |
417 int allowed; | |
418 Lisp_Object attachee; /* face or glyph this is attached to, or nil */ | |
419 Lisp_Object attachee_property;/* property of that face or glyph */ | |
420 }; | |
421 | |
456 | 422 #define IMAGE_SPECIFIER_DATA(g) SPECIFIER_TYPE_DATA (g, image) |
428 | 423 #define IMAGE_SPECIFIER_ALLOWED(g) (IMAGE_SPECIFIER_DATA (g)->allowed) |
424 #define IMAGE_SPECIFIER_ATTACHEE(g) (IMAGE_SPECIFIER_DATA (g)->attachee) | |
425 #define IMAGE_SPECIFIER_ATTACHEE_PROPERTY(g) \ | |
426 (IMAGE_SPECIFIER_DATA (g)->attachee_property) | |
427 | |
428 #define XIMAGE_SPECIFIER_ALLOWED(g) \ | |
429 IMAGE_SPECIFIER_ALLOWED (XIMAGE_SPECIFIER (g)) | |
430 | |
431 /************************************************************************/ | |
432 /* Image Instance Object */ | |
433 /************************************************************************/ | |
434 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
435 DECLARE_LISP_OBJECT (image_instance, Lisp_Image_Instance); |
440 | 436 #define XIMAGE_INSTANCE(x) XRECORD (x, image_instance, Lisp_Image_Instance) |
617 | 437 #define wrap_image_instance(p) wrap_record (p, image_instance) |
428 | 438 #define IMAGE_INSTANCEP(x) RECORDP (x, image_instance) |
439 #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) | |
440 #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) | |
441 | |
442 | 442 #ifdef ERROR_CHECK_GLYPHS |
443 void check_image_instance_structure (Lisp_Object instance); | |
444 void check_window_subwindow_cache (struct window* w); | |
445 #define ERROR_CHECK_IMAGE_INSTANCE(ii) \ | |
446 check_image_instance_structure (ii) | |
447 #define ERROR_CHECK_SUBWINDOW_CACHE(w) \ | |
448 check_window_subwindow_cache (w) | |
449 #else | |
450 #define ERROR_CHECK_IMAGE_INSTANCE(ii) | |
451 #define ERROR_CHECK_SUBWINDOW_CACHE(w) | |
452 #endif | |
453 | |
428 | 454 enum image_instance_type |
455 { | |
456 IMAGE_UNKNOWN, | |
457 IMAGE_NOTHING, | |
458 IMAGE_TEXT, | |
459 IMAGE_MONO_PIXMAP, | |
460 IMAGE_COLOR_PIXMAP, | |
461 IMAGE_POINTER, | |
462 IMAGE_SUBWINDOW, | |
442 | 463 IMAGE_WIDGET |
428 | 464 }; |
465 | |
466 #define IMAGE_NOTHING_MASK (1 << 0) | |
467 #define IMAGE_TEXT_MASK (1 << 1) | |
468 #define IMAGE_MONO_PIXMAP_MASK (1 << 2) | |
469 #define IMAGE_COLOR_PIXMAP_MASK (1 << 3) | |
470 #define IMAGE_POINTER_MASK (1 << 4) | |
471 #define IMAGE_SUBWINDOW_MASK (1 << 5) | |
472 #define IMAGE_WIDGET_MASK (1 << 6) | |
442 | 473 |
474 /* This depends on the fact that enums are assigned consecutive | |
475 integers starting at 0. (Remember that IMAGE_UNKNOWN is the | |
476 first enum.) I'm fairly sure this behavior is ANSI-mandated, | |
477 so there should be no portability problems here. */ | |
478 #define image_instance_type_to_mask(type) \ | |
479 ((int) (1 << ((int) (type) - 1))) | |
428 | 480 |
481 #define IMAGE_INSTANCE_TYPE_P(ii, type) \ | |
482 (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) | |
483 | |
484 #define NOTHING_IMAGE_INSTANCEP(ii) \ | |
485 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_NOTHING) | |
486 #define TEXT_IMAGE_INSTANCEP(ii) \ | |
487 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_TEXT) | |
488 #define MONO_PIXMAP_IMAGE_INSTANCEP(ii) \ | |
489 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_MONO_PIXMAP) | |
490 #define COLOR_PIXMAP_IMAGE_INSTANCEP(ii) \ | |
491 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_COLOR_PIXMAP) | |
492 #define POINTER_IMAGE_INSTANCEP(ii) \ | |
493 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_POINTER) | |
494 #define SUBWINDOW_IMAGE_INSTANCEP(ii) \ | |
495 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) | |
496 #define WIDGET_IMAGE_INSTANCEP(ii) \ | |
497 IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) | |
498 | |
440 | 499 #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ |
500 CHECK_IMAGE_INSTANCE (x); \ | |
428 | 501 if (!NOTHING_IMAGE_INSTANCEP (x)) \ |
502 x = wrong_type_argument (Qnothing_image_instance_p, (x)); \ | |
503 } while (0) | |
504 | |
440 | 505 #define CHECK_TEXT_IMAGE_INSTANCE(x) do { \ |
506 CHECK_IMAGE_INSTANCE (x); \ | |
428 | 507 if (!TEXT_IMAGE_INSTANCEP (x)) \ |
508 x = wrong_type_argument (Qtext_image_instance_p, (x)); \ | |
509 } while (0) | |
510 | |
511 #define CHECK_MONO_PIXMAP_IMAGE_INSTANCE(x) do { \ | |
512 CHECK_IMAGE_INSTANCE (x); \ | |
513 if (!MONO_PIXMAP_IMAGE_INSTANCEP (x)) \ | |
514 x = wrong_type_argument (Qmono_pixmap_image_instance_p, (x)); \ | |
515 } while (0) | |
516 | |
440 | 517 #define CHECK_COLOR_PIXMAP_IMAGE_INSTANCE(x) do { \ |
518 CHECK_IMAGE_INSTANCE (x); \ | |
428 | 519 if (!COLOR_PIXMAP_IMAGE_INSTANCEP (x)) \ |
520 x = wrong_type_argument (Qcolor_pixmap_image_instance_p, (x)); \ | |
521 } while (0) | |
522 | |
440 | 523 #define CHECK_POINTER_IMAGE_INSTANCE(x) do { \ |
524 CHECK_IMAGE_INSTANCE (x); \ | |
428 | 525 if (!POINTER_IMAGE_INSTANCEP (x)) \ |
526 x = wrong_type_argument (Qpointer_image_instance_p, (x)); \ | |
527 } while (0) | |
528 | |
440 | 529 #define CHECK_SUBWINDOW_IMAGE_INSTANCE(x) do { \ |
428 | 530 CHECK_IMAGE_INSTANCE (x); \ |
531 if (!SUBWINDOW_IMAGE_INSTANCEP (x) \ | |
532 && !WIDGET_IMAGE_INSTANCEP (x)) \ | |
533 x = wrong_type_argument (Qsubwindow_image_instance_p, (x)); \ | |
534 } while (0) | |
535 | |
440 | 536 #define CHECK_WIDGET_IMAGE_INSTANCE(x) do { \ |
537 CHECK_IMAGE_INSTANCE (x); \ | |
428 | 538 if (!WIDGET_IMAGE_INSTANCEP (x)) \ |
539 x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ | |
540 } while (0) | |
541 | |
1204 | 542 struct text_image_instance |
543 { | |
544 int descent; | |
545 Lisp_Object string; | |
546 }; | |
547 | |
548 struct pixmap_image_instance | |
549 { /* used for pointers as well */ | |
550 int depth; | |
551 int slice, maxslice, timeout; | |
552 Lisp_Object hotspot_x, hotspot_y; /* integer or Qnil */ | |
553 Lisp_Object filename; /* string or Qnil */ | |
554 Lisp_Object mask_filename; /* string or Qnil */ | |
555 Lisp_Object fg, bg; /* foreground and background colors, | |
556 if this is a colorized mono-pixmap | |
557 or a pointer */ | |
558 Lisp_Object auxdata; /* list or Qnil: any additional data | |
559 to be seen from lisp */ | |
560 void* mask; /* mask that can be seen from all windowing systems */ | |
561 }; | |
562 | |
563 struct subwindow_image_instance | |
564 { | |
565 void* subwindow; /* specific devices can use this as necessary */ | |
566 struct | |
567 { /* We need these so we can do without | |
568 subwindow_cachel */ | |
569 int x, y; | |
570 int width, height; | |
571 } display_data; | |
572 unsigned int being_displayed : 1; /* used to detect when needs | |
573 to be unmapped */ | |
574 unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ | |
575 unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ | |
576 unsigned int orientation : 1; /* Vertical or horizontal. */ | |
577 unsigned int h_justification : 2; /* left, right or center. */ | |
578 unsigned int v_justification : 2; /* top, bottom or center. */ | |
579 /* Face for colors and font. We specify this here because we | |
580 want people to be able to put :face in the instantiator | |
581 spec. Using glyph-face is more inconvenient, although more | |
582 general. */ | |
583 Lisp_Object face; | |
584 Lisp_Object type; | |
585 Lisp_Object props; /* properties or border*/ | |
586 Lisp_Object items; /* a list of displayed gui_items */ | |
587 Lisp_Object pending_items; /* gui_items that should be displayed */ | |
588 Lisp_Object children; /* a list of children */ | |
589 Lisp_Object width; /* dynamic width spec. */ | |
590 Lisp_Object height; /* dynamic height spec. */ | |
591 /* Change flags to augment dirty. */ | |
592 unsigned int face_changed : 1; | |
593 unsigned int items_changed : 1; | |
594 unsigned int action_occurred : 1; | |
595 }; | |
596 | |
428 | 597 struct Lisp_Image_Instance |
598 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
599 NORMAL_LISP_OBJECT_HEADER header; |
442 | 600 Lisp_Object domain; /* The domain in which we were cached. */ |
601 Lisp_Object device; /* The device of the domain. Recorded | |
602 since the domain may get deleted | |
603 before us. */ | |
428 | 604 Lisp_Object name; |
438 | 605 /* The glyph from which we were instantiated. This is a weak |
606 reference. */ | |
442 | 607 Lisp_Object parent; |
608 /* The instantiator from which we were instantiated. */ | |
609 Lisp_Object instantiator; | |
428 | 610 enum image_instance_type type; |
647 | 611 int x_offset, y_offset; /* for layout purposes */ |
442 | 612 int width, height, margin_width; |
665 | 613 Hashcode display_hash; /* Hash value representing the structure |
647 | 614 of the image_instance when it was |
615 last displayed. */ | |
428 | 616 unsigned int dirty : 1; |
442 | 617 unsigned int size_changed : 1; |
618 unsigned int text_changed : 1; | |
619 unsigned int layout_changed : 1; | |
620 unsigned int optimize_output : 1; /* For outputting layouts. */ | |
621 unsigned int initialized : 1; /* When we're fully done. */ | |
622 unsigned int wants_initial_focus : 1; | |
623 | |
428 | 624 union |
625 { | |
1204 | 626 struct text_image_instance text; |
627 struct pixmap_image_instance pixmap; /* used for pointers as well */ | |
628 struct subwindow_image_instance subwindow; | |
428 | 629 } u; |
630 | |
631 /* console-type- and image-type-specific data */ | |
632 void *data; | |
633 }; | |
634 | |
438 | 635 /* Layout bit-fields. */ |
636 #define LAYOUT_HORIZONTAL 0 | |
637 #define LAYOUT_VERTICAL 1 | |
638 | |
639 #define LAYOUT_JUSTIFY_LEFT 0 | |
863 | 640 #define LAYOUT_JUSTIFY_TOP 0 |
438 | 641 #define LAYOUT_JUSTIFY_RIGHT 1 |
863 | 642 #define LAYOUT_JUSTIFY_BOTTOM 1 |
438 | 643 #define LAYOUT_JUSTIFY_CENTER 2 |
644 | |
442 | 645 #define IMAGE_INSTANCE_HASH_DEPTH 0 |
646 | |
438 | 647 /* Accessor macros. */ |
442 | 648 #define IMAGE_INSTANCE_DOMAIN(i) ((i)->domain) |
649 #define IMAGE_INSTANCE_DOMAIN_LIVE_P(i) (DOMAIN_LIVE_P ((i)->domain)) | |
428 | 650 #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) |
442 | 651 #define IMAGE_INSTANCE_FRAME(i) (DOMAIN_FRAME ((i)->domain)) |
428 | 652 #define IMAGE_INSTANCE_NAME(i) ((i)->name) |
442 | 653 #define IMAGE_INSTANCE_PARENT(i) ((i)->parent) |
654 #define IMAGE_INSTANCE_INSTANTIATOR(i) ((i)->instantiator) | |
655 #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i)) | |
428 | 656 #define IMAGE_INSTANCE_TYPE(i) ((i)->type) |
657 #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) | |
658 #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) | |
434 | 659 #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) |
442 | 660 #define IMAGE_INSTANCE_MARGIN_WIDTH(i) ((i)->margin_width) |
434 | 661 #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) |
442 | 662 #define IMAGE_INSTANCE_INITIALIZED(i) ((i)->initialized) |
663 #define IMAGE_INSTANCE_DISPLAY_HASH(i) ((i)->display_hash) | |
440 | 664 #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ |
665 ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ | |
428 | 666 || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) |
667 #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) | |
442 | 668 #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \ |
669 ((IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) \ | |
670 || (FRAMEP (IMAGE_INSTANCE_FRAME (i)) \ | |
671 && XFRAME (IMAGE_INSTANCE_FRAME (i))->size_changed)) | |
438 | 672 #define IMAGE_INSTANCE_FACE(i) \ |
442 | 673 (GLYPHP (IMAGE_INSTANCE_GLYPH (i)) ? \ |
674 XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) : Qnil) | |
675 #define IMAGE_INSTANCE_WANTS_INITIAL_FOCUS(i) ((i)->wants_initial_focus) | |
428 | 676 |
442 | 677 /* Changed flags */ |
678 #define IMAGE_INSTANCE_TEXT_CHANGED(i) ((i)->text_changed) | |
679 #define IMAGE_INSTANCE_SIZE_CHANGED(i) ((i)->size_changed) | |
680 #define IMAGE_INSTANCE_WIDGET_FACE_CHANGED(i) \ | |
681 ((i)->u.subwindow.face_changed) | |
682 #define IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED(i) \ | |
683 ((i)->u.subwindow.items_changed) | |
684 #define IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(i) \ | |
685 ((i)->u.subwindow.action_occurred) | |
686 #define IMAGE_INSTANCE_LAYOUT_CHANGED(i) ((i)->layout_changed) | |
687 #define IMAGE_INSTANCE_OPTIMIZE_OUTPUT(i) ((i)->optimize_output) | |
688 | |
689 /* Text properties */ | |
428 | 690 #define IMAGE_INSTANCE_TEXT_STRING(i) ((i)->u.text.string) |
434 | 691 #define IMAGE_INSTANCE_TEXT_WIDTH(i) \ |
692 IMAGE_INSTANCE_WIDTH(i) | |
693 #define IMAGE_INSTANCE_TEXT_HEIGHT(i) \ | |
694 IMAGE_INSTANCE_HEIGHT(i) | |
695 #define IMAGE_INSTANCE_TEXT_DESCENT(i) ((i)->u.text.descent) | |
438 | 696 #define IMAGE_INSTANCE_TEXT_ASCENT(i) \ |
697 (IMAGE_INSTANCE_TEXT_HEIGHT(i) - IMAGE_INSTANCE_TEXT_DESCENT(i)) | |
428 | 698 |
442 | 699 /* Pixmap properties */ |
434 | 700 #define IMAGE_INSTANCE_PIXMAP_WIDTH(i) \ |
701 IMAGE_INSTANCE_WIDTH(i) | |
702 #define IMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ | |
703 IMAGE_INSTANCE_HEIGHT(i) | |
428 | 704 #define IMAGE_INSTANCE_PIXMAP_DEPTH(i) ((i)->u.pixmap.depth) |
705 #define IMAGE_INSTANCE_PIXMAP_FILENAME(i) ((i)->u.pixmap.filename) | |
706 #define IMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) ((i)->u.pixmap.mask_filename) | |
707 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) ((i)->u.pixmap.hotspot_x) | |
708 #define IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) ((i)->u.pixmap.hotspot_y) | |
709 #define IMAGE_INSTANCE_PIXMAP_FG(i) ((i)->u.pixmap.fg) | |
710 #define IMAGE_INSTANCE_PIXMAP_BG(i) ((i)->u.pixmap.bg) | |
711 #define IMAGE_INSTANCE_PIXMAP_AUXDATA(i) ((i)->u.pixmap.auxdata) | |
712 #define IMAGE_INSTANCE_PIXMAP_MASK(i) ((i)->u.pixmap.mask) | |
713 #define IMAGE_INSTANCE_PIXMAP_SLICE(i) ((i)->u.pixmap.slice) | |
714 #define IMAGE_INSTANCE_PIXMAP_MAXSLICE(i) ((i)->u.pixmap.maxslice) | |
715 #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) | |
716 | |
442 | 717 /* Subwindow properties */ |
428 | 718 #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) |
442 | 719 /* Display data. */ |
720 #define IMAGE_INSTANCE_DISPLAY_X(i) ((i)->u.subwindow.display_data.x) | |
721 #define IMAGE_INSTANCE_DISPLAY_Y(i) ((i)->u.subwindow.display_data.y) | |
722 #define IMAGE_INSTANCE_DISPLAY_WIDTH(i) \ | |
723 ((i)->u.subwindow.display_data.width) | |
724 #define IMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ | |
725 ((i)->u.subwindow.display_data.height) | |
428 | 726 #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
727 ((i)->u.subwindow.being_displayed) | |
438 | 728 #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \ |
729 ((i)->u.subwindow.v_resize) | |
730 #define IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP(i) \ | |
731 ((i)->u.subwindow.h_resize) | |
732 #define IMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ | |
733 ((i)->u.subwindow.orientation) | |
863 | 734 #define IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) \ |
735 ((i)->u.subwindow.h_justification) | |
736 #define IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) \ | |
737 ((i)->u.subwindow.v_justification) | |
738 #define IMAGE_INSTANCE_SUBWINDOW_RIGHT_JUSTIFIED(i) \ | |
739 (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_RIGHT) | |
740 #define IMAGE_INSTANCE_SUBWINDOW_LEFT_JUSTIFIED(i) \ | |
741 (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_LEFT) | |
742 #define IMAGE_INSTANCE_SUBWINDOW_TOP_JUSTIFIED(i) \ | |
743 (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_TOP) | |
744 #define IMAGE_INSTANCE_SUBWINDOW_BOTTOM_JUSTIFIED(i) \ | |
745 (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_BOTTOM) | |
746 #define IMAGE_INSTANCE_SUBWINDOW_H_CENTERED(i) \ | |
747 (IMAGE_INSTANCE_SUBWINDOW_H_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER) | |
748 #define IMAGE_INSTANCE_SUBWINDOW_V_CENTERED(i) \ | |
749 (IMAGE_INSTANCE_SUBWINDOW_V_JUSTIFY(i) == LAYOUT_JUSTIFY_CENTER) | |
750 #define IMAGE_INSTANCE_SUBWINDOW_LOGICAL_LAYOUT(i) \ | |
751 (IMAGE_INSTANCE_SUBWINDOW_ORIENT (i) \ | |
752 == LAYOUT_VERTICAL && !IMAGE_INSTANCE_SUBWINDOW_V_CENTERED (i)) | |
753 | |
442 | 754 #define IMAGE_INSTANCE_SUBWINDOW_FACE(i) \ |
755 ((i)->u.subwindow.face) | |
428 | 756 |
442 | 757 /* Widget properties */ |
428 | 758 #define IMAGE_INSTANCE_WIDGET_WIDTH(i) \ |
434 | 759 IMAGE_INSTANCE_WIDTH(i) |
428 | 760 #define IMAGE_INSTANCE_WIDGET_HEIGHT(i) \ |
434 | 761 IMAGE_INSTANCE_HEIGHT(i) |
442 | 762 #define IMAGE_INSTANCE_WIDGET_WIDTH_SUBR(i) ((i)->u.subwindow.width) |
763 #define IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR(i) ((i)->u.subwindow.height) | |
440 | 764 #define IMAGE_INSTANCE_WIDGET_TYPE(i) ((i)->u.subwindow.type) |
765 #define IMAGE_INSTANCE_WIDGET_PROPS(i) ((i)->u.subwindow.props) | |
438 | 766 #define SET_IMAGE_INSTANCE_WIDGET_FACE(i,f) \ |
440 | 767 ((i)->u.subwindow.face = f) |
768 #define IMAGE_INSTANCE_WIDGET_FACE(i) \ | |
769 (!NILP ((i)->u.subwindow.face) ? (i)->u.subwindow.face : \ | |
770 !NILP (IMAGE_INSTANCE_FACE (i)) ? IMAGE_INSTANCE_FACE (i) : \ | |
438 | 771 Vwidget_face) |
440 | 772 #define IMAGE_INSTANCE_WIDGET_ITEMS(i) ((i)->u.subwindow.items) |
442 | 773 #define IMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \ |
774 ((i)->u.subwindow.pending_items) | |
440 | 775 #define IMAGE_INSTANCE_WIDGET_ITEM(i) \ |
444 | 776 (CONSP (IMAGE_INSTANCE_WIDGET_ITEMS (i)) ? \ |
777 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (i)) : \ | |
778 IMAGE_INSTANCE_WIDGET_ITEMS (i)) | |
779 #define IMAGE_INSTANCE_WIDGET_TEXT(i) \ | |
780 XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name | |
428 | 781 |
442 | 782 /* Layout properties */ |
783 #define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.children) | |
440 | 784 #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props) |
428 | 785 |
442 | 786 #define XIMAGE_INSTANCE_DOMAIN(i) \ |
787 IMAGE_INSTANCE_DOMAIN (XIMAGE_INSTANCE (i)) | |
788 #define XIMAGE_INSTANCE_DOMAIN_LIVE_P(i) \ | |
789 IMAGE_INSTANCE_DOMAIN_LIVE_P (XIMAGE_INSTANCE (i)) | |
428 | 790 #define XIMAGE_INSTANCE_DEVICE(i) \ |
791 IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) | |
442 | 792 #define XIMAGE_INSTANCE_FRAME(i) \ |
793 IMAGE_INSTANCE_FRAME (XIMAGE_INSTANCE (i)) | |
428 | 794 #define XIMAGE_INSTANCE_NAME(i) \ |
795 IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) | |
438 | 796 #define XIMAGE_INSTANCE_GLYPH(i) \ |
797 IMAGE_INSTANCE_GLYPH (XIMAGE_INSTANCE (i)) | |
442 | 798 #define XIMAGE_INSTANCE_PARENT(i) \ |
799 IMAGE_INSTANCE_PARENT (XIMAGE_INSTANCE (i)) | |
800 #define XIMAGE_INSTANCE_INSTANTIATOR(i) \ | |
801 IMAGE_INSTANCE_INSTANTIATOR (XIMAGE_INSTANCE (i)) | |
428 | 802 #define XIMAGE_INSTANCE_TYPE(i) \ |
803 IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (i)) | |
442 | 804 #define XIMAGE_INSTANCE_DISPLAY_HASH(i) \ |
805 IMAGE_INSTANCE_DISPLAY_HASH (XIMAGE_INSTANCE (i)) | |
428 | 806 #define XIMAGE_INSTANCE_XOFFSET(i) \ |
807 IMAGE_INSTANCE_XOFFSET (XIMAGE_INSTANCE (i)) | |
808 #define XIMAGE_INSTANCE_YOFFSET(i) \ | |
809 IMAGE_INSTANCE_YOFFSET (XIMAGE_INSTANCE (i)) | |
810 #define XIMAGE_INSTANCE_DIRTYP(i) \ | |
811 IMAGE_INSTANCE_DIRTYP (XIMAGE_INSTANCE (i)) | |
442 | 812 #define XIMAGE_INSTANCE_NEEDS_LAYOUT(i) \ |
813 IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i)) | |
438 | 814 #define XIMAGE_INSTANCE_WIDTH(i) \ |
815 IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i)) | |
442 | 816 #define XIMAGE_INSTANCE_MARGIN_WIDTH(i) \ |
817 IMAGE_INSTANCE_MARGIN_WIDTH (XIMAGE_INSTANCE (i)) | |
438 | 818 #define XIMAGE_INSTANCE_HEIGHT(i) \ |
819 IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i)) | |
442 | 820 #define XIMAGE_INSTANCE_INITIALIZED(i) \ |
821 IMAGE_INSTANCE_INITIALIZED (XIMAGE_INSTANCE (i)) | |
438 | 822 #define XIMAGE_INSTANCE_FACE(i) \ |
823 IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i)) | |
428 | 824 |
825 #define XIMAGE_INSTANCE_TEXT_STRING(i) \ | |
826 IMAGE_INSTANCE_TEXT_STRING (XIMAGE_INSTANCE (i)) | |
438 | 827 #define XIMAGE_INSTANCE_TEXT_WIDTH(i) \ |
828 IMAGE_INSTANCE_TEXT_WIDTH (XIMAGE_INSTANCE (i)) | |
829 #define XIMAGE_INSTANCE_TEXT_HEIGHT(i) \ | |
830 IMAGE_INSTANCE_TEXT_HEIGHT (XIMAGE_INSTANCE (i)) | |
831 #define XIMAGE_INSTANCE_TEXT_ASCENT(i) \ | |
832 IMAGE_INSTANCE_TEXT_ASCENT (XIMAGE_INSTANCE (i)) | |
833 #define XIMAGE_INSTANCE_TEXT_DESCENT(i) \ | |
834 IMAGE_INSTANCE_TEXT_DESCENT (XIMAGE_INSTANCE (i)) | |
428 | 835 |
836 #define XIMAGE_INSTANCE_PIXMAP_WIDTH(i) \ | |
837 IMAGE_INSTANCE_PIXMAP_WIDTH (XIMAGE_INSTANCE (i)) | |
838 #define XIMAGE_INSTANCE_PIXMAP_HEIGHT(i) \ | |
839 IMAGE_INSTANCE_PIXMAP_HEIGHT (XIMAGE_INSTANCE (i)) | |
840 #define XIMAGE_INSTANCE_PIXMAP_DEPTH(i) \ | |
841 IMAGE_INSTANCE_PIXMAP_DEPTH (XIMAGE_INSTANCE (i)) | |
842 #define XIMAGE_INSTANCE_PIXMAP_FILENAME(i) \ | |
843 IMAGE_INSTANCE_PIXMAP_FILENAME (XIMAGE_INSTANCE (i)) | |
844 #define XIMAGE_INSTANCE_PIXMAP_MASK_FILENAME(i) \ | |
845 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (XIMAGE_INSTANCE (i)) | |
846 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X(i) \ | |
847 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (XIMAGE_INSTANCE (i)) | |
848 #define XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y(i) \ | |
849 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (XIMAGE_INSTANCE (i)) | |
850 #define XIMAGE_INSTANCE_PIXMAP_FG(i) \ | |
851 IMAGE_INSTANCE_PIXMAP_FG (XIMAGE_INSTANCE (i)) | |
852 #define XIMAGE_INSTANCE_PIXMAP_BG(i) \ | |
853 IMAGE_INSTANCE_PIXMAP_BG (XIMAGE_INSTANCE (i)) | |
854 #define XIMAGE_INSTANCE_PIXMAP_MASK(i) \ | |
855 IMAGE_INSTANCE_PIXMAP_MASK (XIMAGE_INSTANCE (i)) | |
856 #define XIMAGE_INSTANCE_PIXMAP_SLICE(i) \ | |
857 IMAGE_INSTANCE_PIXMAP_SLICE (XIMAGE_INSTANCE (i)) | |
858 #define XIMAGE_INSTANCE_PIXMAP_MAXSLICE(i) \ | |
859 IMAGE_INSTANCE_PIXMAP_MAXSLICE (XIMAGE_INSTANCE (i)) | |
860 #define XIMAGE_INSTANCE_PIXMAP_TIMEOUT(i) \ | |
861 IMAGE_INSTANCE_PIXMAP_TIMEOUT (XIMAGE_INSTANCE (i)) | |
862 | |
863 #define XIMAGE_INSTANCE_WIDGET_WIDTH(i) \ | |
864 IMAGE_INSTANCE_WIDGET_WIDTH (XIMAGE_INSTANCE (i)) | |
865 #define XIMAGE_INSTANCE_WIDGET_HEIGHT(i) \ | |
866 IMAGE_INSTANCE_WIDGET_HEIGHT (XIMAGE_INSTANCE (i)) | |
442 | 867 #define XIMAGE_INSTANCE_WIDGET_WIDTH_SUBR(i) \ |
868 IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (XIMAGE_INSTANCE (i)) | |
869 #define XIMAGE_INSTANCE_WIDGET_HEIGHT_SUBR(i) \ | |
870 IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (XIMAGE_INSTANCE (i)) | |
428 | 871 #define XIMAGE_INSTANCE_WIDGET_TYPE(i) \ |
872 IMAGE_INSTANCE_WIDGET_TYPE (XIMAGE_INSTANCE (i)) | |
873 #define XIMAGE_INSTANCE_WIDGET_PROPS(i) \ | |
874 IMAGE_INSTANCE_WIDGET_PROPS (XIMAGE_INSTANCE (i)) | |
875 #define XIMAGE_INSTANCE_WIDGET_FACE(i) \ | |
876 IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i)) | |
438 | 877 #define XSET_IMAGE_INSTANCE_WIDGET_FACE(i) \ |
878 SET_IMAGE_INSTANCE_WIDGET_FACE (XIMAGE_INSTANCE (i)) | |
428 | 879 #define XIMAGE_INSTANCE_WIDGET_ITEM(i) \ |
880 IMAGE_INSTANCE_WIDGET_ITEM (XIMAGE_INSTANCE (i)) | |
881 #define XIMAGE_INSTANCE_WIDGET_ITEMS(i) \ | |
882 IMAGE_INSTANCE_WIDGET_ITEMS (XIMAGE_INSTANCE (i)) | |
442 | 883 #define XIMAGE_INSTANCE_WIDGET_PENDING_ITEMS(i) \ |
884 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (XIMAGE_INSTANCE (i)) | |
428 | 885 #define XIMAGE_INSTANCE_WIDGET_TEXT(i) \ |
886 IMAGE_INSTANCE_WIDGET_TEXT (XIMAGE_INSTANCE (i)) | |
442 | 887 #define XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED(i) \ |
888 IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (XIMAGE_INSTANCE (i)) | |
428 | 889 |
890 #define XIMAGE_INSTANCE_LAYOUT_CHILDREN(i) \ | |
891 IMAGE_INSTANCE_LAYOUT_CHILDREN (XIMAGE_INSTANCE (i)) | |
892 #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \ | |
893 IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i)) | |
894 | |
895 #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \ | |
896 IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) | |
442 | 897 #define XIMAGE_INSTANCE_DISPLAY_X(i) \ |
898 IMAGE_INSTANCE_DISPLAY_X (XIMAGE_INSTANCE (i)) | |
899 #define XIMAGE_INSTANCE_DISPLAY_Y(i) \ | |
900 IMAGE_INSTANCE_DISPLAY_Y (XIMAGE_INSTANCE (i)) | |
901 #define XIMAGE_INSTANCE_DISPLAY_WIDTH(i) \ | |
902 IMAGE_INSTANCE_DISPLAY_WIDTH (XIMAGE_INSTANCE (i)) | |
903 #define XIMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ | |
904 IMAGE_INSTANCE_DISPLAY_HEIGHT (XIMAGE_INSTANCE (i)) | |
428 | 905 #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ |
906 IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) | |
438 | 907 #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ |
908 IMAGE_INSTANCE_SUBWINDOW_ORIENT (XIMAGE_INSTANCE (i)) | |
909 #define XIMAGE_INSTANCE_SUBWINDOW_JUSTIFY(i) \ | |
910 IMAGE_INSTANCE_SUBWINDOW_JUSTIFY (XIMAGE_INSTANCE (i)) | |
442 | 911 #define XIMAGE_INSTANCE_SUBWINDOW_FACE(i) \ |
912 IMAGE_INSTANCE_SUBWINDOW_FACE (XIMAGE_INSTANCE (i)) | |
428 | 913 |
914 #define MARK_IMAGE_INSTANCE_CHANGED(i) \ | |
915 (IMAGE_INSTANCE_DIRTYP (i) = 1); | |
916 | |
442 | 917 Lisp_Object image_instance_device (Lisp_Object instance); |
918 Lisp_Object image_instance_frame (Lisp_Object instance); | |
919 Lisp_Object image_instance_window (Lisp_Object instance); | |
920 int image_instance_live_p (Lisp_Object instance); | |
921 | |
428 | 922 #ifdef HAVE_XPM |
923 Lisp_Object evaluate_xpm_color_symbols (void); | |
924 Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); | |
925 #endif /* HAVE_XPM */ | |
926 #ifdef HAVE_WINDOW_SYSTEM | |
927 Lisp_Object bitmap_to_lisp_data (Lisp_Object name, int *xhot, int *yhot, | |
928 int ok_if_data_invalid); | |
771 | 929 int read_bitmap_data_from_file (Lisp_Object filename, int *width, |
2367 | 930 int *height, Binbyte **datap, |
428 | 931 int *x_hot, int *y_hot); |
932 Lisp_Object xbm_mask_file_munging (Lisp_Object alist, Lisp_Object file, | |
933 Lisp_Object mask_file, | |
934 Lisp_Object console_type); | |
935 #endif | |
936 | |
937 /************************************************************************/ | |
938 /* Glyph Object */ | |
939 /************************************************************************/ | |
940 | |
941 enum glyph_type | |
942 { | |
943 GLYPH_UNKNOWN, | |
944 GLYPH_BUFFER, | |
945 GLYPH_POINTER, | |
946 GLYPH_ICON | |
947 }; | |
948 | |
949 struct Lisp_Glyph | |
950 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
951 NORMAL_LISP_OBJECT_HEADER header; |
428 | 952 |
953 enum glyph_type type; | |
954 | |
955 /* specifiers: */ | |
956 Lisp_Object image; /* the actual image */ | |
957 Lisp_Object contrib_p; /* whether to figure into line height */ | |
958 Lisp_Object baseline; /* percent above baseline */ | |
959 | |
960 Lisp_Object face; /* if non-nil, face to use when displaying */ | |
440 | 961 |
428 | 962 Lisp_Object plist; |
963 void (*after_change) (Lisp_Object glyph, Lisp_Object property, | |
964 Lisp_Object locale); | |
965 | |
966 unsigned int dirty : 1; /* So that we can selectively | |
967 redisplay changed glyphs. */ | |
968 }; | |
440 | 969 typedef struct Lisp_Glyph Lisp_Glyph; |
428 | 970 |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
971 DECLARE_LISP_OBJECT (glyph, Lisp_Glyph); |
440 | 972 #define XGLYPH(x) XRECORD (x, glyph, Lisp_Glyph) |
617 | 973 #define wrap_glyph(p) wrap_record (p, glyph) |
428 | 974 #define GLYPHP(x) RECORDP (x, glyph) |
975 #define CHECK_GLYPH(x) CHECK_RECORD (x, glyph) | |
976 #define CONCHECK_GLYPH(x) CONCHECK_RECORD (x, glyph) | |
977 | |
978 #define CHECK_BUFFER_GLYPH(x) do { \ | |
979 CHECK_GLYPH (x); \ | |
980 if (XGLYPH (x)->type != GLYPH_BUFFER) \ | |
981 x = wrong_type_argument (Qbuffer_glyph_p, (x)); \ | |
982 } while (0) | |
983 | |
984 #define CHECK_POINTER_GLYPH(x) do { \ | |
985 CHECK_GLYPH (x); \ | |
986 if (XGLYPH (x)->type != GLYPH_POINTER) \ | |
987 x = wrong_type_argument (Qpointer_glyph_p, (x)); \ | |
988 } while (0) | |
989 | |
990 #define CHECK_ICON_GLYPH(x) do { \ | |
991 CHECK_GLYPH (x); \ | |
992 if (XGLYPH (x)->type != GLYPH_ICON) \ | |
993 x = wrong_type_argument (Qicon_glyph_p, (x)); \ | |
994 } while (0) | |
995 | |
996 #define GLYPH_TYPE(g) ((g)->type) | |
997 #define GLYPH_IMAGE(g) ((g)->image) | |
998 #define GLYPH_CONTRIB_P(g) ((g)->contrib_p) | |
999 #define GLYPH_BASELINE(g) ((g)->baseline) | |
1000 #define GLYPH_FACE(g) ((g)->face) | |
1001 #define GLYPH_DIRTYP(g) ((g)->dirty) | |
1002 | |
1003 #define XGLYPH_TYPE(g) GLYPH_TYPE (XGLYPH (g)) | |
1004 #define XGLYPH_IMAGE(g) GLYPH_IMAGE (XGLYPH (g)) | |
1005 #define XGLYPH_CONTRIB_P(g) GLYPH_CONTRIB_P (XGLYPH (g)) | |
1006 #define XGLYPH_BASELINE(g) GLYPH_BASELINE (XGLYPH (g)) | |
1007 #define XGLYPH_FACE(g) GLYPH_FACE (XGLYPH (g)) | |
1008 #define XGLYPH_DIRTYP(g) GLYPH_DIRTYP (XGLYPH (g)) | |
1009 | |
1010 #define MARK_GLYPH_CHANGED(g) (GLYPH_DIRTYP (g) = 1); | |
1011 | |
1012 extern Lisp_Object Qxpm, Qxface, Qetched_in, Qetched_out, Qbevel_in, Qbevel_out; | |
1013 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable; | |
1014 extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar; | |
1111 | 1015 extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge; |
428 | 1016 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y; |
1111 | 1017 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_group; |
1018 extern Lisp_Object Q_pixel_width, Q_pixel_height; | |
1019 extern Lisp_Object Qimage_conversion_error; | |
428 | 1020 extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; |
1021 extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; | |
1022 extern Lisp_Object Vxemacs_logo; | |
1023 | |
442 | 1024 |
438 | 1025 unsigned short glyph_width (Lisp_Object glyph, Lisp_Object domain); |
1026 unsigned short glyph_ascent (Lisp_Object glyph, Lisp_Object domain); | |
1027 unsigned short glyph_descent (Lisp_Object glyph, Lisp_Object domain); | |
1028 unsigned short glyph_height (Lisp_Object glyph, Lisp_Object domain); | |
428 | 1029 Lisp_Object glyph_baseline (Lisp_Object glyph, Lisp_Object domain); |
1030 Lisp_Object glyph_face (Lisp_Object glyph, Lisp_Object domain); | |
1031 int glyph_contrib_p (Lisp_Object glyph, Lisp_Object domain); | |
1032 Lisp_Object glyph_image_instance (Lisp_Object glyph, | |
1033 Lisp_Object domain, | |
578 | 1034 Error_Behavior errb, int no_quit); |
428 | 1035 void file_or_data_must_be_present (Lisp_Object instantiator); |
1036 void data_must_be_present (Lisp_Object instantiator); | |
1037 Lisp_Object make_string_from_file (Lisp_Object file); | |
1038 Lisp_Object tagged_vector_to_alist (Lisp_Object vector); | |
1039 Lisp_Object alist_to_tagged_vector (Lisp_Object tag, Lisp_Object alist); | |
1040 void string_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | |
1041 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
1042 int dest_mask, Lisp_Object domain); | |
442 | 1043 int tab_control_order_only_changed (Lisp_Object image_instance); |
428 | 1044 Lisp_Object allocate_glyph (enum glyph_type type, |
1045 void (*after_change) (Lisp_Object glyph, | |
1046 Lisp_Object property, | |
1047 Lisp_Object locale)); | |
442 | 1048 Lisp_Object normalize_image_instantiator (Lisp_Object instantiator, |
1049 Lisp_Object contype, | |
1050 Lisp_Object dest_mask); | |
1051 void glyph_query_geometry (Lisp_Object glyph_or_image, int* width, int* height, | |
1052 enum image_instance_geometry disp, | |
1053 Lisp_Object domain); | |
1054 void glyph_do_layout (Lisp_Object glyph_or_image, int width, int height, | |
1055 int xoffset, int yoffset, | |
1056 Lisp_Object domain); | |
438 | 1057 void query_string_geometry ( Lisp_Object string, Lisp_Object face, |
442 | 1058 int* width, int* height, int* descent, |
1059 Lisp_Object domain); | |
440 | 1060 Lisp_Object query_string_font (Lisp_Object string, |
438 | 1061 Lisp_Object face, Lisp_Object domain); |
428 | 1062 Lisp_Object add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object device); |
1063 void disable_glyph_animated_timeout (int i); | |
1064 | |
1065 /************************************************************************/ | |
1066 /* Glyph Cachels */ | |
1067 /************************************************************************/ | |
1068 | |
1069 typedef struct glyph_cachel glyph_cachel; | |
1070 struct glyph_cachel | |
1071 { | |
3092 | 1072 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1073 NORMAL_LISP_OBJECT_HEADER header; |
3263 | 1074 #endif /* NEW_GC */ |
428 | 1075 Lisp_Object glyph; |
1076 | |
1077 unsigned int dirty :1; /* I'm copying faces here. I'm not | |
1078 sure why we need two dirty | |
1079 flags. Maybe because an image | |
1080 instance can be dirty and so we | |
1081 need to frob this in the same way | |
1082 as other image instance properties. */ | |
1083 unsigned int updated :1; | |
1084 | |
1085 unsigned short width; | |
1086 unsigned short ascent; | |
1087 unsigned short descent; | |
1088 }; | |
1089 | |
3092 | 1090 #ifdef NEW_GC |
1091 typedef struct glyph_cachel Lisp_Glyph_Cachel; | |
1092 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
1093 DECLARE_LISP_OBJECT (glyph_cachel, Lisp_Glyph_Cachel); |
3092 | 1094 |
1095 #define XGLYPH_CACHEL(x) \ | |
1096 XRECORD (x, glyph_cachel, Lisp_Glyph_Cachel) | |
1097 #define wrap_glyph_cachel(p) wrap_record (p, glyph_cachel) | |
1098 #define GLYPH_CACHEL_P(x) RECORDP (x, glyph_cachel) | |
1099 #define CHECK_GLYPH_CACHEL(x) CHECK_RECORD (x, glyph_cachel) | |
1100 #define CONCHECK_GLYPH_CACHEL(x) CONCHECK_RECORD (x, glyph_cachel) | |
1101 #endif /* NEW_GC */ | |
1102 | |
428 | 1103 #define CONT_GLYPH_INDEX (glyph_index) 0 |
1104 #define TRUN_GLYPH_INDEX (glyph_index) 1 | |
1105 #define HSCROLL_GLYPH_INDEX (glyph_index) 2 | |
1106 #define CONTROL_GLYPH_INDEX (glyph_index) 3 | |
1107 #define OCT_ESC_GLYPH_INDEX (glyph_index) 4 | |
1108 #define INVIS_GLYPH_INDEX (glyph_index) 5 | |
1109 | |
442 | 1110 #ifdef ERROR_CHECK_GLYPHS |
1111 | |
826 | 1112 DECLARE_INLINE_HEADER ( |
1113 int | |
442 | 1114 GLYPH_CACHEL_WIDTH (struct window *window, int ind) |
826 | 1115 ) |
442 | 1116 { |
1117 int wid = Dynarr_atp (window->glyph_cachels, ind)->width; | |
1118 assert (wid >= 0 && wid < 10000); | |
1119 return wid; | |
1120 } | |
826 | 1121 |
1122 DECLARE_INLINE_HEADER ( | |
1123 int | |
442 | 1124 GLYPH_CACHEL_ASCENT (struct window *window, int ind) |
826 | 1125 ) |
442 | 1126 { |
1127 int wid = Dynarr_atp (window->glyph_cachels, ind)->ascent; | |
1128 assert (wid >= 0 && wid < 10000); | |
1129 return wid; | |
1130 } | |
826 | 1131 |
1132 DECLARE_INLINE_HEADER ( | |
1133 int | |
442 | 1134 GLYPH_CACHEL_DESCENT (struct window *window, int ind) |
826 | 1135 ) |
442 | 1136 { |
1137 int wid = Dynarr_atp (window->glyph_cachels, ind)->descent; | |
1138 assert (wid >= 0 && wid < 10000); | |
1139 return wid; | |
1140 } | |
1141 | |
1142 #else /* not ERROR_CHECK_GLYPHS */ | |
1143 | |
800 | 1144 #define GLYPH_CACHEL_WIDTH(window, ind) \ |
442 | 1145 Dynarr_atp (window->glyph_cachels, ind)->width |
1146 #define GLYPH_CACHEL_ASCENT(window, ind) \ | |
1147 Dynarr_atp (window->glyph_cachels, ind)->ascent | |
1148 #define GLYPH_CACHEL_DESCENT(window, ind) \ | |
1149 Dynarr_atp (window->glyph_cachels, ind)->descent | |
1150 | |
1151 #endif /* not ERROR_CHECK_GLYPHS */ | |
1152 | |
1153 #define GLYPH_CACHEL(window, ind) \ | |
1154 Dynarr_atp (window->glyph_cachels, ind) | |
800 | 1155 #define GLYPH_CACHEL_GLYPH(window, ind) \ |
442 | 1156 Dynarr_atp (window->glyph_cachels, ind)->glyph |
1157 #define GLYPH_CACHEL_DIRTYP(window, ind) \ | |
1158 Dynarr_atp (window->glyph_cachels, ind)->dirty | |
428 | 1159 |
1160 void mark_glyph_cachels (glyph_cachel_dynarr *elements); | |
1161 void mark_glyph_cachels_as_not_updated (struct window *w); | |
1162 void mark_glyph_cachels_as_clean (struct window *w); | |
1163 void reset_glyph_cachels (struct window *w); | |
1164 glyph_index get_glyph_cachel_index (struct window *w, Lisp_Object glyph); | |
1165 | |
1166 #ifdef MEMORY_USAGE_STATS | |
1167 int compute_glyph_cachel_usage (glyph_cachel_dynarr *glyph_cachels, | |
5157
1fae11d56ad2
redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents:
5127
diff
changeset
|
1168 struct usage_stats *ustats); |
428 | 1169 #endif /* MEMORY_USAGE_STATS */ |
1170 | |
1171 /************************************************************************/ | |
1172 /* Display Tables */ | |
1173 /************************************************************************/ | |
1174 | |
867 | 1175 Lisp_Object display_table_entry (Ichar, Lisp_Object, Lisp_Object); |
428 | 1176 void get_display_tables (struct window *, face_index, |
1177 Lisp_Object *, Lisp_Object *); | |
1178 | |
1179 /**************************************************************************** | |
1180 * Subwindow Object * | |
1181 ****************************************************************************/ | |
1182 | |
1183 void unmap_subwindow (Lisp_Object subwindow); | |
1184 void map_subwindow (Lisp_Object subwindow, int x, int y, | |
1185 struct display_glyph_area *dga); | |
647 | 1186 int find_matching_subwindow (struct frame* f, int x, int y, int width, |
1187 int height); | |
442 | 1188 void redisplay_widget (Lisp_Object widget); |
1189 void update_widget_instances (Lisp_Object frame); | |
1190 void redisplay_subwindow (Lisp_Object subwindow); | |
1191 Lisp_Object image_instance_parent_glyph (struct Lisp_Image_Instance*); | |
1192 int image_instance_changed (Lisp_Object image); | |
1193 void free_frame_subwindow_instances (struct frame* f); | |
1194 void reset_frame_subwindow_instance_cache (struct frame* f); | |
1195 int unmap_subwindow_instance_cache_mapper (Lisp_Object key, | |
1196 Lisp_Object value, void* finalize); | |
428 | 1197 |
1198 struct expose_ignore | |
1199 { | |
3092 | 1200 #ifdef NEW_GC |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1201 NORMAL_LISP_OBJECT_HEADER header; |
3092 | 1202 #endif /* NEW_GC */ |
647 | 1203 int x, y; |
1204 int width, height; | |
428 | 1205 struct expose_ignore *next; |
1206 }; | |
1207 | |
3092 | 1208 #ifdef NEW_GC |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
3263
diff
changeset
|
1209 DECLARE_LISP_OBJECT (expose_ignore, struct expose_ignore); |
3092 | 1210 #define XEXPOSE_IGNORE(x) XRECORD (x, expose_ignore, struct expose_ignore) |
1211 #define wrap_expose_ignore(p) wrap_record (p, expose_ignore) | |
1212 #define EXPOSE_IGNOREP(x) RECORDP (x, expose_ignore) | |
1213 #define CHECK_EXPOSE_IGNORE(x) CHECK_RECORD (x, expose_ignore) | |
1214 #define CONCHECK_EXPOSE_IGNORE(x) CONCHECK_RECORD (x, expose_ignore) | |
1215 #endif /* NEW_GC */ | |
1216 | |
647 | 1217 int check_for_ignored_expose (struct frame* f, int x, int y, int width, |
1218 int height); | |
428 | 1219 extern int hold_ignored_expose_registration; |
1220 | |
863 | 1221 #define ROUND_UP(arg, unit) (((int)((arg) + (unit) - 1) / (int)(unit)) * (int)(unit)) |
1222 | |
440 | 1223 #endif /* INCLUDED_glyphs_h_ */ |