annotate lisp/hyperbole/hui-em19-b.el @ 143:50e7fedfe353

Added tag r20-2b5 for changeset 1856695b1fa9
author cvs
date Mon, 13 Aug 2007 09:33:20 +0200
parents 8619ce7e4c50
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 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hui-em19-b.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: GNU Emacs V19 button highlighting and flashing support.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs V19 Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: faces, hypermedia
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
9 ;; ORG: InfoDock Associates
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 21-Aug-92
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
12 ;; LAST-MOD: 26-Feb-97 at 01:58:45 by Bob Weiner
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; It is for use with GNU Emacs V19.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Copyright (C) 1992-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;; This is truly prototype code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;; Can't use read-only buttons here because then outline-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; becomes unusable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (if (and hyperb:emacs19-p (or noninteractive hyperb:window-system))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (error "(hui-em19-b.el): Load only when running GNU Emacs V19 under a window system."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (require 'hvar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (require 'hbut)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 (defun hproperty:background ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 "Returns default background color for current frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 (or (face-background (make-face 'default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (cdr (assq 'background-color (frame-parameters)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "White"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (defun hproperty:foreground ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 "Returns default foreground color for current frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (or (face-foreground (make-face 'default))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (cdr (assq 'foreground-color (frame-parameters)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 "Black"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defvar hproperty:but-emphasize-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "*Non-nil means visually emphasize that button under mouse cursor is selectable.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defvar hproperty:but-flash-time 1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "*Machine specific value for empty loop counter, Emacs 19 button flash delay.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvar hproperty:item-highlight-color (hproperty:foreground)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Color with which to highlight list/menu selections.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 Call (hproperty:set-item-highlight <color>) to change value.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; Support NEXTSTEP and X window systems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (and (not (fboundp 'display-color-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (fboundp 'x-display-color-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (fset 'display-color-p 'x-display-color-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defun hproperty:but-add (start end face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Add between START and END a button using FACE in current buffer.
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
78 If `hproperty:but-emphasize-p' is non-nil when this is called, emphasize that
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 button is selectable whenever the mouse cursor moves over it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (let ((but (make-overlay start end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (overlay-put but 'face face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (if hproperty:but-emphasize-p (overlay-put but 'mouse-face 'highlight))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (defun hproperty:but-color ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "Return current color of buffer's buttons."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (if hproperty:color-ptr
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (car hproperty:color-ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (hproperty:foreground)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (defun hproperty:but-clear ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 "Delete all Hyperbole buttons from current buffer."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (let ((start (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (while (< start (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (mapcar (function (lambda (props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (if (eq (overlay-get props 'face) hproperty:but-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (delete-overlay props))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (overlays-at start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (setq start (next-overlay-change start)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (defun hproperty:but-create (&optional start-delim end-delim regexp-match)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 "Highlight all hyper-buttons in buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 Will use optional strings START-DELIM and END-DELIM instead of default values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 If END-DELIM is a symbol, e.g. t, then START-DELIM is taken as a regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 expression which matches an entire button string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 If REGEXP-MATCH is non-nil, only buttons matching this argument are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 highlighted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 70
diff changeset
109 If `hproperty:but-emphasize-p' is non-nil when this is called, emphasize that
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 button is selectable whenever the mouse cursor moves over it."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (hproperty:but-clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (hproperty:but-create-all start-delim end-delim regexp-match))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defun hproperty:but-create-all (&optional start-delim end-delim regexp-match)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "Mark all hyper-buttons in buffer for later highlighting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 Will use optional strings START-DELIM and END-DELIM instead of default values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 If END-DELIM is a symbol, e.g. t, then START-DELIM is taken as a regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 expression which matches an entire button string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 If REGEXP-MATCH is non-nil, only buttons matching this argument are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 highlighted."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (ebut:map (function (lambda (lbl start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (hproperty:but-add start end hproperty:but-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 start-delim end-delim regexp-match 'include-delims))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (defun hproperty:but-delete (&optional pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (let ((but (hproperty:but-get pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (if but (delete-overlay but))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;;; Private functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (defun hproperty:but-get (&optional pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (car (delq nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (mapcar (function (lambda (props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (if (memq (overlay-get props 'face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (list hproperty:but-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 hproperty:flash-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 props)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (overlays-at (or pos (point)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defmacro hproperty:list-cycle (list-ptr list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "Move LIST-PTR to next element in LIST or when at end to first element."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (` (or (and (, list-ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (setq (, list-ptr) (cdr (, list-ptr))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (setq (, list-ptr) (, list)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (defconst hproperty:color-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (if (eq window-system 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 '( "red" "blue" "paleturquoise4" "mediumpurple2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 "lightskyblue3" "springgreen2" "salmon" "yellowgreen" "darkorchid2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 "aquamarine4" "slateblue4" "slateblue1" "olivedrab1" "goldenrod4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 "goldenrod3" "cadetblue2" "burlywood1" "slategrey" "mistyrose"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 "limegreen" "lightcyan" "goldenrod" "gainsboro" "skyblue1" "honeydew"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 "yellow2" "tomato3" "skyblue" "purple4" "orange3" "bisque3" "bisque2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "grey34" "gray99" "gray63" "gray44" "gray37" "gray33" "gray26" "azure1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 "snow4" "peru" "red" "lightgoldenrod4" "mediumseagreen" "blush"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 "mediumorchid2" "lightskyblue1" "darkslateblue" "midnightblue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 "lightsalmon1" "lemonchiffon" "yellow" "lightsalmon" "coral"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 "dodgerblue3" "darkorange4" "blue" "royalblue4" "red" "green" "cyan"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 "darkviolet" "darksalmon" "darkorange" "blue" "pink" "magenta2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 "sienna4" "khaki2" "grey75" "grey74" "grey73" "grey69" "grey68" "grey35"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "grey13" "gray90" "gray81" "gray55" "gray51" "gray31" "snow2" "pink3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 "grey7" "gray1" "red4" "red3" "tan" "red" "yellow" "mediumvioletred"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 "lightslategrey" "lavenderblush4" "turquoise" "darkturquoise"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 "darkslategrey" "lightskyblue" "lightsalmon4" "lightsalmon3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 "forestgreen" "dodgerblue4" "orchid" "rosybrown4" "brown" "peachpuff3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 "palegreen3" "orangered2" "rose" "lightcyan4" "indianred4" "indianred3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 "seagreen2" "indianred" "deeppink1" "navyblue" "lavender" "grey"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "deeppink" "salmon4" "salmon3" "oldlace" "grey78" "grey77" "grey54"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 "grey45" "grey21" "gray97" "gray96" "gray95" "gray88" "gray87" "gray86"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 "gray70" "gray57" "gray38" "gray12" "gray11" "plum3" "linen" "gray9"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 "gray8" "blue4" "beige" "turquoise" "blue" "lemonchiffon4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 "darkseagreen1" "antiquewhite3" "mediumorchid" "springgreen"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 "turquoise4" "steelblue3" "mistyrose2" "lightcyan2" "red" "firebrick2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 "royalblue" "cadetblue" "skyblue3" "yellow3" "salmon1" "orange4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 "hotpink" "grey90" "gray56" "gray39" "gray18" "gray14" "plum4" "grey6"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 "gray6" "gold3" "gold1" "blue2" "tan2" "cyan" "mediumspringgreen"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 "darkolivegreen2" "goldenrod" "lightsteelblue" "brown" "whip"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 "chartreuse3" "violetred4" "royalblue2" "royalblue1" "papayawhip"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 "mistyrose3" "lightcyan1" "aquamarine" "skyblue4" "hotpink4" "hotpink3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 "hotpink2" "dimgray" "tomato" "grey66" "grey65" "grey64" "grey33"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "grey27" "gray76" "gray69" "gray68" "grey0" "azure" "green"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 "darkgoldenrod4" "darkgoldenrod3" "darkgoldenrod2" "darkgoldenrod"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 "brown" "lightsalmon2" "deepskyblue4" "deepskyblue3" "deepskyblue2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 "deepskyblue" "darkorange1" "violetred3" "violetred2" "violetred1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 "slateblue3" "slateblue2" "drab" "indianred1" "firebrick1" "cadetblue4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 "violetred" "rosybrown" "blue" "firebrick" "grey100" "wheat4" "grey79"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "grey76" "grey61" "gray93" "gray84" "gray65" "gray36" "gray32" "gray13"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 "gray10" "azure3" "snow1" "tan1" "gray" "darkolivegreen1" "blue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 "almond" "lavenderblush3" "lavenderblush2" "lavenderblush1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "darkolivegreen" "lavenderblush" "aquamarine2" "red" "olivedrab2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 "mistyrose4" "mistyrose1" "lightcyan3" "lightcoral" "chartreuse"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "peachpuff" "palegreen" "mintcream" "skyblue2" "moccasin" "tomato1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 "orchid3" "maroon3" "salmon" "grey81" "grey62" "grey39" "grey38"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "grey37" "gray92" "gray83" "gray66" "gray54" "gray50" "gray30" "gray19"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 "gray15" "azure4" "grey3" "tan3" "pink" "gray" "blue" "lightsteelblue2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 "lightsteelblue1" "green" "lightslategray" "lemonchiffon2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 "springgreen1" "greenyellow" "chartreuse2" "grey" "royalblue3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "powderblue" "peachpuff2" "palegreen2" "cream" "slateblue" "seashell2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 "deeppink2" "darkkhaki" "maroon4" "sienna" "grey71" "grey67" "grey18"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 "gray59" "gray43" "gray25" "bisque" "red1" "mediumslateblue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 "lightgoldenrod1" "goldenrod" "paleturquoise3" "lightskyblue4" "green"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 "yellow" "smoke" "blue" "white" "steelblue4" "rosybrown3" "peachpuff1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 "palegreen1" "blueviolet" "seashell4" "sienna3" "grey40" "gray91"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 "gray82" "gray5" "cyan2" "cyan1" "blue1" "snow" "lightgoldenrod2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 "lightslateblue" "mediumorchid3" "darkseagreen4" "springgreen3" "green"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 "slategray4" "slategray3" "slategray2" "blue" "peachpuff4" "palegreen4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "green" "orangered3" "goldenrod1" "ghostwhite" "firebrick4" "firebrick3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 "cadetblue3" "slategray" "seashell3" "honeydew3" "cornsilk4" "cornsilk2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 "purple1" "dimgrey" "khaki1" "ivory3" "grey70" "grey60" "grey32"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 "grey22" "grey12" "gray98" "gray89" "gray71" "gray64" "gray60" "gray49"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 "azure2" "gray3" "paleturquoise1" "mediumpurple1" "purple"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 "lemonchiffon1" "blue" "navajowhite3" "darkorchid1" "orange"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 "goldenrod2" "khaki" "chocolate2" "burlywood2" "honeydew1" "darkgreen"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 "thistle3" "thistle2" "thistle1" "thistle" "maroon2" "maroon1" "grey53"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 "grey44" "grey25" "gray74" "gray45" "gray41" "gray35" "gray27" "gray23"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 "gray16" "brown4" "wheat" "coral" "tan4" "lightgoldenrodyellow" "blue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 "green" "gray" "palevioletred3" "mediumpurple4" "mediumpurple3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 "saddlebrown" "blue" "darkorchid4" "darkorchid3" "puff" "olivedrab4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 "lightblue4" "lightpink" "lightgray" "honeydew2" "cornsilk1" "lace"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 "sienna1" "bisque4" "orchid" "khaki3" "grey84" "grey83" "grey82"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 "grey72" "grey52" "grey43" "grey26" "grey14" "grey10" "gray75" "gray53"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 "gray21" "gray20" "brown3" "grey8" "red2" "navy" "grey" "gold"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 "mediumaquamarine" "lightgoldenrod" "darkslategray4" "darkseagreen3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 "darkseagreen2" "antiquewhite4" "white" "springgreen4" "lightyellow4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 "white" "aquamarine1" "turquoise3" "steelblue2" "rosybrown2" "pink"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 "gray" "indianred2" "dodgerblue" "green" "seagreen1" "deeppink4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 "aliceblue" "magenta1" "pink" "sienna2" "orchid1" "gray100" "grey97"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 "grey94" "grey87" "grey86" "grey51" "grey42" "grey19" "gray94" "gray85"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "gray61" "brown2" "khaki" "grey1" "gold4" "blue" "green" "grey"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 "turquoise" "paleturquoise" "mediumorchid4" "antiquewhite2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 "lightyellow2" "violet" "salmon" "chartreuse1" "turquoise1" "sandybrown"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 "orangered1" "lightpink1" "lightblue2" "lightblue1" "grey" "seagreen4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 "seagreen3" "lightblue" "deeppink3" "burlywood" "seashell" "hotpink1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 "gray" "yellow4" "yellow" "purple" "orange" "ivory4" "grey99" "grey89"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 "grey63" "grey58" "grey49" "grey31" "grey24" "grey20" "green4" "green1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 "gray73" "gray67" "coral3" "coral2" "plum2" "pink4" "ivory" "gray4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 "gray2" "gold2" "aquamarine" "grey" "lightgoldenrod3" "darkolivegreen3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 "darkgoldenrod1" "goldenrod" "orchid" "chiffon" "navajowhite4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 "deepskyblue1" "lightyellow" "floralwhite" "blue" "mediumblue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 "chocolate4" "chocolate3" "burlywood4" "turquoise" "steelblue" "green"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 "lawngreen" "honeydew4" "seagreen" "orchid4" "wheat1" "violet" "ivory1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 "grey88" "grey85" "grey57" "grey56" "grey55" "grey48" "grey47" "grey46"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 "grey30" "grey17" "gray47" "gray29" "pink2" "grey5" "grey4" "green"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 "gray0" "brown" "lightsteelblue4" "darkolivegreen4" "palevioletred4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 "blue" "darkslategray3" "darkslategray2" "darkslategray1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 "blanchedalmond" "palegoldenrod" "blue" "lightseagreen" "lemonchiffon3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 "darkslategray" "green" "darkseagreen" "antiquewhite" "darkorange2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 "chartreuse4" "blue" "rosybrown1" "olivedrab3" "lightpink2" "orangered"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 "thistle4" "blue" "cornsilk" "salmon2" "orchid2" "ivory2" "grey93"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 "grey92" "grey91" "grey36" "grey29" "grey28" "grey16" "gray79" "gray78"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 "gray77" "gray48" "gray17" "coral4" "coral1" "plum1" "pink1" "grey9"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 "grey2" "gray7" "cyan4" "blue3" "plum" "cornflowerblue" "lightskyblue2"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 "antiquewhite1" "navajowhite2" "navajowhite1" "lightyellow3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 "navajowhite" "darkorange3" "whitesmoke" "turquoise2" "steelblue1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 "lightpink4" "lightblue3" "green" "chocolate1" "blue" "olivedrab"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 "lightgrey" "chocolate" "magenta4" "magenta3" "yellow1" "purple3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 "purple2" "orange2" "orange1" "magenta" "bisque1" "wheat2" "maroon"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 "khaki4" "grey96" "grey95" "grey80" "grey50" "grey41" "grey15" "grey11"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 "gray80" "gray58" "gray40" "gray34" "gray22" "brown1" "snow3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 "mediumturquoise" "lightsteelblue3" "palevioletred2" "palevioletred1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 "paleturquoise2" "green" "palevioletred" "mediumorchid1" "white"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 "mediumpurple" "lightyellow1" "dodgerblue2" "dodgerblue1" "violet"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 "aquamarine3" "slategray1" "gray" "orangered4" "lightpink3" "blue"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 "darkorchid" "cadetblue1" "burlywood3" "seashell1" "cornsilk3" "tomato4"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 "tomato2" "wheat3" "grey98" "grey59" "grey23" "green3" "green2" "gray72"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 "gray62" "gray52" "gray46" "gray42" "gray28" "gray24" "white" "cyan3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 "black" )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 '("Red" "Blue" "Purple" "Magenta" "Orange" "Yellow" "Green" "Brown"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 "Dark Gray" "Light Gray" "Black" "Cyan")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (defvar hproperty:color-ptr nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 "Pointer to current color name table to use for Hyperbole buttons.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (defconst hproperty:good-colors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (if (eq window-system 'x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 '(
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 "medium violet red" "indianred4" "firebrick1" "DarkGoldenrod"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 "NavyBlue" "darkorchid" "tomato3" "mediumseagreen" "deeppink"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 "forestgreen" "mistyrose4" "slategrey" "purple4" "dodgerblue3"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 "mediumvioletred" "lightsalmon3" "orangered2" "turquoise4" "Gray55"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 hproperty:color-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 "Good colors for contrast against wheat background and black foreground.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (defun hproperty:cycle-but-color (&optional color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 "Switches button color to optional COLOR name or next item referenced by hproperty:color-ptr."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (interactive "sHyperbole button color: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (if (not (display-color-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (if color (setq hproperty:color-ptr nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (set-face-foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 hproperty:but-face (or color (car (hproperty:list-cycle hproperty:color-ptr hproperty:good-colors))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (hproperty:set-flash-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (sit-for 0) ;; Force display update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (defun hproperty:set-flash-color ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 "Set button flashing colors based upon current color set."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (if (not (display-color-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (set-face-background hproperty:flash-face (hproperty:but-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (set-face-foreground hproperty:flash-face (hproperty:background))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (defun hproperty:but-p (&optional pos)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 "Return non-nil at point or optional POS iff face is eq to hproperty:but-face."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (memq t (mapcar (function (lambda (props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (eq (overlay-get props 'face) hproperty:but-face)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (overlays-at (or pos (point))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (defun hproperty:set-but-face (pos face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (let ((but (hproperty:but-get pos)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (if but (overlay-put but 'face face))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (defun hproperty:but-flash ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 "Flash a Hyperbole button at or near point to indicate selection."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (let ((ibut) (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (start (hattr:get 'hbut:current 'lbl-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (end (hattr:get 'hbut:current 'lbl-end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (b) (a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (if (and start end (setq prev (hproperty:but-p start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ibut t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (if (not prev) (hproperty:but-add start end hproperty:but-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (setq start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (setq b (and (hproperty:but-p start) hproperty:but-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (if (setq a b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (hproperty:set-but-face start hproperty:flash-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (sit-for 0) ;; Force display update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ;; Delay before redraw button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (let ((i 0)) (while (< i hproperty:but-flash-time) (setq i (1+ i))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (hproperty:set-but-face start a)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (sit-for 0);; Force display update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (if (and ibut (not prev)) (hproperty:but-delete start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (defun hproperty:set-item-highlight (&optional background foreground)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "Setup or reset item highlight face using optional BACKGROUND and FOREGROUND."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (make-local-variable 'hproperty:item-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (if (stringp background) (setq hproperty:item-highlight-color background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (if (not hproperty:highlight-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (setq hproperty:highlight-face (make-face 'hproperty:highlight-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (set-face-foreground hproperty:highlight-face (or foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (hproperty:background)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (set-face-underline-p hproperty:highlight-face nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (let ((update-rolo-highlight-flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (and (boundp 'rolo-highlight-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (internal-facep rolo-highlight-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (or (null (face-foreground rolo-highlight-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (face-equal hproperty:highlight-face rolo-highlight-face)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (if (not (equal (face-background hproperty:highlight-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 hproperty:item-highlight-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (set-face-background hproperty:highlight-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 hproperty:item-highlight-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (and background (not (equal (face-background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 hproperty:highlight-face) background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (set-face-background hproperty:highlight-face background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (and foreground (not (equal (face-foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 hproperty:highlight-face) foreground))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 (set-face-foreground hproperty:highlight-face foreground))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (setq hproperty:item-face hproperty:highlight-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (if update-rolo-highlight-flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (copy-face hproperty:highlight-face rolo-highlight-face))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (defun hproperty:select-item (&optional pnt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 "Select item in current buffer at optional position PNT using hproperty:item-face."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (if pnt (goto-char pnt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (skip-chars-forward " \t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (skip-chars-backward "^ \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (let ((start (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (skip-chars-forward "^ \t\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (hproperty:but-add start (point) hproperty:item-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (sit-for 0) ;; Force display update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 (defun hproperty:select-line (&optional pnt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 "Select line in current buffer at optional position PNT using hproperty:item-face."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (if pnt (goto-char pnt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (hproperty:but-add (point) (progn (end-of-line) (point)) hproperty:item-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (sit-for 0) ;; Force display update
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (defvar hproperty:but-face (progn (make-face 'hbut) 'hbut) "Face for hyper-buttons.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (setq hproperty:but hproperty:but-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (set-face-foreground hproperty:but-face (hproperty:but-color))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (set-face-background hproperty:but-face (hproperty:background))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (defvar hproperty:flash-face (progn (make-face 'hbut-flash) 'hbut-flash)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 "Face for flashing hyper-buttons.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (hproperty:set-flash-color)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (defvar hproperty:item-button nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 "Button used to highlight an item in a listing buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (make-variable-buffer-local 'hproperty:item-button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (defvar hproperty:item-face nil "Item marking face.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (defvar hproperty:highlight-face nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 "Item highlighting face. Use (hproperty:set-item-highlight) to set.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (if hproperty:highlight-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 ;; Reverse foreground and background colors for default block-style highlighting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (hproperty:set-item-highlight (hproperty:foreground) (hproperty:background)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (provide 'hui-em19-b)