Mercurial > hg > xemacs-beta
annotate lisp/glyphs.el @ 4844:91b3d00e717f
Various cleanups for Dynarr code, from Unicode-internal ws
dynarr.c: Add comment explaining Dynarr_largest() use.
dynarr.c: In Dynarr_insert_many(), don't call Dynarr_resize() unless we
actually need to resize, and note that an assert() that we are
inserting at or below the current end could be wrong if code
wants to access stuff between `len' and `largest'.
dynarr.c: Don't just Dynarr_resize() to the right size; instead use
Dynarr_reset() then Dynarr_add_many(), so that the 'len' and
'largest' and such get set properly.
dynarr.c, faces.c, gutter.c, lisp.h, lread.c, lrecord.h, redisplay-output.c, redisplay.c: Rename Dynarr member 'cur' to 'len' since it's the length of
the dynarr, not really a pointer to a "current insertion point".
Use type_checking_assert() instead of just assert() in some places.
Add additional assertions (Dynarr_verify*()) to check that we're
being given positions within range. Use them in Dynarr_at,
Dynarr_atp, etc. New Dynarr_atp_allow_end() for retrieving a
pointer to a position that might be the element past the last one.
New Dynarr_past_lastp() to retrieve a pointer to the position
past the last one, using Dynarr_atp_allow_end(). Change code
appropriately to use it.
Rename Dynarr_end() to Dynarr_lastp() (pointer to the last
element) for clarity, and change code appropriately to use it.
Change code appropriately to use Dynarr_begin().
Rewrite Dynarr_add_many(). New version can accept a NULL pointer
to mean "reserve space but don't put anything in it". Used by
stack_like_malloc().
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 13 Jan 2010 04:07:42 -0600 |
parents | 1360b0c147c1 |
children | 308d34e9f07d |
rev | line source |
---|---|
428 | 1 ;;; glyphs.el --- Lisp interface to C glyphs |
2 | |
3 ;; Copyright (C) 1994, 1997 Free Software Foundation, Inc. | |
2607 | 4 ;; Copyright (C) 1995, 1996, 2000, 2005 Ben Wing. |
4226 | 5 ;; Copyright (C) 2007 Didier Verna |
428 | 6 |
7 ;; Author: Chuck Thompson <cthomp@cs.uiuc.edu>, Ben Wing <ben@xemacs.org> | |
8 ;; Maintainer: XEmacs Development Team | |
9 ;; Keywords: extensions, internal, dumped | |
10 | |
11 ;; This file is part of XEmacs. | |
12 | |
13 ;; XEmacs is free software; you can redistribute it and/or modify it | |
14 ;; under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; XEmacs is distributed in the hope that it will be useful, but | |
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
21 ;; General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with XEmacs; see the file COPYING. If not, write to the | |
25 ;; Free Software Foundation, 59 Temple Place - Suite 330, | |
26 ;; Boston, MA 02111-1307, USA. | |
27 | |
28 ;;; Synched up with: Not in FSF. | |
29 | |
442 | 30 ;;; Authorship: |
31 | |
32 ;; Prototype created 1995 by Chuck Thompson. | |
33 ;; Completely rewritten by Ben Wing, 1995. | |
34 ;; Various cleanups (esp. doc strings) by Ben Wing, May 2000. | |
35 | |
428 | 36 ;;; Commentary: |
37 | |
38 ;; This file is dumped with XEmacs. | |
39 | |
40 ;;; Code: | |
41 | |
442 | 42 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; image specifiers |
428 | 43 |
44 (defun make-image-specifier (spec-list) | |
45 "Return a new `image' specifier object with the specification list SPEC-LIST. | |
46 SPEC-LIST can be a list of specifications (each of which is a cons of a | |
47 locale and a list of instantiators), a single instantiator, or a list | |
48 of instantiators. See `make-specifier' for more information about | |
442 | 49 specifiers. |
50 | |
2607 | 51 The main purpose of this doc string is to describe the possible formats for |
52 image instantiators, as given as an argument to `make-glyph' or | |
53 `set-glyph-image'. | |
442 | 54 |
55 An image instantiator should be a string or a vector of the form | |
56 | |
57 [FORMAT :KEYWORD VALUE ...] | |
58 | |
59 i.e. a format symbol followed by zero or more alternating keyword-value | |
2607 | 60 pairs. The vector form of an image instantiator explicitly specifies the |
61 format of the image and other relevant properties. The string form | |
62 specifies only a filename or gives inline data of an unspecified format, | |
63 and XEmacs must guess the actual format. Once it has done this, it | |
64 internally converts the instantiator into the vector format. This is | |
65 described in more detail below. | |
442 | 66 |
2607 | 67 Following is a list of the possible values for FORMAT. After each |
68 description, the allowable keywords for the format are listed in brackets, | |
69 followed by the possible image instance types that can be generated from | |
70 this format. (Image instance types will be discussed below.) | |
71 | |
72 `nothing' | |
442 | 73 Don't display anything; no keywords are valid for this. |
2607 | 74 [] (nothing) |
75 `string' | |
76 Display this image as a text string. Support for instantiating as | |
77 `mono-pixmap' and `color-pixmap' should probably be added. | |
78 [:data] (text) | |
79 `formatted-string' | |
80 Display this image as a text string, with replaceable fields. | |
81 Not currently implemented -- it's treated like `string'. | |
82 [:data] (text) | |
83 `gif' | |
4708
1cecc3e9f0a0
Use giflib or libungif to provide GIF support, instead of using internal
Jerry James <james@xemacs.org>
parents:
4597
diff
changeset
|
84 A GIF87 or GIF89 image; only if GIF support was compiled into this XEmacs. |
2607 | 85 [:data, :file] (color-pixmap, pointer) |
86 `jpeg' | |
87 A JPEG image; only if JPEG support was compiled into this XEmacs. | |
88 [:data, :file] (color-pixmap, pointer) | |
89 `png' | |
90 A PNG image; only if PNG support was compiled into this XEmacs. | |
91 [:data, :file] (color-pixmap, pointer) | |
92 `tiff' | |
93 A TIFF image; only if TIFF support was compiled into this XEmacs. | |
94 [:data, :file] (color-pixmap, pointer) | |
95 `bmp' | |
96 A MS Windows BMP image; only if MS Windows support was compiled into | |
97 this XEmacs. | |
98 [:data, :file] (color-pixmap, pointer) | |
99 `xbm' | |
100 An X bitmap; exists if any window-system support was compiled into this | |
101 XEmacs. | |
102 [:data, :file, :foreground, :background, :mask-data, :mask-file, | |
103 :hotspot-x, :hotspot-y] (mono-pixmap, color-pixmap, pointer) | |
104 `xpm' | |
442 | 105 An XPM pixmap; only if XPM support was compiled into this XEmacs. |
2607 | 106 [:data, :file, :color-symbols] (mono-pixmap, color-pixmap, pointer) |
107 `xface' | |
442 | 108 An X-Face bitmap, used to encode people's faces in e-mail messages; |
2607 | 109 only if X-Face support was compiled into this XEmacs. |
110 [:data, :file, :foreground, :background, :mask-data, :mask-file, | |
111 :hotspot-x, :hotspot-y] (mono-pixmap, color-pixmap, pointer) | |
112 `cursor-font' | |
113 X and GTK only. One of the standard cursor-font names, such as \"watch\" | |
114 or \"right_ptr\" under X. Under X, this is, more specifically, any | |
442 | 115 of the standard cursor names from appendix B of the Xlib manual |
116 [also known as the file <X11/cursorfont.h>] minus the XC_ prefix. | |
117 On other window systems, the valid names will be specific to the | |
2607 | 118 type of window system. |
119 [:data, :foreground, :background] (pointer) | |
120 `mswindows-resource' | |
442 | 121 An MS Windows pointer resource. Specifies a resource to retrieve |
122 directly from the system (an OEM resource) or from a file, particularly | |
123 an executable file. If the resource is to be retrieved from a file, use | |
124 :file and optionally :resource-id. Otherwise use :resource-id. Always | |
125 specify :resource-type to specify the type (cursor, bitmap or icon) of | |
2607 | 126 the resource. Possible values for :resource-id are listed below. |
127 [:file, :resource-type, :resource-id] (pointer, color-pixmap) | |
128 `font' | |
442 | 129 A glyph from a font; i.e. the name of a font, and glyph index into it |
130 of the form \"FONT fontname index [[mask-font] mask-index]\". | |
2607 | 131 Currently can only be instantiated as `pointer', although this should |
442 | 132 probably be fixed. |
2607 | 133 [:data, :foreground, :background] (pointer) |
134 `subwindow' | |
135 An embedded windowing system window. | |
136 [:pixel-width, :pixel-height] (subwindow) | |
137 `button' | |
442 | 138 A button widget; either a push button, radio button or toggle button. |
2607 | 139 [WIDGET-KEYWORDS, GUI-KEYWORDS, :image] (widget) |
140 `combo-box' | |
442 | 141 A drop list of selectable items in a widget, for editing text. |
2607 | 142 [GUI-KEYWORDS, :width, :height, :pixel-width, :face, :items] (widget) |
143 `edit-field' | |
144 A text editing widget. | |
145 [WIDGET-KEYWORDS, GUI-KEYWORDS] (widget) | |
146 `label' | |
147 A static, text-only, widget; for displaying text. | |
148 [WIDGET-KEYWORDS, :descriptor] (widget) | |
149 `layout' | |
442 | 150 A widget for controlling the positioning of children underneath it. |
151 Through the use of nested layouts, a widget hierarchy can be created | |
152 which can have the appearance of any standard dialog box or similar | |
153 arrangement; all of this is counted as one \"glyph\" and could appear | |
2607 | 154 in many of the places that expect a single glyph. |
155 [WIDGET-KEYWORDS, GUI-KEYWORDS, :orientation, :justify, :vertically-justify, | |
156 :horizontally-justify, :border, :margin-width, :items] (widget) | |
157 `native-layout' | |
442 | 158 The native version of a layout widget. #### Document me better! |
2607 | 159 [WIDGET-KEYWORDS, GUI-KEYWORDS] (widget) |
160 `progress-gauge' | |
161 A sliding widget, for showing progress. | |
162 [WIDGET-KEYWORDS, GUI-KEYWORDS, :value] (widget) | |
163 `tab-control' | |
164 A tab widget; a series of user selectable tabs. | |
165 [WIDGET-KEYWORDS, GUI-KEYWORDS, :orientation, :items] (widget) | |
166 `tree-view' | |
167 A folding widget. | |
168 [WIDGET-KEYWORDS, GUI-KEYWORDS, :items] (widget) | |
169 `scrollbar' | |
170 A scrollbar widget. | |
171 [GUI-KEYWORDS, :pixel-width, :face, :items] (widget) | |
172 `autodetect' | |
442 | 173 XEmacs tries to guess what format the data is in. If X support |
174 exists, the data string will be checked to see if it names a filename. | |
175 If so, and this filename contains XBM or XPM data, the appropriate | |
176 sort of pixmap or pointer will be created. [This includes picking up | |
177 any specified hotspot or associated mask file.] Otherwise, if `pointer' | |
178 is one of the allowable image-instance types and the string names a | |
179 valid cursor-font name, the image will be created as a pointer. | |
180 Otherwise, the image will be displayed as text. If no X support | |
2607 | 181 exists, the image will always be displayed as text. |
182 [:data] (mono-pixmap, color-pixmap, pointer, text) | |
183 `inherit' | |
184 Inherit from the background-pixmap property of a face. | |
185 [:face] (mono-pixmap) | |
442 | 186 |
187 The valid keywords are: | |
188 | |
189 :data | |
190 Inline data. For most formats above, this should be a string. For | |
191 XBM images, this should be a list of three elements: width, height, and | |
192 a string of bit data. This keyword is valid for all of the bitmap/pixmap | |
193 formats, as well as `string', `formatted-string', `font', `cursor-font', | |
194 and `autodetect'. | |
195 :file | |
196 Data is contained in a file. The value is the name of this file. | |
197 If both :data and :file are specified, the image is created from | |
198 what is specified in :data and the string in :file becomes the | |
199 value of the `image-instance-file-name' function when applied to | |
200 the resulting image-instance. This keyword is valid for all of the | |
201 bitmap/pixmap formats as well as `mswindows-resource'. | |
202 :foreground | |
203 :background | |
204 For `xbm', `xface', `cursor-font', `widget' and `font'. These keywords | |
205 allow you to explicitly specify foreground and background colors. | |
206 The argument should be anything acceptable to `make-color-instance'. | |
207 This will cause what would be a `mono-pixmap' to instead be colorized | |
208 as a two-color color-pixmap, and specifies the foreground and/or | |
209 background colors for a pointer instead of black and white. | |
210 :mask-data | |
211 For `xbm' and `xface'. This specifies a mask to be used with the | |
212 bitmap. The format is a list of width, height, and bits, like for | |
213 :data. | |
214 :mask-file | |
215 For `xbm' and `xface'. This specifies a file containing the mask data. | |
216 If neither a mask file nor inline mask data is given for an XBM image, | |
217 and the XBM image comes from a file, XEmacs will look for a mask file | |
218 with the same name as the image file but with \"Mask\" or \"msk\" | |
219 appended. For example, if you specify the XBM file \"left_ptr\" | |
220 [usually located in \"/usr/include/X11/bitmaps\"], the associated | |
221 mask file \"left_ptrmsk\" will automatically be picked up. | |
222 :hotspot-x | |
223 :hotspot-y | |
224 For `xbm' and `xface'. These keywords specify a hotspot if the image | |
225 is instantiated as a `pointer'. Note that if the XBM image file | |
226 specifies a hotspot, it will automatically be picked up if no | |
227 explicit hotspot is given. | |
228 :color-symbols | |
229 Only for `xpm'. This specifies an alist that maps strings | |
230 that specify symbolic color names to the actual color to be used | |
231 for that symbolic color (in the form of a string or a color-specifier | |
232 object). If this is not specified, the contents of `xpm-color-symbols' | |
233 are used to generate the alist. | |
234 :resource-id | |
235 Only for `mswindows-resource'. This must be either an integer (which | |
236 directly specifies a resource number) or a string. Valid strings are | |
237 | |
238 -- For bitmaps: | |
239 | |
240 \"close\", \"uparrow\", \"dnarrow\", \"rgarrow\", \"lfarrow\", | |
241 \"reduce\", \"zoom\", \"restore\", \"reduced\", \"zoomd\", | |
242 \"restored\", \"uparrowd\", \"dnarrowd\", \"rgarrowd\", \"lfarrowd\", | |
243 \"mnarrow\", \"combo\", \"uparrowi\", \"dnarrowi\", \"rgarrowi\", | |
244 \"lfarrowi\", \"size\", \"btsize\", \"check\", \"checkboxes\", and | |
245 \"btncorners\". | |
246 | |
2607 | 247 -- For pointers: |
442 | 248 |
249 \"normal\", \"ibeam\", \"wait\", \"cross\", \"up\", \"sizenwse\", | |
250 \"sizenesw\", \"sizewe\", \"sizens\", \"sizeall\", and \"no\". | |
251 | |
252 -- For icons: | |
253 | |
254 \"sample\", \"hand\", \"ques\", \"bang\", \"note\", and \"winlogo\". | |
255 :resource-type | |
2607 | 256 Only for `mswindows-resource'. This must be a symbol, either `cursor' |
257 (i.e. pointer), `icon', or `bitmap', specifying the type of resource to | |
258 be retrieved. | |
442 | 259 :face |
260 Only for `inherit'. This specifies the face to inherit from. | |
261 For widgets this also specifies the face to use for display. It defaults | |
262 to gui-element-face. | |
2607 | 263 :pixel-width, :pixel-height |
264 Width and height of element, in pixels. For `subwindow', the values | |
265 must be integers. For widgets, the values can be integers or | |
266 expressions that evaluate to integers. | |
442 | 267 |
2607 | 268 \[WIDGET-KEYWORDS] stands for the standard keywords accepted by widgets: |
442 | 269 These are `:selected', `:active', `:suffix', `:keys', `:style', |
270 `:filter', `:config', `:included', `:key-sequence', `:accelerator', | |
2607 | 271 `:label', `:callback', `:initial-focus', and `:descriptor'. |
272 #### Document me. | |
273 | |
274 \[GUI-KEYWORDS] stands for keywords accepted by many widgets. | |
275 These are `:width', `:height', `:pixel-width', `:pixel-height', and `:face'. | |
276 #### Document me. | |
442 | 277 |
278 If instead of a vector, the instantiator is a string, it will be | |
279 converted into a vector by looking it up according to the specs in the | |
280 `console-type-image-conversion-list' (q.v.) for the console type of | |
281 the domain (usually a window; sometimes a frame or device) over which | |
282 the image is being instantiated. | |
283 | |
284 If the instantiator specifies data from a file, the data will be read | |
285 in at the time that the instantiator is added to the image (which may | |
286 be well before when the image is actually displayed), and the | |
287 instantiator will be converted into one of the inline-data forms, with | |
288 the filename retained using a :file keyword. This implies that the | |
289 file must exist when the instantiator is added to the image, but does | |
290 not need to exist at any other time (e.g. it may safely be a temporary | |
291 file). | |
2607 | 292 |
293 NOTE: In practice, you rarely, if ever, need to actually | |
294 create an image specifier! (The function `make-image-specifier' exists | |
295 mainly for completeness.) Pretty much the only use for image specifiers is | |
296 to control how glyphs are displayed, and the image specifier associated | |
297 with a glyph (the `image' property of a glyph) is created automatically | |
298 when a glyph is created (see `make-glyph') and need not \(and cannot, for | |
299 that matter) ever be changed. In fact, the design decision to create a | |
300 separate image specifier type, rather than make glyphs themselves be | |
301 specifiers, is debatable -- the other properties of glyphs are rarely used | |
302 and could conceivably have been incorporated into the glyph's instantiator. | |
303 The rarely used glyph types (buffer, pointer, icon) could also have been | |
304 incorporated into the instantiator. | |
305 | |
306 An image specifier is used for images (pixmaps, widgets and the like). It | |
307 is used to describe the actual image in a glyph. It is instantiated \(see | |
308 `specifier-instance') as an image-instance. Note that \"image\" as used in | |
309 XEmacs does not actually refer to what the term \"image\" normally means (a | |
310 picture, e.g. in .GIF or .JPG format, and called a \"pixmap\" in XEmacs), | |
311 but includes all types of graphical elements, including pixmaps, widgets | |
312 \(buttons, sliders, text fields, etc.) and even strings of text. | |
313 | |
314 There is an important distinction to be made between image instantiators | |
315 and image instances, and \"image instantiator formats\" and \"image | |
316 instance types\", analogous to the distinction between source and | |
317 destination. An image instantiator describes the source data for an image. | |
318 An image instance encapsulates the resulting window-system object used to | |
319 display the image. Image instantiator formats are the formats of the | |
320 source: This includes familiar and less-familiar graphics formats such as | |
321 `gif', `jpeg', `png' and `xpm'; widget types such as `button', `edit-field' | |
322 and `combo-box'; and other beasts such as `string' (plain text, which could | |
323 potentially behave like text when placed in a buffer, such as wrapping), | |
324 `font' (a single character from a particular font, specified by the index | |
325 into the font), etc. Image instance types are the (destination) types of | |
326 the resulting image instance. Different image instance types correspond to | |
327 fundamentally different appearance and behaviors for the resulting image, | |
328 specifically: | |
329 | |
330 -- `color-pixmap' (a color image); | |
331 -- `mono-pixmap' (a \"monochrome\" image, technically a two-color image | |
332 that comes in two unspecified shades \"foreground\" and \"background\", | |
333 determined from the face [see `make-face'] of the glyph or surrounding | |
334 text); | |
335 -- `text' (a string of text appearing somewhere in a buffer's text or | |
336 margins, which has an unspecified foreground, background, and font | |
337 derived from the surrounding text or other external property and which | |
338 behaves in many respects like an image but can wrap across the end of a | |
339 line to the beginning of the next); | |
340 -- `pointer' (the mouse pointer for a window; this is a combination of a | |
341 rectangular pixmap image, a monochrome mask that specifies the | |
342 transparency of the image [i.e. in which places the underlying screen | |
343 image can show through, and how much of it], and a \"hotspot\" that | |
344 indicates which pixel in the pointer's image is considered the actual | |
345 pointer location -- for example, this will be located near the tip of | |
346 an arrow, in the middle of a crosshairs, somewhere along an i-beam, etc.); | |
347 -- `widget' (a window-system object or \"widget\" that interacts with the | |
348 user, such as a button, edit-field or combo-box); | |
349 -- `subwindow' (a rectangular area that another program can draw into); | |
350 -- `nothing' (no display). | |
351 | |
352 There is not a one-to-one mapping between source (image instantiator) | |
353 formats and destination (image instance) types. For example, the source | |
354 format `xpm' can generate the image instance types `color-pixmap', | |
355 `mono-pixmap', or `pointer', and the image instance type `color-pixmap' can | |
356 be generated by any of `gif', `jpeg', `png', `tiff', `xpm', `xbm' and | |
357 `xface'. | |
358 | |
359 In general, the user or programmer specifies the image instantiator format, | |
360 while the appropriate image instance type is determined automatically by | |
361 XEmacs from the image instantiator format, from the data in the | |
362 instantiator and from the particular situation the image (and the glyph | |
363 that holds it) is being used in. (However, it's possible to explicitly | |
364 create image instances and control their types; see `make-image-instance'.) | |
365 For example, a glyph used to specify the shape of a mouse pointer can only | |
366 result in `pointer'-type image instances, and a glyph used for an icon can | |
367 only result in `color-pixmap' image instances. A glyph used in a buffer | |
368 can potentially result in any image instance type except for `pointer', but | |
369 particular instantiator formats have only a limited set of image instance | |
370 types they will support. Here is an example of how the image instance type | |
371 for an `xpm' instantiator (which can potentially support `color-pixmap', | |
372 `mono-pixmap', or `pointer') is determined: | |
373 | |
374 1. If the glyph is being used for a mouse pointer (hence its `glyph-type' | |
375 is `pointer'), it can be instantiated only a `pointer'-type image instance. | |
376 2. If the glyph is being used for an icon (hence its `glyph-type' is `icon'), | |
377 it can be instantiated only a `color-pixmap'-type image instance. | |
378 3. Otherwise, the glyph is being used somewhere inside a frame (`glyph-type' | |
379 of `buffer') and any image instance type except `pointer' can be | |
380 supported. In this case, this means `color-pixmap' or `mono-pixmap'. | |
381 Which one will result depends on the particular data being processed, | |
382 since XPM images can specify whether they are color or mono. | |
383 | |
384 Note again that \"mono\" does *NOT* simply mean \"an image with two | |
385 colors\". The latter image has two prespecified colors, e.g. red and blue | |
386 or black and white, and will always appear with those colors, no matter | |
387 what the context. A mono image has two *unspecified* colors, symbolically | |
388 named \"foreground\" and \"background\", and the actual values for those | |
389 colors depends on context. A mono pixmap displayed among text will take | |
390 its foreground and background from that of the text and hence blend in | |
391 nicely; a two-color color pixmap won't do that. | |
392 | |
393 Note also that `color-pixmap' image instances can be generated from the | |
394 supported pixmap formats that are inherently mono (i.e. `xbm' and `xface') | |
395 by specifying :foreground and :background values. | |
396 | |
397 A table of the various image instantiator formats and the possible | |
398 destination (image instance) types that can be generated from them is as | |
399 follows: | |
400 | |
401 | |
402 color-pixmap mono-pixmap text pointer widget subwindow noth. | |
403 ------------------------------------------------------------------------------- | |
404 nothing + | |
405 string + | |
406 formatted-string + | |
407 xbm + + + | |
408 xpm + + + | |
409 xface + + + | |
410 gif + + | |
411 jpeg + + | |
412 png + + | |
413 tiff + + | |
414 bmp + + | |
415 cursor-font + | |
416 mswindows-resource + + | |
417 font + | |
418 subwindow + | |
419 button + | |
420 combo-box + | |
421 edit-field + | |
422 label + | |
423 layout + | |
424 native-layout + | |
425 progress-gauge + | |
426 tab-control + | |
427 tree-view + | |
428 scrollbar + | |
429 autodetect + + + + | |
430 inherit + | |
431 | |
432 See `make-image-instance' for a more detailed discussion of image | |
433 instance types." | |
428 | 434 (make-specifier-and-init 'image spec-list)) |
435 | |
436 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; glyphs | |
437 | |
438 (defconst built-in-glyph-specifiers | |
439 '(image contrib-p baseline) | |
442 | 440 "A list of the built-in glyph properties that are specifiers.") |
428 | 441 |
442 (defun glyph-property (glyph property &optional locale) | |
443 "Return GLYPH's value of PROPERTY in LOCALE. | |
444 | |
445 If LOCALE is omitted, the GLYPH's actual value for PROPERTY will be | |
446 returned. For built-in properties, this will be a specifier object | |
447 of a type appropriate to the property (e.g. a font or color | |
448 specifier). For other properties, this could be anything. | |
449 | |
450 If LOCALE is supplied, then instead of returning the actual value, | |
451 the specification(s) for the given locale or locale type will | |
452 be returned. This will only work if the actual value of | |
453 PROPERTY is a specifier (this will always be the case for built-in | |
454 properties, but not or not may apply to user-defined properties). | |
455 If the actual value of PROPERTY is not a specifier, this value | |
456 will simply be returned regardless of LOCALE. | |
457 | |
458 The return value will be a list of instantiators (e.g. strings | |
459 specifying a font or color name), or a list of specifications, each | |
460 of which is a cons of a locale and a list of instantiators. | |
461 Specifically, if LOCALE is a particular locale (a buffer, window, | |
2607 | 462 frame, device, or `global'), a list of instantiators for that locale |
428 | 463 will be returned. Otherwise, if LOCALE is a locale type (one of |
2607 | 464 the symbols `buffer', `window', `frame', `device', `device-class', or |
465 `device-type'), the specifications for all locales of that type will | |
466 be returned. Finally, if LOCALE is `all', the specifications for all | |
428 | 467 locales of all types will be returned. |
468 | |
469 The specifications in a specifier determine what the value of | |
470 PROPERTY will be in a particular \"domain\" or set of circumstances, | |
471 which is typically a particular Emacs window along with the buffer | |
472 it contains and the frame and device it lies within. The value | |
473 is derived from the instantiator associated with the most specific | |
2607 | 474 locale (in the order buffer, window, frame, device, and `global') |
428 | 475 that matches the domain in question. In other words, given a domain |
476 (i.e. an Emacs window, usually), the specifier for PROPERTY will first | |
477 be searched for a specification whose locale is the buffer contained | |
478 within that window; then for a specification whose locale is the window | |
479 itself; then for a specification whose locale is the frame that the | |
480 window is contained within; etc. The first instantiator that is | |
481 valid for the domain (usually this means that the instantiator is | |
482 recognized by the device [i.e. the X server or TTY device] that the | |
483 domain is on. The function `glyph-property-instance' actually does | |
484 all this, and is used to determine how to display the glyph. | |
485 | |
486 See `set-glyph-property' for the built-in property-names." | |
487 (check-argument-type 'glyphp glyph) | |
488 (let ((value (get glyph property))) | |
489 (if (and locale | |
490 (or (memq property built-in-glyph-specifiers) | |
491 (specifierp value))) | |
492 (setq value (specifier-specs value locale))) | |
493 value)) | |
494 | |
495 (defun convert-glyph-property-into-specifier (glyph property) | |
496 "Convert PROPERTY on GLYPH into a specifier, if it's not already." | |
497 (check-argument-type 'glyphp glyph) | |
498 (let ((specifier (get glyph property))) | |
499 ;; if a user-property does not have a specifier but a | |
500 ;; locale was specified, put a specifier there. | |
501 ;; If there was already a value there, convert it to a | |
2607 | 502 ;; specifier with the value as its `global' instantiator. |
428 | 503 (if (not (specifierp specifier)) |
504 (let ((new-specifier (make-specifier 'generic))) | |
505 (if (or (not (null specifier)) | |
506 ;; make sure the nil returned from `get' wasn't | |
507 ;; actually the value of the property | |
508 (null (get glyph property t))) | |
509 (add-spec-to-specifier new-specifier specifier)) | |
510 (setq specifier new-specifier) | |
511 (put glyph property specifier))))) | |
512 | |
513 (defun glyph-property-instance (glyph property | |
514 &optional domain default no-fallback) | |
515 "Return the instance of GLYPH's PROPERTY in the specified DOMAIN. | |
516 | |
517 Under most circumstances, DOMAIN will be a particular window, | |
518 and the returned instance describes how the specified property | |
519 actually is displayed for that window and the particular buffer | |
520 in it. Note that this may not be the same as how the property | |
521 appears when the buffer is displayed in a different window or | |
522 frame, or how the property appears in the same window if you | |
523 switch to another buffer in that window; and in those cases, | |
524 the returned instance would be different. | |
525 | |
526 DOMAIN defaults to the selected window if omitted. | |
527 | |
528 DOMAIN can be a frame or device, instead of a window. The value | |
529 returned for a such a domain is used in special circumstances | |
530 when a more specific domain does not apply; for example, a frame | |
531 value might be used for coloring a toolbar, which is conceptually | |
532 attached to a frame rather than a particular window. The value | |
533 is also useful in determining what the value would be for a | |
534 particular window within the frame or device, if it is not | |
535 overridden by a more specific specification. | |
536 | |
537 If PROPERTY does not name a built-in property, its value will | |
538 simply be returned unless it is a specifier object, in which case | |
539 it will be instanced using `specifier-instance'. | |
540 | |
541 Optional arguments DEFAULT and NO-FALLBACK are the same as in | |
542 `specifier-instance'." | |
543 (check-argument-type 'glyphp glyph) | |
544 (let ((value (get glyph property))) | |
545 (if (specifierp value) | |
546 (setq value (specifier-instance value domain default no-fallback))) | |
547 value)) | |
548 | |
549 (defun set-glyph-property (glyph property value &optional locale tag-set | |
550 how-to-add) | |
551 "Change a property of a GLYPH. | |
552 | |
553 NOTE: If you want to remove a property from a glyph, use | |
554 `remove-glyph-property' rather than attempting to set a value of nil | |
555 for the property. | |
556 | |
557 For built-in properties, the actual value of the property is a | |
558 specifier and you cannot change this; but you can change the | |
559 specifications within the specifier, and that is what this function | |
560 will do. For user-defined properties, you can use this function | |
561 to either change the actual value of the property or, if this value | |
562 is a specifier, change the specifications within it. | |
563 | |
564 If PROPERTY is a built-in property, the specifications to be added to | |
565 this property can be supplied in many different ways: | |
566 | |
567 -- If VALUE is a simple instantiator (e.g. a string naming a font or | |
568 color) or a list of instantiators, then the instantiator(s) will | |
569 be added as a specification of the property for the given LOCALE | |
2607 | 570 (which defaults to `global' if omitted). |
428 | 571 -- If VALUE is a list of specifications (each of which is a cons of |
572 a locale and a list of instantiators), then LOCALE must be nil | |
573 (it does not make sense to explicitly specify a locale in this | |
574 case), and specifications will be added as given. | |
575 -- If VALUE is a specifier (as would be returned by `glyph-property' | |
576 if no LOCALE argument is given), then some or all of the | |
577 specifications in the specifier will be added to the property. | |
578 In this case, the function is really equivalent to | |
579 `copy-specifier' and LOCALE has the same semantics (if it is | |
580 a particular locale, the specification for the locale will be | |
581 copied; if a locale type, specifications for all locales of | |
2607 | 582 that type will be copied; if nil or `all', then all |
428 | 583 specifications will be copied). |
584 | |
2607 | 585 HOW-TO-ADD should be either nil or one of the symbols `prepend', |
586 `append', `remove-tag-set-prepend', `remove-tag-set-append', `remove-locale', | |
3061 | 587 `remove-locale-type', or `remove-all'. See `copy-specifier' and |
428 | 588 `add-spec-to-specifier' for a description of what each of |
589 these means. Most of the time, you do not need to worry about | |
590 this argument; the default behavior usually is fine. | |
591 | |
592 In general, it is OK to pass an instance object (e.g. as returned | |
593 by `glyph-property-instance') as an instantiator in place of | |
594 an actual instantiator. In such a case, the instantiator used | |
595 to create that instance object will be used (for example, if | |
2607 | 596 you set a font-instance object as the value of the `font' |
428 | 597 property, then the font name used to create that object will |
598 be used instead). If some cases, however, doing this | |
599 conversion does not make sense, and this will be noted in | |
600 the documentation for particular types of instance objects. | |
601 | |
602 If PROPERTY is not a built-in property, then this function will | |
603 simply set its value if LOCALE is nil. However, if LOCALE is | |
604 given, then this function will attempt to add VALUE as the | |
605 instantiator for the given LOCALE, using `add-spec-to-specifier'. | |
606 If the value of the property is not a specifier, it will | |
2607 | 607 automatically be converted into a `generic' specifier. |
428 | 608 |
609 | |
610 The following symbols have predefined meanings: | |
611 | |
612 image The image used to display the glyph. | |
613 | |
614 baseline Percent above baseline that glyph is to be | |
615 displayed. | |
616 | |
617 contrib-p Whether the glyph contributes to the | |
618 height of the line it's on. | |
619 | |
620 face Face of this glyph (*not* a specifier)." | |
621 (check-argument-type 'glyphp glyph) | |
622 (if (memq property built-in-glyph-specifiers) | |
623 (set-specifier (get glyph property) value locale tag-set how-to-add) | |
624 | |
625 ;; This section adds user defined properties. | |
626 (if (not locale) | |
627 (put glyph property value) | |
628 (convert-glyph-property-into-specifier glyph property) | |
629 (add-spec-to-specifier (get glyph property) value locale tag-set | |
630 how-to-add))) | |
631 value) | |
632 | |
633 (defun remove-glyph-property (glyph property &optional locale tag-set exact-p) | |
634 "Remove a property from a glyph. | |
635 For built-in properties, this is analogous to `remove-specifier'. | |
636 See `remove-specifier' for the meaning of the LOCALE, TAG-SET, and EXACT-P | |
637 arguments." | |
638 (or locale (setq locale 'all)) | |
639 (if (memq property built-in-glyph-specifiers) | |
640 (remove-specifier (glyph-property glyph property) locale tag-set exact-p) | |
641 (if (eq locale 'all) | |
642 (remprop glyph property) | |
643 (convert-glyph-property-into-specifier glyph property) | |
644 (remove-specifier (glyph-property glyph property) locale tag-set | |
645 exact-p)))) | |
646 | |
647 (defun glyph-face (glyph) | |
648 "Return the face of GLYPH." | |
649 (glyph-property glyph 'face)) | |
650 | |
651 (defun set-glyph-face (glyph face) | |
652 "Change the face of GLYPH to FACE." | |
653 ; (interactive (glyph-interactive "face")) | |
654 (set-glyph-property glyph 'face face)) | |
655 | |
656 (defun glyph-image (glyph &optional locale) | |
657 "Return the image of GLYPH in LOCALE, or nil if it is unspecified. | |
658 | |
659 LOCALE may be a locale (the instantiators for that particular locale | |
660 will be returned), a locale type (the specifications for all locales | |
2607 | 661 of that type will be returned), `all' (all specifications will be |
428 | 662 returned), or nil (the actual specifier object will be returned). |
663 | |
664 See `glyph-property' for more information." | |
665 (glyph-property glyph 'image locale)) | |
666 | |
667 (defun glyph-image-instance (glyph &optional domain default no-fallback) | |
668 "Return the instance of GLYPH's image in DOMAIN. | |
669 | |
670 Normally DOMAIN will be a window or nil (meaning the selected window), | |
671 and an instance object describing how the image appears in that | |
672 particular window and buffer will be returned. | |
673 | |
674 See `glyph-property-instance' for more information." | |
675 (glyph-property-instance glyph 'image domain default no-fallback)) | |
676 | |
442 | 677 (defun glyph-image-property (glyph prop &optional domain default no-fallback) |
678 "Return property PROP of the instance of GLYPH's image in DOMAIN. | |
679 | |
680 Normally DOMAIN will be a window or nil (meaning the selected window). | |
681 The value returned is dependent on the image instance type." | |
682 (image-instance-property | |
683 (glyph-image-instance glyph domain default no-fallback) prop)) | |
684 | |
428 | 685 (defun set-glyph-image (glyph spec &optional locale tag-set how-to-add) |
686 "Change the image of GLYPH in LOCALE. | |
687 | |
688 SPEC should be an instantiator (a string or vector; see | |
442 | 689 `make-image-specifier' for a description of possible values here), |
428 | 690 a list of (possibly tagged) instantiators, an alist of specifications |
691 (each mapping a locale to an instantiator list), or an image specifier | |
692 object. | |
693 | |
694 If SPEC is an alist, LOCALE must be omitted. If SPEC is a | |
2607 | 695 specifier object, LOCALE can be a locale, a locale type, `all', |
428 | 696 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE |
697 specifies the locale under which the specified instantiator(s) | |
3061 | 698 will be added, and defaults to `global'. |
428 | 699 |
700 See `set-glyph-property' for more information." | |
701 ; (interactive (glyph-interactive "image")) | |
702 (set-glyph-property glyph 'image spec locale tag-set how-to-add)) | |
703 | |
704 (defun glyph-contrib-p (glyph &optional locale) | |
705 "Return whether GLYPH contributes to its line height. | |
706 | |
707 LOCALE may be a locale (the instantiators for that particular locale | |
708 will be returned), a locale type (the specifications for all locales | |
2607 | 709 of that type will be returned), `all' (all specifications will be |
428 | 710 returned), or nil (the actual specifier object will be returned). |
711 | |
712 See `glyph-property' for more information." | |
713 (glyph-property glyph 'contrib-p locale)) | |
714 | |
715 (defun glyph-contrib-p-instance (glyph &optional domain default no-fallback) | |
2607 | 716 "Return the instance of GLYPH's `contrib-p' property in DOMAIN. |
428 | 717 |
718 Normally DOMAIN will be a window or nil (meaning the selected window), | |
2607 | 719 and an instance object describing what the `contrib-p' property is in |
428 | 720 that particular window and buffer will be returned. |
721 | |
722 See `glyph-property-instance' for more information." | |
723 (glyph-property-instance glyph 'contrib-p domain default no-fallback)) | |
724 | |
725 (defun set-glyph-contrib-p (glyph spec &optional locale tag-set how-to-add) | |
726 "Change the contrib-p property of GLYPH in LOCALE. | |
727 | |
728 SPEC should be an instantiator (t or nil), a list of (possibly | |
729 tagged) instantiators, an alist of specifications (each mapping a | |
730 locale to an instantiator list), or a boolean specifier object. | |
731 | |
732 If SPEC is an alist, LOCALE must be omitted. If SPEC is a | |
2607 | 733 specifier object, LOCALE can be a locale, a locale type, `all', |
428 | 734 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE |
735 specifies the locale under which the specified instantiator(s) | |
3061 | 736 will be added, and defaults to `global'. |
428 | 737 |
738 See `set-glyph-property' for more information." | |
739 ; (interactive (glyph-interactive "contrib-p")) | |
740 (set-glyph-property glyph 'contrib-p spec locale tag-set how-to-add)) | |
741 | |
742 (defun glyph-baseline (glyph &optional locale) | |
743 "Return the baseline of GLYPH in LOCALE, or nil if it is unspecified. | |
744 | |
745 LOCALE may be a locale (the instantiators for that particular locale | |
746 will be returned), a locale type (the specifications for all locales | |
2607 | 747 of that type will be returned), `all' (all specifications will be |
428 | 748 returned), or nil (the actual specifier object will be returned). |
749 | |
750 See `glyph-property' for more information." | |
751 (glyph-property glyph 'baseline locale)) | |
752 | |
753 (defun glyph-baseline-instance (glyph &optional domain default no-fallback) | |
754 "Return the instance of GLYPH's baseline in DOMAIN. | |
755 | |
756 Normally DOMAIN will be a window or nil (meaning the selected window), | |
757 and an integer or nil (specifying the baseline in that particular | |
758 window and buffer) will be returned. | |
759 | |
760 See `glyph-property-instance' for more information." | |
761 (glyph-property-instance glyph 'baseline domain default no-fallback)) | |
762 | |
763 (defun set-glyph-baseline (glyph spec &optional locale tag-set how-to-add) | |
764 "Change the baseline of GLYPH to SPEC in LOCALE. | |
765 | |
766 SPEC should be an instantiator (an integer [a percentage above the | |
767 baseline of the line the glyph is on] or nil), a list of (possibly | |
768 tagged) instantiators, an alist of specifications (each mapping a | |
769 locale to an instantiator list), or a generic specifier object. | |
770 | |
771 If SPEC is an alist, LOCALE must be omitted. If SPEC is a | |
2607 | 772 specifier object, LOCALE can be a locale, a locale type, `all', |
428 | 773 or nil; see `copy-specifier' for its semantics. Otherwise LOCALE |
774 specifies the locale under which the specified instantiator(s) | |
3061 | 775 will be added, and defaults to `global'. |
428 | 776 |
777 See `set-glyph-property' for more information." | |
778 ; (interactive (glyph-interactive "baseline")) | |
779 (set-glyph-property glyph 'baseline spec locale tag-set how-to-add)) | |
780 | |
781 (defun make-glyph (&optional spec-list type) | |
442 | 782 "Create a new glyph of type TYPE. |
783 | |
784 A glyph in XEmacs does NOT refer to a single unit of textual display (the | |
785 XEmacs term for this is \"rune\"), but rather is an object encapsulating | |
786 a graphical element, such as an image or widget (an element such as a | |
787 button or text field; \"widget\" is the term for this under X Windows, | |
788 and it's called a \"control\" under MS Windows). This graphical element | |
789 could appear in a buffer, a margin, a gutter, or a toolbar, or as a mouse | |
790 pointer or an icon, for example. | |
791 | |
792 Creating a glyph using `make-glyph' does not specify *where* the glyph | |
793 will be used, but it does specify *what* the glyph will look like. In | |
794 particular, SPEC-LIST is used to specify this, and it's used to | |
795 initialize the glyph's `image' property, which is an image | |
796 specifier. (Note that \"image\" as used in the context of a glyph's | |
797 `image' property or in the terms \"image specifier\", \"image | |
798 instantiator\", or \"image instance\" does not refer to what people | |
799 normally think of as an image (which in XEmacs is called a | |
800 \"pixmap\"), but to any graphical element -- a pixmap, a widget, or | |
801 even a block of text, when used in the places that call for a glyph.) | |
2607 | 802 |
803 SPEC-LIST is typically an image instantiator, describing the source for the | |
804 image data. This is either a vector of the form [FORMAT :KEYWORD DATA ...], | |
805 for example | |
806 | |
807 [jpeg :file \"/user/john/images/myimage.jpg\"] | |
808 | |
809 or | |
810 | |
811 [xbm :data \"/* XPM */\nstatic char * copy[] = {\n...\"] | |
812 | |
813 or it is a string, either giving a file name or directly specifying inline | |
814 data. See `make-image-specifier' for a detailed description of valid image | |
815 instantiators. If the instantiator is a string, XEmacs will convert it | |
816 into vector form by trying to guess whether a file name or inline data is | |
817 intended, and what kind of data is inline or in the file. Usually it does | |
818 a pretty good job. See `console-type-image-conversion-list' for details of | |
819 how this works. | |
820 | |
821 If the instantiator specifies data from a file, the data will be read in | |
822 when `make-glyph' is called and substituted inline into the instantiator, | |
823 using the :data keyword. This means that the file must exist when the | |
824 glyph is created, but does not need to exist afterwards (e.g. it may safely | |
825 be a temporary file). | |
826 | |
827 When errors occur in the process of reading image data from a file | |
828 \(e.g. the file does not exist or the data is of the wrong format or | |
829 corrupted), no Lisp error will currently be signalled. Instead, the | |
830 instantiator is skipped and warnings will be issued at level `debug'. \(A | |
831 glyph with no instantiators in it cannot be displayed.) Normally, such | |
832 warnings are ignored entirely, but you can change this by setting | |
833 `log-warning-minimum-level'. This is useful if you're trying to debug why | |
834 particular instantiators are not being processed. (#### We should probably | |
835 provide a way of getting errors in such circumstances, or even make this | |
836 the default behavior.) | |
837 | |
838 Technically, SPEC-LIST can also be a list of image instantiators (each one | |
839 in turn is tried until an image is successfully produced), a cons of a | |
840 locale (frame, buffer, etc.) and an instantiator, a list of such conses, | |
841 or any other form accepted by `canonicalize-spec-list'. | |
428 | 842 |
442 | 843 If you're not familiar with specifiers, you should be in order to |
844 understand how glyphs work. The clearest introduction to specifiers | |
845 is in the Lispref manual, available under Info. (Choose | |
846 Help->Info->Info Contents on the menubar or type \\[info].) You can | |
847 also see `make-specifier' for a capsule summary. What's important to | |
848 keep in mind is that a specifier lets you set a different value for | |
849 any particular buffer, window, frame, device, or console. This allows | |
850 for a great deal of flexibility; in particular, only one global glyph | |
851 needs to exist for a particular purpose (e.g. the icon used to represent | |
852 an iconified frame, the mouse pointer used over particular areas of a | |
853 frame, etc.), and in these cases you do not create your own glyph, but | |
854 rather modify the existing one. | |
855 | |
856 As well as using SPEC-LIST to initialize the glyph, you can set | |
857 specifications using `set-glyph-image'. Note that, due to a possibly | |
858 questionable historical design decision, a glyph itself is not | |
859 actually a specifier, but rather is an object containing an image | |
860 specifier (as well as other, seldom-used properties). Therefore, you | |
861 cannot set or access specifications for the glyph's image by directly | |
862 using `set-specifier', `specifier-instance' or the like on the glyph; | |
863 instead use them on `(glyph-image GLYPH)' or use the convenience | |
864 functions `set-glyph-image', `glyph-image-instance', and | |
865 `glyph-image'. | |
866 | |
867 Once you have created a glyph, you specify where it will be used as follows: | |
868 | |
869 -- To insert a glyph into a buffer, create an extent in the buffer and then | |
870 use `set-extent-begin-glyph' or `set-extent-end-glyph' to set a glyph | |
871 to be displayed at the corresponding edge of the extent. (It is common | |
872 to create zero-width extents for this purpose.) | |
873 | |
874 -- To insert a glyph into the left or right margin of a buffer, first | |
875 make sure the margin is visible by setting a value for the specifiers | |
876 `left-margin-width' or `right-margin-width'. (Not strictly necessary | |
877 when using margin glyphs with layout policy `whitespace'.) Then follow | |
878 the same procedure above for inserting a glyph in a buffer, and then | |
879 set a non-default layout policy for the glyph using | |
880 `set-extent-begin-glyph-layout' or `set-extent-end-glyph-layout'. | |
881 Alternatively, use the high-level annotations API (see | |
882 `make-annotation'). (In point of fact, you can also use the annotations | |
883 API for glyphs in a buffer, by setting a layout policy of `text'.) | |
884 | |
885 -- To insert a glyph into the modeline, just put the glyph directly as | |
886 one of the modeline elements. (Unfortunately you can't currently | |
887 put a begin glyph or end glyph on one of the modeline extents -- | |
888 they're ignored.) | |
428 | 889 |
442 | 890 -- To insert a glyph into a toolbar, specify it as part of a toolbar |
891 instantiator (typically set on the specifier `default-toolbar'). | |
892 See `default-toolbar' for more information. (Note that it is standard | |
893 practice to use a symbol in place of the glyph list in the toolbar | |
894 instantiator; the symbol is evalled to get the glyph list. This | |
895 facilitates both creating the toolbar instantiator and modifying | |
896 individual glyphs in a toolbar later on. For example, you can | |
897 change the way that the Mail toolbar button looks by modifying the | |
898 value of the variable `toolbar-mail-icon' (in general, `toolbar-*-icon') | |
899 and then calling `(set-specifier-dirty-flag default-toolbar)'. | |
900 (#### Unfortunately this doesn't quite work the way it should; the | |
2607 | 901 change will appear in new frames, but not existing ones.) |
442 | 902 |
903 -- To insert a glyph into a gutter, create or modify a gutter instantiator | |
904 (typically set on the specifier `default-gutter'). Gutter instantiators | |
905 consist of strings or lists of strings, so to insert a glyph, create an | |
906 extent over the string, and use `set-extent-begin-glyph' or | |
907 `set-extent-end-glyph' to set a glyph to be displayed at the corresponding | |
908 edge of the extent, just like for glyphs in a buffer. | |
909 | |
910 -- To use a glyph as the icon for a frame, you do not actually create a new | |
911 glyph; rather, you change the specifications for the existing glyph | |
912 `frame-icon-glyph'. (Remember that, because of the specifier nature of | |
913 glyphs, you can set different values for any particular buffer or frame.) | |
914 | |
915 -- To use a glyph as the mouse pointer, in general you do not create a | |
916 new glyph, but rather you change the specifications of various existing | |
917 glyphs, such as `text-pointer-glyph' for the pointer used over text, | |
918 `modeline-pointer-glyph' for the pointer used over the modeline, etc. | |
919 Do an apropos over `*-pointer-glyph' to find all of them. (Note also | |
920 that you can temporarily set the mouse pointer to some specific shape | |
921 by using `set-frame-pointer', which takes an image instance, as obtained | |
922 from calling `glyph-image-instance' on a glyph of type `pointer' -- | |
923 either one of the above-mentioned variables or one you created yourself. | |
924 (See below for what it means to create a glyph of type `pointer'.) | |
925 This pointer will last only until the next mouse motion event is | |
926 processed or certain other things happen, such as creating or deleting | |
927 a window. (In fact, the above-mentioned pointer glyph variables are | |
928 implemented as part of the default handler for mouse motion events. | |
929 If you want to customize this behavior, take a look at `mode-motion-hook', | |
930 or `mouse-motion-handler' if you really want to get low-level.) | |
931 | |
932 -- To use a glyph to control the shape of miscellaneous redisplay effects | |
933 such as the truncation and continuation markers, set the appropriate | |
934 existing glyph variables, as for icons and pointers above. See | |
935 `continuation-glyph', `control-arrow-glyph', `hscroll-glyph', | |
936 `invisible-text-glyph', `octal-escape-glyph', and `truncation-glyph'. | |
937 See also `overlay-arrow-string', an odd redisplay leftover which can | |
938 be set to a glyph you created, and will cause the glyph to be displayed | |
939 on top of the text position specified in the marker stored in | |
940 `overlay-arrow-position'. | |
941 | |
942 -- To use a glyph in a display table (i.e. to control the appearance of | |
943 any individual character), create the appropriate character glyphs | |
944 and then set a specification for the specifier `current-display-table', | |
945 which controls the appearance of characters. You can also set an | |
946 overriding display table for use with text displayed in a particular | |
947 face; see `set-face-display-table' and `make-display-table'. | |
948 | |
949 -- To use a glyph as the background pixmap of a face: Note that the | |
950 background pixmap of a face is actually an image specifier -- probably | |
951 the only place in XEmacs where an image specifier occurs outside of | |
952 a glyph. Similarly to how the glyph's image specifier works, you | |
953 don't create your own image specifier, but rather add specifications | |
954 to the existing one (using `set-face-background-pixmap'). Note that | |
955 the image instance that is generated in order to actually display the | |
956 background pixmap is of type `mono-pixmap', meaning that it's a two-color | |
957 image and the foreground and background of the image get filled in with | |
958 the corresponding colors from the face. | |
959 | |
960 It is extremely rare that you will ever have to specify a value for TYPE, | |
961 which should be one of `buffer' (used for glyphs in an extent, the modeline, | |
962 the toolbar, or elsewhere in a buffer), `pointer' (used for the mouse-pointer), | |
963 or `icon' (used for a frame's icon), and defaults to `buffer'. The only cases | |
964 where it needs to be specified is when creating icon or pointer glyphs, and | |
965 in both cases the necessary glyphs have already been created at startup and | |
966 are accessed through the appropriate variables, e.g. `text-pointer-glyph' | |
967 (or in general, `*-pointer-glyph') and `frame-icon-glyph'." | |
428 | 968 (let ((glyph (make-glyph-internal type))) |
969 (and spec-list (set-glyph-image glyph spec-list)) | |
970 glyph)) | |
971 | |
972 (defun buffer-glyph-p (object) | |
973 "Return t if OBJECT is a glyph of type `buffer'." | |
974 (and (glyphp object) (eq 'buffer (glyph-type object)))) | |
975 | |
976 (defun pointer-glyph-p (object) | |
977 "Return t if OBJECT is a glyph of type `pointer'." | |
978 (and (glyphp object) (eq 'pointer (glyph-type object)))) | |
979 | |
980 (defun icon-glyph-p (object) | |
981 "Return t if OBJECT is a glyph of type `icon'." | |
982 (and (glyphp object) (eq 'icon (glyph-type object)))) | |
983 | |
984 (defun make-pointer-glyph (&optional spec-list) | |
985 "Return a new `pointer-glyph' object with the specification list SPEC-LIST. | |
986 This is equivalent to calling `make-glyph', specifying a type of `pointer'. | |
442 | 987 See `make-glyph' for more information. |
428 | 988 |
442 | 989 It is extremely unlikely that you will ever need to create a pointer glyph. |
990 Instead, you probably want to be calling `set-glyph-image' on an existing | |
991 glyph, e.g. `text-pointer-glyph'." | |
428 | 992 (make-glyph spec-list 'pointer)) |
993 | |
994 (defun make-icon-glyph (&optional spec-list) | |
995 "Return a new `icon-glyph' object with the specification list SPEC-LIST. | |
996 This is equivalent to calling `make-glyph', specifying a type of `icon'. | |
442 | 997 See `make-glyph' for more information. |
428 | 998 |
442 | 999 It is extremely unlikely that you will ever need to create a icon glyph. |
1000 Instead, you probably want to be calling `set-glyph-image' on | |
1001 `frame-icon-glyph'." | |
428 | 1002 (make-glyph spec-list 'icon)) |
1003 | |
1004 (defun nothing-image-instance-p (object) | |
1005 "Return t if OBJECT is an image instance of type `nothing'." | |
1006 (and (image-instance-p object) (eq 'nothing (image-instance-type object)))) | |
1007 | |
1008 (defun text-image-instance-p (object) | |
1009 "Return t if OBJECT is an image instance of type `text'." | |
1010 (and (image-instance-p object) (eq 'text (image-instance-type object)))) | |
1011 | |
1012 (defun mono-pixmap-image-instance-p (object) | |
1013 "Return t if OBJECT is an image instance of type `mono-pixmap'." | |
1014 (and (image-instance-p object) (eq 'mono-pixmap | |
1015 (image-instance-type object)))) | |
1016 | |
1017 (defun color-pixmap-image-instance-p (object) | |
1018 "Return t if OBJECT is an image instance of type `color-pixmap'." | |
1019 (and (image-instance-p object) (eq 'color-pixmap | |
1020 (image-instance-type object)))) | |
1021 | |
1022 (defun pointer-image-instance-p (object) | |
1023 "Return t if OBJECT is an image instance of type `pointer'." | |
1024 (and (image-instance-p object) (eq 'pointer (image-instance-type object)))) | |
1025 | |
442 | 1026 (defun widget-image-instance-p (object) |
1027 "Return t if OBJECT is an image instance of type `widget'." | |
1028 (and (image-instance-p object) (eq 'widget (image-instance-type object)))) | |
1029 | |
428 | 1030 (defun subwindow-image-instance-p (object) |
442 | 1031 "Return t if OBJECT is an image instance of type `subwindow'." |
428 | 1032 (and (image-instance-p object) (eq 'subwindow (image-instance-type object)))) |
1033 | |
1034 ;;;;;;;;;; the built-in glyphs | |
1035 | |
1036 (defvar text-pointer-glyph (make-pointer-glyph) | |
1037 "*The shape of the mouse-pointer when over text. | |
1038 This is a glyph; use `set-glyph-image' to change it.") | |
1039 (set-glyph-face text-pointer-glyph 'pointer) | |
1040 | |
1041 (defvar nontext-pointer-glyph (make-pointer-glyph) | |
1042 "*The shape of the mouse-pointer when over a buffer, but not over text. | |
1043 This is a glyph; use `set-glyph-image' to change it. | |
1044 If unspecified in a particular domain, `text-pointer-glyph' is used.") | |
1045 (set-glyph-face nontext-pointer-glyph 'pointer) | |
1046 | |
1047 (defvar modeline-pointer-glyph (make-pointer-glyph) | |
1048 "*The shape of the mouse-pointer when over the modeline. | |
1049 This is a glyph; use `set-glyph-image' to change it. | |
1050 If unspecified in a particular domain, `nontext-pointer-glyph' is used.") | |
1051 (set-glyph-face modeline-pointer-glyph 'pointer) | |
1052 | |
1053 (defvar selection-pointer-glyph (make-pointer-glyph) | |
1054 "*The shape of the mouse-pointer when over a selectable text region. | |
1055 This is a glyph; use `set-glyph-image' to change it. | |
1056 If unspecified in a particular domain, `text-pointer-glyph' is used.") | |
1057 (set-glyph-face selection-pointer-glyph 'pointer) | |
1058 | |
1059 (defvar busy-pointer-glyph (make-pointer-glyph) | |
1060 "*The shape of the mouse-pointer when XEmacs is busy. | |
1061 This is a glyph; use `set-glyph-image' to change it. | |
1062 If unspecified in a particular domain, the pointer is not changed | |
1063 when XEmacs is busy.") | |
1064 (set-glyph-face busy-pointer-glyph 'pointer) | |
1065 | |
1066 (defvar toolbar-pointer-glyph (make-pointer-glyph) | |
1067 "*The shape of the mouse-pointer when over a toolbar. | |
1068 This is a glyph; use `set-glyph-image' to change it. | |
1069 If unspecified in a particular domain, `nontext-pointer-glyph' is used.") | |
1070 (set-glyph-face toolbar-pointer-glyph 'pointer) | |
1071 | |
1072 (defvar divider-pointer-glyph (make-pointer-glyph) | |
1073 "*The shape of the mouse-pointer when over a window divider. | |
1074 This is a glyph; use `set-glyph-image' to change it. | |
1075 If unspecified in a particular domain, `nontext-pointer-glyph' is used.") | |
1076 (set-glyph-face divider-pointer-glyph 'pointer) | |
1077 | |
1078 ;; The following three are in C. | |
1079 (if (featurep 'menubar) | |
1080 (set-glyph-face menubar-pointer-glyph 'pointer)) | |
1081 (if (featurep 'scrollbar) | |
1082 (set-glyph-face scrollbar-pointer-glyph 'pointer)) | |
1083 (set-glyph-face gc-pointer-glyph 'pointer) | |
1084 | |
1085 ;; Now add the magic access/set behavior. | |
4597
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1086 (loop |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1087 for sym in '(define-constant-glyphs text-pointer-glyph nontext-pointer-glyph |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1088 modeline-pointer-glyph selection-pointer-glyph |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1089 busy-pointer-glyph gc-pointer-glyph divider-pointer-glyph |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1090 toolbar-pointer-glyph menubar-pointer-glyph |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1091 scrollbar-pointer-glyph octal-escape-glyph |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1092 control-arrow-glyph invisible-text-glyph hscroll-glyph |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1093 truncation-glyph continuation-glyph frame-icon-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1094 with set-value-handler = #'(lambda (sym args fun harg handler) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1095 (error 'invalid-change |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1096 (format |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1097 "Use `set-glyph-image' to set `%s'" |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1098 sym))) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1099 with make-unbound-handler = #'(lambda (sym args fun harg handler) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1100 (error 'invalid-change |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1101 (format |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1102 "Can't `makunbound' `%s'" sym))) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1103 with make-local-handler = |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1104 #'(lambda (sym args fun harg handler) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1105 (error 'invalid-change |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1106 (format "Use `set-glyph-image' to make local values for `%s'" sym))) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1107 do |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1108 (dontusethis-set-symbol-value-handler sym 'set-value set-value-handler) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1109 (dontusethis-set-symbol-value-handler sym 'make-unbound make-unbound-handler) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1110 (dontusethis-set-symbol-value-handler sym 'make-local make-local-handler) |
428 | 1111 (put sym 'const-glyph-variable t)) |
1112 | |
1113 ;; backwards compatibility garbage | |
1114 | |
1115 ;; It might or might not be garbage, but it's rude. Make these | |
3061 | 1116 ;; `compatible' instead of `obsolete'. -slb |
4597
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1117 (loop |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1118 for (old new) in '((x-pointer-shape text-pointer-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1119 (x-nontext-pointer-shape nontext-pointer-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1120 (x-mode-pointer-shape modeline-pointer-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1121 (x-selection-pointer-shape selection-pointer-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1122 (x-busy-pointer-shape busy-pointer-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1123 (x-gc-pointer-shape gc-pointer-glyph) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1124 (x-toolbar-pointer-shape toolbar-pointer-glyph)) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1125 with set-handler = #'(lambda (sym args fun harg handler) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1126 (let ((value (car args))) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1127 (if (null value) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1128 (remove-specifier harg 'global) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1129 (set-glyph-image (symbol-value harg) value)))) |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1130 do |
428 | 1131 (define-compatible-variable-alias old new) |
4597
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1132 (dontusethis-set-symbol-value-handler old 'set-value set-handler)) |
428 | 1133 |
1134 ;; for subwindows | |
1135 (defalias 'subwindow-xid 'image-instance-subwindow-id) | |
1136 (defalias 'subwindow-width 'image-instance-width) | |
1137 (defalias 'subwindow-height 'image-instance-height) | |
1138 ;;;;;;;;;; initialization | |
1139 | |
1140 (defun init-glyphs () | |
1141 ;; initialize default image types | |
1142 (if (featurep 'x) | |
1143 (set-console-type-image-conversion-list 'x | |
1144 `(,@(if (featurep 'xpm) '(("\\.xpm\\'" [xpm :file nil] 2))) | |
4818
1360b0c147c1
Handle bitmap files in bitmap directory properly
Didier Verna <didier@lrde.epita.fr>
parents:
4708
diff
changeset
|
1145 ("\\.xbm\\'" [xbm :file nil] 2) |
1360b0c147c1
Handle bitmap files in bitmap directory properly
Didier Verna <didier@lrde.epita.fr>
parents:
4708
diff
changeset
|
1146 ("/bitmaps/" [xbm :file nil] 2) |
428 | 1147 ,@(if (featurep 'xpm) '(("\\`/\\* XPM \\*/" [xpm :data nil] 2))) |
1148 ,@(if (featurep 'xface) '(("\\`X-Face:" [xface :data nil] 2))) | |
1149 ,@(if (featurep 'gif) '(("\\.gif\\'" [gif :file nil] 2) | |
1150 ("\\`GIF8[79]" [gif :data nil] 2))) | |
1151 ,@(if (featurep 'jpeg) '(("\\.jpe?g\\'" [jpeg :file nil] 2))) | |
1152 ;; all of the JFIF-format JPEG's that I've seen begin with | |
1153 ;; the following. I have no idea if this is standard. | |
1154 ,@(if (featurep 'jpeg) '(("\\`\377\330\377\340\000\020JFIF" | |
1155 [jpeg :data nil] 2))) | |
1156 ,@(if (featurep 'png) '(("\\.png\\'" [png :file nil] 2))) | |
1157 ,@(if (featurep 'png) '(("\\`\211PNG" [png :data nil] 2))) | |
4363
6a17ac5da3c4
Accept strings as glyph instantiators, fix control-arrow-glyph, etc.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4226
diff
changeset
|
1158 ("" [string :data nil] 2) |
446 | 1159 ("" [nothing])))) |
428 | 1160 ;; #### this should really be formatted-string, not string but we |
1161 ;; don't have it implemented yet | |
1162 (if (featurep 'tty) | |
1163 (progn | |
1164 (set-console-type-image-conversion-list | |
1165 'tty | |
4226 | 1166 '(("\\.xpm\\'" [string :data nil] 2) |
1167 ("\\.xbm\\'" [string :data nil] 2) | |
4818
1360b0c147c1
Handle bitmap files in bitmap directory properly
Didier Verna <didier@lrde.epita.fr>
parents:
4708
diff
changeset
|
1168 ("/bitmaps/" [string :data nil] 2) |
4226 | 1169 ;; #define could also mean a bitmap as well as a version 1 XPM. Who |
1170 ;; cares. | |
1171 ("^#define" [string :data "[xpm]"]) | |
428 | 1172 ("\\`/\\* XPM \\*/" [string :data "[xpm]"]) |
4226 | 1173 ("\\`X-Face:" [string :data "[xface]"]) |
1174 ("\\.gif\\'" [string :data nil] 2) | |
1175 ("\\`GIF8[79]" [string :data "[gif]"]) | |
1176 ("\\.jpe?g\\'" [string :data nil] 2) | |
428 | 1177 ("\\`\377\330\340\000\020JFIF" [string :data "[jpeg]"]) |
4226 | 1178 ;; all of the JFIF-format JPEG's that I've seen begin with |
1179 ;; the following. I have no idea if this is standard. | |
1180 ("\\`\377\330\377\340\000\020JFIF" [string :data "[jpeg]"]) | |
1181 ("\\.png\\'" [string :data nil] 2) | |
1182 ("\\`\211PNG" [string :data "[png]"]) | |
4363
6a17ac5da3c4
Accept strings as glyph instantiators, fix control-arrow-glyph, etc.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4226
diff
changeset
|
1183 ("" [string :data nil] 2) |
428 | 1184 ;; this last one is here for pointers and icons and such -- |
1185 ;; strings are not allowed so they will be ignored. | |
1186 ("" [nothing]))) | |
1187 | |
1188 ;; finish initializing truncation glyph -- created internally | |
1189 ;; because it has a built-in bitmap | |
1190 (set-glyph-image truncation-glyph "$" 'global 'tty) | |
1191 | |
1192 ;; finish initializing continuation glyph -- created internally | |
1193 ;; because it has a built-in bitmap | |
1194 (set-glyph-image continuation-glyph "\\" 'global 'tty) | |
1195 | |
1196 ;; finish initializing hscroll glyph -- created internally | |
1197 ;; because it has a built-in bitmap | |
1198 (set-glyph-image hscroll-glyph "$" 'global 'tty))) | |
1199 | |
4226 | 1200 ;; For streams, we don't want images at all -- dvl |
1201 (set-console-type-image-conversion-list 'stream '(("" [nothing]))) | |
1202 | |
1203 | |
428 | 1204 (set-glyph-image octal-escape-glyph "\\") |
1205 (set-glyph-image control-arrow-glyph "^") | |
1206 (set-glyph-image invisible-text-glyph " ...") | |
1207 ;; (set-glyph-image hscroll-glyph "$") | |
1208 | |
1209 (let ((face (make-face 'border-glyph | |
1210 "Truncation and continuation glyphs face"))) | |
1211 (set-glyph-face continuation-glyph face) | |
1212 (set-glyph-face truncation-glyph face) | |
1213 (set-glyph-face hscroll-glyph face)) | |
1214 | |
1215 ;; finish initializing xemacs logo -- created internally because it | |
1216 ;; has a built-in bitmap | |
1217 (if (featurep 'xpm) | |
1218 (set-glyph-image xemacs-logo | |
1219 (concat "../etc/" | |
1220 (if emacs-beta-version | |
1221 "xemacs-beta.xpm" | |
1222 "xemacs.xpm")) | |
1223 'global 'x)) | |
1224 (cond ((featurep 'xpm) | |
1225 (set-glyph-image frame-icon-glyph | |
1226 (concat "../etc/" "xemacs-icon.xpm") | |
1227 'global 'x)) | |
1228 ((featurep 'x) | |
1229 (set-glyph-image frame-icon-glyph | |
1230 (concat "../etc/" "xemacs-icon2.xbm") | |
1231 'global 'x))) | |
1232 | |
1233 (if (featurep 'tty) | |
1234 (set-glyph-image xemacs-logo | |
1235 "XEmacs <insert spiffy graphic logo here>" | |
1236 'global 'tty)) | |
1237 ) | |
1238 | |
1239 (init-glyphs) | |
1240 | |
4597
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1241 (unintern 'init-glyphs) ;; This was dump time thing, no need to keep the |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1242 ;; function around. |
7191a7b120f1
Some cosmetic namespace cleanup, glyphs.el, coding.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4363
diff
changeset
|
1243 |
4708
1cecc3e9f0a0
Use giflib or libungif to provide GIF support, instead of using internal
Jerry James <james@xemacs.org>
parents:
4597
diff
changeset
|
1244 ;;; glyphs.el ends here. |