annotate lisp/utils/xbm-button.el @ 131:869e1851236b xemacs-20-1p4

Import from CVS: tag xemacs-20-1p4
author cvs
date Mon, 13 Aug 2007 09:29:07 +0200
parents 376386a54a3c
children
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 XBM 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 xbm-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 'xbm-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 xbm-button-version "1.00"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 "Version string for xbm-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 xbm-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 xbm-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 xbm-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 "000011000001111110000011110101111111000111111110111111110001111010011110011110111100001111011110111101111000001111000111101110000111000111110001111111000011111000011111110000111101011111111011110011101111000111011110111101110111101111011110111011111111000000000111000000000000000001110000000000011100000000011100000001100011011100000011100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000011000001000111100011110000111000111110001110011111100111100011110001000000001100000111100000010100011110000110001000000010000001110000000100000010100000000000000000000000000000000001111000110111101100000000011010100000000000000000000000100111100100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "000011000000110011000110001100110001100011000110011000110011000110001100001100011000000110001100010000110000000111000111000111000010001100011000110001100110001100001100011001100011011011011001100001000110000010001100011000100011000100001100010011000111000000000011000000000000000000110000000000110100000000001100000001100011001100000001100000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000100100111001100110110011000111000111100010011011111101100110110011010000000001100011000010000010100110111001101111000000010000011001000010101000100010000000000000000000000000000000001100001100001100110000000011010100000000000000000000000101100110110000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 "000101100000110011001100000100110000110011000010011000010110000010001100001100011000000110001100100000110000000111000111000111100010011000001100110001101100000110001100011001100001010011001001100001000110000010001100011000100011101000001100010010001110000000000011000000000000000000110000000000110000000110001100000000000000001100000001100000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000001100110011001100110110011001011000100000110011010001001100010110011011000000001100100111101001111110100100011001010000000111000011010000001110001100011000000000000000000000000000100001100001100001100110000000001010100000000000000000000000101100110010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 "000101100000110011001100000100110000110011001000011001010110000010001100001100011000000110001101000000110000000101101011000101110010011000001100110001101100000110001100011001111000010011001001100001000011000100000110101101000001111000000110100000011100001111000011011000001110000110110000111001111100111100001101100011100111001101110001100111011001100011101100000111000111011000001101100111011001111011111011101110011110111011101111011101110111011110111011111101100110011000000110000011001011000111100110000000011000110100110011011000000001100101001101000101000110100011001010011000101000001100111010101001000001000000000000000000000000000100001100001100001100110011011010000000000000110000110000001100000110011000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 "001000110000111110001100000000110000110011111000011111000110000000001111111100011000000110001111100000110000000101101011000100111010011000001100110011001100000110001111100000111110000011000001100001000011000100000110101101000000111000000110100000011000001001100011101110111011011101110011101100110001100110001110110001100011001101100001100011101110110001110110011101110011101110111011100011111010001001100001100110001100010001100110001000110010001100010010011101100110011000001100001100010011000100110111110000011000111100011111000001100101101011011001000101000011110011010100110101101100011110010000100011000001100000000000000001111110000100001100001000001100010011011000000000000011100000011100001000001100001000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 "001111110000110001101100000000110000110011001000011001000110001111001100001100011000000110001101110000110000000101101011000100011110011000001100111110001101100110001100110000001111000011000001100001000001101000000110101101000001011100000011000000111000000111100011000110110000011000110011111100110001100110001100110001100011001111000001100011001100110001100110011000110011000110110001100011000011110001100001100110000110100000110111010000011100000110100000111001100110011000011000000011010011000000110110011000110000101110000011000011111101101011011010011111100000111001100101100101000100100111100000000011000001101111110000000000000000111111101100010000001100001000000000000000001110000000000111011000010000001100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "010000011000110001101100000100110000110011000010011000000110000110001100001100011001100110001100110000110000100100110011000100001110011000001100110000001110010110001100110001000011000011000001100001000001101000000011000110000001001110000011000001110001011001100011000110110000011000110011000000110000111100001100110001100011001101100001100011001100110001100110011000110011000110110001100011000001111001100001100110000110100000110111010000011100000110100001110001100110011000100010110011011111101100110110011000110001000110110011000010011000001001101100001010000110101000001001100100000001100011100000000011000001100000000000000001111110000100001100001000001100010000000000000000000011100000011100010000000000000100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "010000011000110001100110001100110001100011000110011000000011000110001100001100011001100110001100111000110001100100110011000100000110001100011000110000000110011100001100011101100011000011000001110011000000110000000011000110000010000110000011000011100011011011100011001110111011011101110011101100110001000000001100110001100011001100110001100011001100110001100110011101110011101110111011100011000010001001100001101110000011000000011001100000100110000011000011100100100100011001111110110011000011001100110110011000110001100110110010000000000001100100000010001010000110101000001001101000000001110011111000000001000001000000000000000000000000000100001100001100001100110011011000000001100000110110110000010000011000000110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 "111000111101111111000011111001111111000111111110111100000001111010011110011110111100111000011110011101111111101110110111101110000010000111110001111000000011111000011110011001011110000111100000111110000000110000000011000110000111001111000111100011111111001101110010111000001110000110111000111001111001111110011110111011110011011110111011110111101110111011110111000111000011011000001101100111100011110000110000110111000011000000011001100001110111000011000011111100011000111101111110011110000111100111100011110000110000111100011100000000000001100011111100001010000011110000010000110000000000111100110000000001100011000000000000000000000000000100001100001100001100110011011000000001100000000110000000010000011000000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111000000000000000011000000000000000000000000000000000000000000000011000000000001100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000100010000000000000000000000000000000001100001100001100110001000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000011000000000000000011000000000000000000000000000000000000000000000011000000000001100000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000111111100000000000000001111000110111101100010000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111110000000000000000110000000000000000000000000000000000000000000000111100000000011110000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
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 xbm-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 xbm-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 xbm-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 xbm-bit-lines-to-xbm-bits (&optional beg end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "Convert lines of bits to a string of chars containing the bits,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 plus width and height information. A list of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (WIDTH HEIGHT STRING)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 is returned. WIDTH is set to be the length of the first line,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ignoring the newline. HEIGHT is the number of lines in the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 BEG and END specify the region containing the bit lines. Each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 line should contain only the characters '0' or '1' and be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 terminated by a newline."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (or beg (setq beg (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (or end (setq end (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (let (octet octet-count bit-count b char width height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (set-buffer (setq b (get-buffer-create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 " xbm-button-bit-lines-to-xbm")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (erase-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (goto-char beg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (setq bit-count 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 height 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 width (- (save-excursion (end-of-line) (point)) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 octet 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (while (< (point) end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (setq char (char-after (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (cond ((= char ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq bit-count (1+ bit-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ((= char ?1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; least significant bit of octet is leftmost pixel.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (setq octet (+ octet (expt 2 bit-count))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 bit-count (1+ bit-count)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ((= char ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (setq height (1+ height))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; output octet whenever we have retrived 8 bits or when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; a newline is encountered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (cond ((or (= bit-count 8) (= char ?\n))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (set-buffer b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (insert-char octet))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (setq bit-count 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 octet 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (forward-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (set-buffer b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;; otput last octet if any bits collected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (cond ((not (= bit-count 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (insert-char octet)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (list width height (buffer-substring nil nil b)) )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (defun xbm-button-create (text border-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 "Returns a list of XBM image instantiators for a button displaying TEXT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 The list is of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (UP DOWN DISABLED)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 where UP, DOWN, and DISABLED are the up, down and disabled image
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 instantiators for the button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 BORDER-THICKNESS specifies how many pixels should be used for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 borders on the edges of the buttons. It should be a positive integer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 or 0 to mean no border."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (set-buffer (get-buffer-create " xbm-button-create"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; create the correct number of lines for the pixels for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (insert-char ?\n (length xbm-button-font-pixel-lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (let ((i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (str (make-string 1 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (lim (length text))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (bg-char ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 font-pixel-lines q)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ;; loop through text, adding the character pixels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (while (< i lim)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (aset str 0 (aref text i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (if (null (setq q (assoc str xbm-button-font-line-indices)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 nil ; no pixel data for this character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (setq font-pixel-lines xbm-button-font-pixel-lines)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (while font-pixel-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 (if (not (bolp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; Insert space before some of the characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; This isn't really correct for this font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; but doing it right is too hard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;; This isn't TeX after all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (if (memq (aref str 0) '(?, ?. ?\" ?! ?| ?\' ?\`))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (insert-char bg-char 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;; offset the start a bit from the left edge of the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (insert-char bg-char xbm-button-horizontal-padding))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ;; insert the character pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (insert (substring (car font-pixel-lines) (nth 1 q) (nth 2 q)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (forward-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (setq font-pixel-lines (cdr font-pixel-lines))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (setq i (1+ i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;; now offset the text from the right edge of the button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (insert-char bg-char xbm-button-horizontal-padding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (forward-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 (let ((fg-char ?1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (bg-char ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 i len up down disabled)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;; find the length of a pixel line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (setq len (- (point) (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;; offset text from the top of the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (setq i xbm-button-vertical-padding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (insert-char bg-char len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;; offset text from the bottom of the button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (setq i xbm-button-vertical-padding)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (insert-char bg-char len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;; add borders to the pixel lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (insert-char fg-char border-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (insert-char fg-char border-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (forward-line))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; add top and bottom border lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (setq i border-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (insert-char fg-char (+ len (* 2 border-thickness)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (setq i border-thickness)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 (while (> i 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (insert-char fg-char (+ len (* 2 border-thickness)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (insert ?\n)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (setq i (1- i)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;; convert the pixel lines to octets of xbm bit data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (setq up (xbm-bit-lines-to-xbm-bits)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 down up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 ;; stipple the foreground pixels for the disabled button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (let ((str (make-string 1 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (bit 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 lim line-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (aset str 0 fg-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (while (not (eobp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (setq lim (save-excursion (end-of-line) (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 line-start (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (while (search-forward str lim t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (if (= (% (- (point) line-start) 2) bit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (subst-char-in-region (1- (point)) (point) fg-char bg-char t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (if (zerop bit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (setq bit 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (setq bit 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (forward-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (setq disabled (xbm-bit-lines-to-xbm-bits))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (list (vector 'xbm ':data up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (vector 'xbm ':data down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (vector 'xbm ':data disabled)) )))