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