annotate lisp/utils/xpm-button.el @ 82:6a378aca36af r20-0b91

Import from CVS: tag r20-0b91
author cvs
date Mon, 13 Aug 2007 09:07:36 +0200
parents 376386a54a3c
children 43dd3413c7c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; Create XPM text buttons under XEmacs (requires 19.12 or beyond)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;; Copyright (C) 1995 Kyle E. Jones
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; This program is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; the Free Software Foundation; either version 1, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; This program is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;; A copy of the GNU General Public License can be obtained from this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; program's author (send electronic mail to kyle@uunet.uu.net) or from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; Synched up with: Not in FSF.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;;; Send bug reports to kyle@wonderworks.com
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; The sole interface function is xpm-button-create.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (provide 'xpm-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (defvar xpm-button-version "1.02"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 "Version string for xpm-button.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defvar xpm-button-vertical-padding 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 "Number of pixels between the text and the top/bottom of the button.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (defvar xpm-button-horizontal-padding 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 "Number of pixels between the text and the left/right edges of the button.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defvar xpm-button-font-pixel-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 " xx xxxxxx xxxx x xxxxxxx xxxxxxxx xxxxxxxx xxxx x xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx xxx xxxxx xxxxxxx xxxxx xxxxxxx xxxx x xxxxxxxx xxxx xxx xxxx xxx xxxx xxxx xxx xxxx xxxx xxxx xxx xxxxxxxx xxx xxx xxx xxx xx xx xxx xxx x xx x xxxx xxxx xxx xxxxx xxx xxxxxx xxxx xxxx x xx xxxx x x xxxx xx x x xxx x x x xxxx xx xxxx xx xx x x x xxxx x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 " xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx x xx xxx xxx xxx x xx xx xx xx xx xx xx xx xx xx xx xx xx xx x xx x xx xx x xx x xx x xx xxx xx xx xx x xx xx xx xx xx xx x x xxx xx xx xx xx xxx xxxx x xx xxxxxx xx xx xx xx x xx xx x x x xx xxx xx xxxx x xx x x x x x x xx xx xx xx xx x x x xx xx xx x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 " x xx xx xx xx x xx xx xx x xx x xx x xx xx xx xx xx x xx xxx xxx xxxx x xx xx xx xx xx xx xx xx xx x x xx x xx x xx x xx xx x xxx x xx x x xxx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx x xx x xx xx x x xx x xx xx xx xx x xxxx x xxxxxx x x xx x x xxx xx x xxx xx xx x xx xx xx xx x x x x xx xx x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 " x xx xx xx xx x xx xx xx x xx x x xx x xx xx xx xx xx x xx x xx x xx x xxx x xx xx xx xx xx xx xx xx xxxx x xx x xx x xx x xx x xx x xxxx xx x xxx xxxx xx xx xxx xx xx xxx xxxxx xxxx xx xx xxx xxx xx xxx xx xxx xx xx xxx xx xxx xxx xx xx xx xxx xx xxxx xxxxx xxx xxx xxxx xxx xxx xxxx xxx xxx xxx xxxx xxx xxxxxx xx xx xx xx xx x xx xxxx xx xx xx x xx xx xx xx x x xx x x x xx x xx x x xx x x xx xxx x x x x x x xx xx xx xx xx xx x xx xx xx xx xx x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 " x xx xxxxx xx xx xx xxxxx xxxxx xx xxxxxxxx xx xx xxxxx xx x xx x xx x xxx x xx xx xx xx xx xx xxxxx xxxxx xx xx x xx x xx x xx x xxx xx x xx x xx xxx xxx xxx xx xxx xxx xxx xx xx xx xx xxx xx xx xx xx xx xx xxx xxx xx xxx xx xxx xxx xxx xxx xxx xxx xxxxx x x xx xx xx xx x xx xx x xx x xx x x xxx xx xx xx xx xx x xx x xx xxxxx xx xxxx xxxxx xx x xx x xx xx x x x xxxx xx x x xx x xx xx xxxx x x xx xx xxxxxx x xx x xx x xx xx xxx xxx x xx x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 " xxxxxx xx xx xx xx xx xx x xx x xx xxxx xx xx xx xx xx xxx xx x xx x xx x xxxx xx xx xxxxx xx xx xx xx xx xxxx xx xx x xx x xx x xx x x xxx xx xxx xxxx xx xx xx xx xx xxxxxx xx xx xx xx xx xx xx xxxx xx xx xx xx xx xx xx xx xx xx xx xx xx xxxx xx xx xx xx x xx xxx x xxx xx x xxx xx xx xx xx xx x xx xx xx xx xx x xxx xx xxxxxx xx x xx xx x xxxxxx xxx xx x xx x x x x xxxx xx xx xxxxxx xxxxxxx xx x xx x xxx xxx xx x xx x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 " x xx xx xx xx x xx xx xx x xx xx xx xx xx xx xx xx xx xx xx x x xx xx x xxx xx xx xx xxx x xx xx xx x xx xx xx x xx x xx xx x xxx xx xxx x xx xx xx xx xx xx xx xx xx xxxx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xxxx xx xx xx xx x xx xxx x xxx xx x xxx xx xx xx x x xx xx xxxxxx xx xx xx xx xx x xx xx xx x xx x xx xx x x xx x x x xx x xx xxx xx xx xxxxxx x xx x xx x xxx xxx x x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 " x xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xxx xx xx x xx xx x xx xx xx xx xx xxx xx xxx xx xx xx xxx xx xx xx xx x xx xx xxx xx xx xxx xx xxx xxx xx xxx xxx xxx xx xx x xx xx xx xx xx xx xx xx xx xx xx xx xxx xxx xxx xxx xxx xxx xx x x xx xx xxx xx xx xx x xx xx xxx x x x xx xxxxxx xx xx xx xx xx xx xx xx xx xx xx x xx x x x x xx x x x xx x xxx xxxxx x x x xx xx xx xx xx xx xx xx xx xx x xx xx x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 "xxx xxxx xxxxxxx xxxxx xxxxxxx xxxxxxxx xxxx xxxx x xxxx xxxx xxxx xxx xxxx xxx xxxxxxxx xxx xx xxxx xxx x xxxxx xxxx xxxxx xxxx xx x xxxx xxxx xxxxx xx xx xx xxx xxxx xxxx xxxxxxxx xx xxx x xxx xxx xx xxx xxx xxxx xxxxxx xxxx xxx xxxx xx xxxx xxx xxxx xxxx xxx xxx xxxx xxx xxx xx xx xx xx xxxx xxxx xx xx xxx xx xx xx xxx xxx xx xxxxxx xx xxxx xxxxxx xxxx xxxx xxxx xxxx xx xxxx xxx xx xxxxxx x x xxxx x xx xxxx xx xx xx x xx xx xx xx xx xx xx xx x xx x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 " xxxx xxxxxx xx xx xx x x x x xx xx xx xx x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 " xx x xx xx xx xx xxx x x xxxxxxx xxxx xx xxxx xx x x "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 " xxxxx xx xxxx xxxx xx "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 "List of strings representing pixel lines for the button font.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (defvar xpm-button-font-line-indices
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 '(("A" 0 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ("B" 11 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ("C" 20 28)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ("D" 29 38)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ("E" 39 47)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ("F" 48 56)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ("G" 57 66)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ("H" 67 77)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ("I" 78 82)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 ("J" 83 90)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ("K" 91 100)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 ("L" 101 109)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ("M" 110 121)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ("N" 122 132)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ("O" 133 142)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ("P" 143 151)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ("Q" 152 162)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ("R" 163 172)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ("S" 173 180)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ("T" 181 189)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ("U" 190 199)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ("V" 200 210)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 ("W" 211 224)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 ("X" 225 234)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 ("Y" 235 243)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ("Z" 244 252)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ("a" 253 260)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ("b" 261 269)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ("c" 270 276)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ("d" 277 285)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ("e" 286 292)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ("f" 293 298)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ("g" 299 306)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ("h" 307 315)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 ("i" 316 320)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ("j" 321 324)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ("k" 325 333)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 ("l" 334 338)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ("m" 339 351)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ("n" 352 360)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ("o" 361 368)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ("p" 369 377)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ("q" 378 386)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ("r" 387 393)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ("s" 394 399)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ("t" 400 405)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ("u" 406 414)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ("v" 415 423)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ("w" 424 436)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ("x" 437 444)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ("y" 445 453)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ("z" 454 460)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ("0" 461 467)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ("1" 468 472)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ("2" 473 479)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ("3" 480 486)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ("4" 487 493)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ("5" 494 500)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ("6" 501 507)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ("7" 508 514)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ("8" 515 521)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ("9" 522 528)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ("`" 529 531)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ("~" 532 538)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ("!" 539 541)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ("@" 542 552)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ("#" 553 560)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ("$" 561 567)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ("%" 568 580)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ("^" 581 586)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ("&" 587 597)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 ("*" 598 603)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ("(" 604 608)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (")" 609 613)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ("-" 614 620)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ("_" 621 628)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ("=" 629 635)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ("+" 636 643)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ("[" 644 648)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ("{" 649 653)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ("]" 654 658)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ("}" 659 663)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (";" 664 666)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (":" 667 669)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ("'" 670 672)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 ("\"" 673 676)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ("," 677 679)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ("<" 680 686)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ("." 687 689)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (">" 690 696)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ("/" 697 700)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ("?" 701 707)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ("\\" 708 713)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ("|" 714 715)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (" " 716 719))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 "Indices into the xpm-button-font-pixel-lines strings for each character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 Format is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (STR START END)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 STR contains the character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 START is where the character's pixels start in each string of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 xpm-button-font-pixel-lines (0 is the index of the first pixel).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 END is the index of the position after the last pixel of the character.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (defun xpm-button-color-rgb-components (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "Return the RGB components of COLOR as a list of integers (R G B).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 16-bit values are always returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 #FEFEFE and rgb:fe/fe/fe style color specifications are parsed directly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 into their components."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (color-instance-rgb-components (make-color-instance color)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (defun xpm-button-compute-contrast-color (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "Compute a contrasting color for COLOR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 The new color is created by xor-ing the RGB values of COLOR with all ones."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (let* ((rgb (xpm-button-color-rgb-components color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (r (logxor (nth 0 rgb) 65535))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (g (logxor (nth 1 rgb) 65535))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (b (logxor (nth 2 rgb) 65535)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (format "rgb:%04x/%04x/%04x" r g b)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defun xpm-button-compute-shadow-colors (color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "Compute shadow colors for COLOR.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 COLOR should be a string naming a color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 Returns (COLOR1 . COLOR2) where COLOR1 is the brighter shadow color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 and COLOR2 is the dimmer color."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (let* ((rgb (xpm-button-color-rgb-components color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (r (nth 0 rgb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (g (nth 1 rgb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (b (nth 2 rgb))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (bright-r (/ (* r 12) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (bright-g (/ (* g 12) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (bright-b (/ (* b 12) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (dim-r (/ (* r 8) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (dim-g (/ (* g 8) 10))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 (dim-b (/ (* b 8) 10)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (if (> bright-r 65535)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (setq bright-r 65535))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (if (> bright-g 65535)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (setq bright-g 65535))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (if (> bright-b 65535)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (setq bright-b 65535))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (cons (format "rgb:%04x/%04x/%04x" bright-r bright-g bright-b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (format "rgb:%04x/%04x/%04x" dim-r dim-g dim-b))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (defun xpm-button-create (text shadow-thickness fg-color bg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 "Returns a list of XPM image instantiators for a button displaying TEXT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 The list is of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (UP DOWN DISABLED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 where UP, DOWN, and DISABLED are the up, down and disabled image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 instantiators for the button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 SHADOW-THICKNESS specifies how many pixels should be used for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 shadows on the edges of the buttons. It should be a positive integer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 or 0 to mean no shadows on the edges.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 FG-COLOR is the color used to display the text. It should be a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 BG-COLOR is the background color the text will be displayed upon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 It should be a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (set-buffer (get-buffer-create " xpm-button"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; create the correct number of lines for the pixels for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (insert-char ?\n (length xpm-button-font-pixel-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (let ((i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (str (make-string 1 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (lim (length text))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (bg-char ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 font-pixel-lines q)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; loop through text, adding the character pixels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (while (< i lim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (aset str 0 (aref text i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (if (null (setq q (assoc str xpm-button-font-line-indices)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 nil ; no pixel data for this character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (setq font-pixel-lines xpm-button-font-pixel-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (while font-pixel-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (if (not (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;; Insert space before some of the characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ;; This isn't really correct for this font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ;; but doing it right is too hard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;; This isn't TeX after all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (if (memq (aref str 0) '(?, ?. ?\" ?! ?| ?\' ?\`))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (insert-char bg-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; offset the start a bit from the left edge of the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (insert-char bg-char xpm-button-horizontal-padding))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; insert the character pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (insert (substring (car font-pixel-lines) (nth 1 q) (nth 2 q)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (forward-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (setq font-pixel-lines (cdr font-pixel-lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (setq i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ;; now offset the text from the right edge of the button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (insert-char bg-char xpm-button-horizontal-padding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (forward-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (let ((bright-char ?b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (dim-char ?d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (fg-char ?x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (bg-char ? )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (shadow-colors (xpm-button-compute-shadow-colors bg-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 i len up-string down-string disabled-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; find the length of a pixel line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 (setq len (- (point) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ;; offset text from the top of the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (setq i xpm-button-vertical-padding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (insert-char bg-char len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;; offset text from the bottom of the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (setq i xpm-button-vertical-padding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (insert-char bg-char len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 ;; add shadows to the pixel lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (insert-char bright-char shadow-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (insert-char dim-char shadow-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (forward-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;; add top and bottom shadow lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (setq i shadow-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (insert-char bright-char (+ len shadow-thickness i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (insert-char dim-char (- shadow-thickness i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (setq i shadow-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (insert-char bright-char i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (insert-char dim-char (+ len (* 2 shadow-thickness) (- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ;; add doublequotes, commas and XPM header goop.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (insert "\"")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (insert "\",")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (forward-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (insert "};\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; color map for the UP button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (insert (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 "/* XPM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 static char * button_xpm[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 \"%d %d 4 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (+ len (* shadow-thickness 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (+ (* xpm-button-vertical-padding 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (* shadow-thickness 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (length xpm-button-font-pixel-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 fg-char fg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 bg-char bg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 bright-char (car shadow-colors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 dim-char (cdr shadow-colors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (setq up-string (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (delete-region (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 ;; color map for the DOWN button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (insert (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 "/* XPM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 static char * button_xpm[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 \"%d %d 4 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (+ len (* shadow-thickness 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (+ (* xpm-button-vertical-padding 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (* shadow-thickness 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (length xpm-button-font-pixel-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 fg-char (xpm-button-compute-contrast-color fg-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 bg-char bg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 bright-char (cdr shadow-colors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 dim-char (car shadow-colors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (setq down-string (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (delete-region (point-min) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ;; color map for the DISABLED button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (insert (format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 "/* XPM */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 static char * button_xpm[] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 \"%d %d 4 1\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 \"%c c %s\",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (+ len (* shadow-thickness 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (+ (* xpm-button-vertical-padding 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (* shadow-thickness 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (length xpm-button-font-pixel-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 fg-char fg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 bg-char bg-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 bright-char (car shadow-colors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 dim-char (cdr shadow-colors)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;; stipple the foreground pixels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (let ((str (make-string 1 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (bit 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 lim line-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (aset str 0 fg-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (setq lim (save-excursion (end-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 line-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (while (search-forward str lim t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (if (= (% (- (point) line-start) 2) bit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (subst-char-in-region (1- (point)) (point) fg-char bg-char t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (if (zerop bit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (setq bit 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (setq bit 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (forward-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (setq disabled-string (buffer-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (list (vector 'xpm ':data up-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (vector 'xpm ':data down-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (vector 'xpm ':data disabled-string)) )))