aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-01-09 16:05:53 -0500
committerChong Yidong2011-01-09 16:05:53 -0500
commit895123f56682ed3fa9d210b1e6cfed0b3857b3e2 (patch)
treebd4292b8d640b6e46456cb898867ed36f0bb2aaa
parent9094fd8fc83cf9587c4eaeca03d6d4149a73f53d (diff)
downloademacs-895123f56682ed3fa9d210b1e6cfed0b3857b3e2.tar.gz
emacs-895123f56682ed3fa9d210b1e6cfed0b3857b3e2.zip
Fix 2010-03-12T22:56:30Z!cyd@stupidchicken.com change -- rename :on/off-image widget props to :on/off-glyph.
* wid-edit.el (visibility): Replace :on-image and :off-image widget properties with :on-glyph and :off-glyph, for consistency with the `visibility' widget. (widget-toggle-value-create, widget-visibility-value-create): Merge into a single function `widget-toggle-value-create'. * cus-edit.el (custom-variable-value-create, custom-visibility) (custom-face-edit-value-create, custom-face-value-create): Replace :on-image and :off-image widget properties with :on-glyph and :off-glyph, for consistency with the `visibility' widget.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/cus-edit.el20
-rw-r--r--lisp/wid-edit.el44
3 files changed, 35 insertions, 42 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5cab10de20d..743aa573957 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12011-01-09 Chong Yidong <cyd@stupidchicken.com>
2
3 * wid-edit.el (visibility): Replace :on-image and :off-image
4 widget properties with :on-glyph and :off-glyph, for consistency
5 with the `visibility' widget.
6 (widget-toggle-value-create, widget-visibility-value-create):
7 Merge into a single function `widget-toggle-value-create'.
8
9 * cus-edit.el (custom-variable-value-create, custom-visibility)
10 (custom-face-edit-value-create, custom-face-value-create): Replace
11 :on-image and :off-image widget properties with :on-glyph and
12 :off-glyph, for consistency with the `visibility' widget.
13
12011-01-09 Andreas Schwab <schwab@linux-m68k.org> 142011-01-09 Andreas Schwab <schwab@linux-m68k.org>
2 15
3 * net/ldap.el (ldap-search-internal): Don't use eval. 16 * net/ldap.el (ldap-search-internal): Don't use eval.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index edb299f86ed..8d42e497450 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2551,9 +2551,9 @@ try matching its doc string against `custom-guess-doc-alist'."
2551 (push (widget-create-child-and-convert 2551 (push (widget-create-child-and-convert
2552 widget 'custom-visibility 2552 widget 'custom-visibility
2553 :help-echo "Show the value of this option." 2553 :help-echo "Show the value of this option."
2554 :on-image "down" 2554 :on-glyph "down"
2555 :on "Hide" 2555 :on "Hide"
2556 :off-image "right" 2556 :off-glyph "right"
2557 :off "Show Value" 2557 :off "Show Value"
2558 :action 'custom-toggle-hide-variable 2558 :action 'custom-toggle-hide-variable
2559 nil) 2559 nil)
@@ -2573,8 +2573,8 @@ try matching its doc string against `custom-guess-doc-alist'."
2573 :help-echo "Hide the value of this option." 2573 :help-echo "Hide the value of this option."
2574 :on "Hide" 2574 :on "Hide"
2575 :off "Show" 2575 :off "Show"
2576 :on-image "down" 2576 :on-glyph "down"
2577 :off-image "right" 2577 :off-glyph "right"
2578 :action 'custom-toggle-hide-variable 2578 :action 'custom-toggle-hide-variable
2579 t) 2579 t)
2580 buttons) 2580 buttons)
@@ -2603,8 +2603,8 @@ try matching its doc string against `custom-guess-doc-alist'."
2603 :help-echo "Hide or show this option." 2603 :help-echo "Hide or show this option."
2604 :on "Hide" 2604 :on "Hide"
2605 :off "Show" 2605 :off "Show"
2606 :on-image "down" 2606 :on-glyph "down"
2607 :off-image "right" 2607 :off-glyph "right"
2608 :action 'custom-toggle-hide-variable 2608 :action 'custom-toggle-hide-variable
2609 t) 2609 t)
2610 buttons) 2610 buttons)
@@ -3056,8 +3056,8 @@ to switch between two values."
3056 :pressed-face 'custom-visibility 3056 :pressed-face 'custom-visibility
3057 :mouse-face 'highlight 3057 :mouse-face 'highlight
3058 :pressed-face 'highlight 3058 :pressed-face 'highlight
3059 :on-image nil 3059 :on-glyph nil
3060 :off-image nil) 3060 :off-glyph nil)
3061 3061
3062(defface custom-visibility 3062(defface custom-visibility
3063 '((t :height 0.8 :inherit link)) 3063 '((t :height 0.8 :inherit link))
@@ -3120,7 +3120,7 @@ face attributes (as specified by a `default' defface entry)."
3120 :pressed-face 'custom-visibility 3120 :pressed-face 'custom-visibility
3121 :mouse-face 'highlight 3121 :mouse-face 'highlight
3122 :on "Hide Unused Attributes" :off "Show All Attributes" 3122 :on "Hide Unused Attributes" :off "Show All Attributes"
3123 :on-image nil :off-image nil 3123 :on-glyph nil :off-glyph nil
3124 :always-active t 3124 :always-active t
3125 :action 'custom-face-edit-value-visibility-action 3125 :action 'custom-face-edit-value-visibility-action
3126 show-all) 3126 show-all)
@@ -3475,7 +3475,7 @@ the present value is saved to its :shown-value property instead."
3475 widget 'custom-visibility 3475 widget 'custom-visibility
3476 :help-echo "Hide or show this face." 3476 :help-echo "Hide or show this face."
3477 :on "Hide" :off "Show" 3477 :on "Hide" :off "Show"
3478 :on-image "down" :off-image "right" 3478 :on-glyph "down" :off-glyph "right"
3479 :action 'custom-toggle-hide-face 3479 :action 'custom-toggle-hide-face
3480 (not hiddenp)) 3480 (not hiddenp))
3481 buttons) 3481 buttons)
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 5b6bc97db2c..f82039585b2 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -2162,21 +2162,13 @@ when he invoked the menu."
2162 2162
2163(defun widget-toggle-value-create (widget) 2163(defun widget-toggle-value-create (widget)
2164 "Insert text representing the `on' and `off' states." 2164 "Insert text representing the `on' and `off' states."
2165 (if (widget-value widget) 2165 (let* ((val (widget-value widget))
2166 (let ((image (widget-get widget :on-glyph))) 2166 (text (widget-get widget (if val :on :off)))
2167 (and (display-graphic-p) 2167 (img (widget-image-find
2168 (listp image) 2168 (widget-get widget (if val :on-glyph :off-glyph)))))
2169 (not (eq (car image) 'image)) 2169 (widget-image-insert widget (or text "")
2170 (widget-put widget :on-glyph (setq image (eval image)))) 2170 (if img
2171 (widget-image-insert widget 2171 (append img '(:ascent center))))))
2172 (widget-get widget :on)
2173 image))
2174 (let ((image (widget-get widget :off-glyph)))
2175 (and (display-graphic-p)
2176 (listp image)
2177 (not (eq (car image) 'image))
2178 (widget-put widget :off-glyph (setq image (eval image))))
2179 (widget-image-insert widget (widget-get widget :off) image))))
2180 2172
2181(defun widget-toggle-action (widget &optional event) 2173(defun widget-toggle-action (widget &optional event)
2182 ;; Toggle value. 2174 ;; Toggle value.
@@ -2816,34 +2808,22 @@ Return an alist of (TYPE MATCH)."
2816 "An indicator and manipulator for hidden items. 2808 "An indicator and manipulator for hidden items.
2817 2809
2818The following properties have special meanings for this widget: 2810The following properties have special meanings for this widget:
2819:on-image Image filename or spec to display when the item is visible. 2811:on-glyph Image filename or spec to display when the item is visible.
2820:on Text shown if the \"on\" image is nil or cannot be displayed. 2812:on Text shown if the \"on\" image is nil or cannot be displayed.
2821:off-image Image filename or spec to display when the item is hidden. 2813:off-glyph Image filename or spec to display when the item is hidden.
2822:off Text shown if the \"off\" image is nil cannot be displayed." 2814:off Text shown if the \"off\" image is nil cannot be displayed."
2823 :format "%[%v%]" 2815 :format "%[%v%]"
2824 :button-prefix "" 2816 :button-prefix ""
2825 :button-suffix "" 2817 :button-suffix ""
2826 :on-image "down" 2818 :on-glyph "down"
2827 :on "Hide" 2819 :on "Hide"
2828 :off-image "right" 2820 :off-glyph "right"
2829 :off "Show" 2821 :off "Show"
2830 :value-create 'widget-visibility-value-create 2822 :value-create 'widget-visibility-value-create
2831 :action 'widget-toggle-action 2823 :action 'widget-toggle-action
2832 :match (lambda (widget value) t)) 2824 :match (lambda (widget value) t))
2833 2825
2834(defun widget-visibility-value-create (widget) 2826(defalias 'widget-visibility-value-create 'widget-toggle-value-create)
2835 ;; Insert text representing the `on' and `off' states.
2836 (let* ((val (widget-value widget))
2837 (text (widget-get widget (if val :on :off)))
2838 (img (widget-image-find
2839 (widget-get widget (if val :on-image :off-image)))))
2840 (widget-image-insert widget
2841 (if text
2842 (concat widget-push-button-prefix text
2843 widget-push-button-suffix)
2844 "")
2845 (if img
2846 (append img '(:ascent center))))))
2847 2827
2848;;; The `documentation-link' Widget. 2828;;; The `documentation-link' Widget.
2849;; 2829;;