aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2005-10-23 17:40:38 +0000
committerChong Yidong2005-10-23 17:40:38 +0000
commit87911bdbb8a6afe8c57e82df8a80bc0e1384dd85 (patch)
treec4416118a070ed7eaddf0ba42dcabafb3e67ca36
parentf6a18aa2a406fedda37c34628c25d01b4e88834d (diff)
downloademacs-87911bdbb8a6afe8c57e82df8a80bc0e1384dd85.tar.gz
emacs-87911bdbb8a6afe8c57e82df8a80bc0e1384dd85.zip
* cus-edit.el (custom-button, custom-button-pressed): New vars.
(custom-raised-buttons): Add :set spec. (custom-button-unraised, custom-button-pressed-unraised): New faces, so that custom-raised-buttons actually does something. (custom-mode): Use custom-button and custom-button-pressed. * wid-edit.el (widget-specify-button): Don't ignore widget-mouse-face on graphic terminals. (widget-move-and-invoke): Cleanup.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/cus-edit.el57
-rw-r--r--lisp/wid-edit.el13
3 files changed, 66 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a39ae34afd7..bbdcd33b89c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12005-10-23 Chong Yidong <cyd@stupidchicken.com>
2
3 * cus-edit.el (custom-button, custom-button-pressed): New vars.
4 (custom-raised-buttons): Add :set spec.
5 (custom-button-unraised, custom-button-pressed-unraised): New
6 faces, so that custom-raised-buttons actually does something.
7 (custom-mode): Use custom-button and custom-button-pressed.
8
9 * wid-edit.el (widget-specify-button): Don't ignore
10 widget-mouse-face on graphic terminals.
11 (widget-move-and-invoke): Cleanup.
12
12005-10-23 Thien-Thi Nguyen <ttn@gnu.org> 132005-10-23 Thien-Thi Nguyen <ttn@gnu.org>
2 14
3 * whitespace.el (whitespace-cleanup): Doc fix. 15 * whitespace.el (whitespace-cleanup): Doc fix.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 696fd66543a..40e26834c83 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1377,13 +1377,27 @@ This button will have a menu with all three reset operations."
1377 (interactive) 1377 (interactive)
1378 (quit-window custom-buffer-done-kill)) 1378 (quit-window custom-buffer-done-kill))
1379 1379
1380(defvar custom-button nil
1381 "Face used for buttons in customization buffers.")
1382
1383(defvar custom-button-pressed nil
1384 "Face used for pressed buttons in customization buffers.")
1385
1380(defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box) 1386(defcustom custom-raised-buttons (not (equal (face-valid-attribute-values :box)
1381 '(("unspecified" . unspecified)))) 1387 '(("unspecified" . unspecified))))
1382 "If non-nil, indicate active buttons in a `raised-button' style. 1388 "If non-nil, indicate active buttons in a `raised-button' style.
1383Otherwise use brackets." 1389Otherwise use brackets."
1384 :type 'boolean 1390 :type 'boolean
1385 :version "21.1" 1391 :version "21.1"
1386 :group 'custom-buffer) 1392 :group 'custom-buffer
1393 :set (lambda (variable value)
1394 (custom-set-default variable value)
1395 (setq custom-button
1396 (if value 'custom-button 'custom-button-unraised))
1397 (setq custom-button-pressed
1398 (if value
1399 'custom-button-pressed
1400 'custom-button-pressed-unraised))))
1387 1401
1388(defun custom-buffer-create-internal (options &optional description) 1402(defun custom-buffer-create-internal (options &optional description)
1389 (custom-mode) 1403 (custom-mode)
@@ -1896,24 +1910,52 @@ and `face'."
1896 :background "lightgrey" :foreground "black")) 1910 :background "lightgrey" :foreground "black"))
1897 (t 1911 (t
1898 nil)) 1912 nil))
1899 "Face used for buttons in customization buffers." 1913 "Face for custom buffer buttons if `custom-raised-buttons' is non-nil."
1900 :version "21.1" 1914 :version "21.1"
1901 :group 'custom-faces) 1915 :group 'custom-faces)
1902;; backward-compatibility alias 1916;; backward-compatibility alias
1903(put 'custom-button-face 'face-alias 'custom-button) 1917(put 'custom-button-face 'face-alias 'custom-button)
1904 1918
1919(defface custom-button-unraised
1920 '((((min-colors 88)
1921 (class color) (background light)) :foreground "blue1" :underline t)
1922 (((class color) (background light)) :foreground "blue" :underline t)
1923 (((min-colors 88)
1924 (class color) (background dark)) :foreground "cyan1" :underline t)
1925 (((class color) (background dark)) :foreground "cyan" :underline t)
1926 (t :underline t))
1927 "Face for custom buffer buttons if `custom-raised-buttons' is nil."
1928 :version "22.1"
1929 :group 'custom-faces)
1930
1931(setq custom-button
1932 (if custom-raised-buttons 'custom-button 'custom-button-unraised))
1933
1905(defface custom-button-pressed 1934(defface custom-button-pressed
1906 '((((type x w32 mac) (class color)) 1935 '((((type x w32 mac) (class color))
1907 (:box (:line-width 2 :style pressed-button) 1936 (:box (:line-width 2 :style pressed-button)
1908 :background "lightgrey" :foreground "black")) 1937 :background "lightgrey" :foreground "black"))
1909 (t 1938 (t
1910 (:inverse-video t))) 1939 (:inverse-video t)))
1911 "Face used for buttons in customization buffers." 1940 "Face for pressed custom buttons if `custom-raised-buttons' is non-nil."
1912 :version "21.1" 1941 :version "21.1"
1913 :group 'custom-faces) 1942 :group 'custom-faces)
1914;; backward-compatibility alias 1943;; backward-compatibility alias
1915(put 'custom-button-pressed-face 'face-alias 'custom-button-pressed) 1944(put 'custom-button-pressed-face 'face-alias 'custom-button-pressed)
1916 1945
1946(defface custom-button-pressed-unraised
1947 '((default :inherit custom-button-unraised)
1948 (((class color) (background light)) :foreground "magenta4")
1949 (((class color) (background dark)) :foreground "violet"))
1950 "Face for pressed custom buttons if `custom-raised-buttons' is nil."
1951 :version "22.1"
1952 :group 'custom-faces)
1953
1954(setq custom-button-pressed
1955 (if custom-raised-buttons
1956 'custom-button-pressed
1957 'custom-button-pressed-unraised))
1958
1917(defface custom-documentation nil 1959(defface custom-documentation nil
1918 "Face used for documentation strings in customization buffers." 1960 "Face used for documentation strings in customization buffers."
1919 :group 'custom-faces) 1961 :group 'custom-faces)
@@ -4311,10 +4353,11 @@ if that value is non-nil."
4311 (make-local-variable 'widget-documentation-face) 4353 (make-local-variable 'widget-documentation-face)
4312 (setq widget-documentation-face 'custom-documentation) 4354 (setq widget-documentation-face 'custom-documentation)
4313 (make-local-variable 'widget-button-face) 4355 (make-local-variable 'widget-button-face)
4314 (setq widget-button-face 'custom-button) 4356 (setq widget-button-face custom-button)
4315 (set (make-local-variable 'widget-button-pressed-face) 'custom-button-pressed) 4357 (set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
4316 (set (make-local-variable 'widget-mouse-face) 4358 (if custom-raised-buttons
4317 'custom-button-pressed) ; buttons `depress' when moused 4359 (set (make-local-variable 'widget-mouse-face) custom-button))
4360
4318 ;; When possible, use relief for buttons, not bracketing. This test 4361 ;; When possible, use relief for buttons, not bracketing. This test
4319 ;; may not be optimal. 4362 ;; may not be optimal.
4320 (when custom-raised-buttons 4363 (when custom-raised-buttons
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 1d5cb3625f0..064725c8bfe 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -403,10 +403,7 @@ new value.")
403 ;; We want to avoid the face with image buttons. 403 ;; We want to avoid the face with image buttons.
404 (unless (widget-get widget :suppress-face) 404 (unless (widget-get widget :suppress-face)
405 (overlay-put overlay 'face (widget-apply widget :button-face-get)) 405 (overlay-put overlay 'face (widget-apply widget :button-face-get))
406 ; Text terminals cannot change mouse pointer shape, so use mouse 406 (overlay-put overlay 'mouse-face widget-mouse-face))
407 ; face instead.
408 (or (display-graphic-p)
409 (overlay-put overlay 'mouse-face widget-mouse-face)))
410 (overlay-put overlay 'pointer 'hand) 407 (overlay-put overlay 'pointer 'hand)
411 (overlay-put overlay 'follow-link follow-link) 408 (overlay-put overlay 'follow-link follow-link)
412 (overlay-put overlay 'help-echo help-echo))) 409 (overlay-put overlay 'help-echo help-echo)))
@@ -664,11 +661,9 @@ button is pressed or inactive, respectively. These are currently ignored."
664 "Move to where you click, and if it is an active field, invoke it." 661 "Move to where you click, and if it is an active field, invoke it."
665 (interactive "e") 662 (interactive "e")
666 (mouse-set-point event) 663 (mouse-set-point event)
667 (if (widget-event-point event) 664 (let ((pos (widget-event-point event)))
668 (let* ((pos (widget-event-point event)) 665 (if (and pos (get-char-property pos 'button))
669 (button (get-char-property pos 'button))) 666 (widget-button-click event))))
670 (if button
671 (widget-button-click event)))))
672 667
673;;; Buttons. 668;;; Buttons.
674 669