Commit 895123f5 authored by Chong Yidong's avatar Chong Yidong

Fix 2010-03-12T22:56:30Z!cyd@stupidchicken.com change -- rename :on/off-image...

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.
parent 9094fd8f
2011-01-09 Chong Yidong <cyd@stupidchicken.com>
* 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.
2011-01-09 Andreas Schwab <schwab@linux-m68k.org> 2011-01-09 Andreas Schwab <schwab@linux-m68k.org>
* net/ldap.el (ldap-search-internal): Don't use eval. * net/ldap.el (ldap-search-internal): Don't use eval.
......
...@@ -2551,9 +2551,9 @@ try matching its doc string against `custom-guess-doc-alist'." ...@@ -2551,9 +2551,9 @@ try matching its doc string against `custom-guess-doc-alist'."
(push (widget-create-child-and-convert (push (widget-create-child-and-convert
widget 'custom-visibility widget 'custom-visibility
:help-echo "Show the value of this option." :help-echo "Show the value of this option."
:on-image "down" :on-glyph "down"
:on "Hide" :on "Hide"
:off-image "right" :off-glyph "right"
:off "Show Value" :off "Show Value"
:action 'custom-toggle-hide-variable :action 'custom-toggle-hide-variable
nil) nil)
...@@ -2573,8 +2573,8 @@ try matching its doc string against `custom-guess-doc-alist'." ...@@ -2573,8 +2573,8 @@ try matching its doc string against `custom-guess-doc-alist'."
:help-echo "Hide the value of this option." :help-echo "Hide the value of this option."
:on "Hide" :on "Hide"
:off "Show" :off "Show"
:on-image "down" :on-glyph "down"
:off-image "right" :off-glyph "right"
:action 'custom-toggle-hide-variable :action 'custom-toggle-hide-variable
t) t)
buttons) buttons)
...@@ -2603,8 +2603,8 @@ try matching its doc string against `custom-guess-doc-alist'." ...@@ -2603,8 +2603,8 @@ try matching its doc string against `custom-guess-doc-alist'."
:help-echo "Hide or show this option." :help-echo "Hide or show this option."
:on "Hide" :on "Hide"
:off "Show" :off "Show"
:on-image "down" :on-glyph "down"
:off-image "right" :off-glyph "right"
:action 'custom-toggle-hide-variable :action 'custom-toggle-hide-variable
t) t)
buttons) buttons)
...@@ -3056,8 +3056,8 @@ to switch between two values." ...@@ -3056,8 +3056,8 @@ to switch between two values."
:pressed-face 'custom-visibility :pressed-face 'custom-visibility
:mouse-face 'highlight :mouse-face 'highlight
:pressed-face 'highlight :pressed-face 'highlight
:on-image nil :on-glyph nil
:off-image nil) :off-glyph nil)
(defface custom-visibility (defface custom-visibility
'((t :height 0.8 :inherit link)) '((t :height 0.8 :inherit link))
...@@ -3120,7 +3120,7 @@ face attributes (as specified by a `default' defface entry)." ...@@ -3120,7 +3120,7 @@ face attributes (as specified by a `default' defface entry)."
:pressed-face 'custom-visibility :pressed-face 'custom-visibility
:mouse-face 'highlight :mouse-face 'highlight
:on "Hide Unused Attributes" :off "Show All Attributes" :on "Hide Unused Attributes" :off "Show All Attributes"
:on-image nil :off-image nil :on-glyph nil :off-glyph nil
:always-active t :always-active t
:action 'custom-face-edit-value-visibility-action :action 'custom-face-edit-value-visibility-action
show-all) show-all)
...@@ -3475,7 +3475,7 @@ the present value is saved to its :shown-value property instead." ...@@ -3475,7 +3475,7 @@ the present value is saved to its :shown-value property instead."
widget 'custom-visibility widget 'custom-visibility
:help-echo "Hide or show this face." :help-echo "Hide or show this face."
:on "Hide" :off "Show" :on "Hide" :off "Show"
:on-image "down" :off-image "right" :on-glyph "down" :off-glyph "right"
:action 'custom-toggle-hide-face :action 'custom-toggle-hide-face
(not hiddenp)) (not hiddenp))
buttons) buttons)
......
...@@ -2162,21 +2162,13 @@ when he invoked the menu." ...@@ -2162,21 +2162,13 @@ when he invoked the menu."
(defun widget-toggle-value-create (widget) (defun widget-toggle-value-create (widget)
"Insert text representing the `on' and `off' states." "Insert text representing the `on' and `off' states."
(if (widget-value widget) (let* ((val (widget-value widget))
(let ((image (widget-get widget :on-glyph))) (text (widget-get widget (if val :on :off)))
(and (display-graphic-p) (img (widget-image-find
(listp image) (widget-get widget (if val :on-glyph :off-glyph)))))
(not (eq (car image) 'image)) (widget-image-insert widget (or text "")
(widget-put widget :on-glyph (setq image (eval image)))) (if img
(widget-image-insert widget (append img '(:ascent center))))))
(widget-get widget :on)
image))
(let ((image (widget-get widget :off-glyph)))
(and (display-graphic-p)
(listp image)
(not (eq (car image) 'image))
(widget-put widget :off-glyph (setq image (eval image))))
(widget-image-insert widget (widget-get widget :off) image))))
(defun widget-toggle-action (widget &optional event) (defun widget-toggle-action (widget &optional event)
;; Toggle value. ;; Toggle value.
...@@ -2816,34 +2808,22 @@ Return an alist of (TYPE MATCH)." ...@@ -2816,34 +2808,22 @@ Return an alist of (TYPE MATCH)."
"An indicator and manipulator for hidden items. "An indicator and manipulator for hidden items.
The following properties have special meanings for this widget: The following properties have special meanings for this widget:
:on-image Image filename or spec to display when the item is visible. :on-glyph Image filename or spec to display when the item is visible.
:on Text shown if the \"on\" image is nil or cannot be displayed. :on Text shown if the \"on\" image is nil or cannot be displayed.
:off-image Image filename or spec to display when the item is hidden. :off-glyph Image filename or spec to display when the item is hidden.
:off Text shown if the \"off\" image is nil cannot be displayed." :off Text shown if the \"off\" image is nil cannot be displayed."
:format "%[%v%]" :format "%[%v%]"
:button-prefix "" :button-prefix ""
:button-suffix "" :button-suffix ""
:on-image "down" :on-glyph "down"
:on "Hide" :on "Hide"
:off-image "right" :off-glyph "right"
:off "Show" :off "Show"
:value-create 'widget-visibility-value-create :value-create 'widget-visibility-value-create
:action 'widget-toggle-action :action 'widget-toggle-action
:match (lambda (widget value) t)) :match (lambda (widget value) t))
(defun widget-visibility-value-create (widget) (defalias 'widget-visibility-value-create 'widget-toggle-value-create)
;; Insert text representing the `on' and `off' states.
(let* ((val (widget-value widget))
(text (widget-get widget (if val :on :off)))
(img (widget-image-find
(widget-get widget (if val :on-image :off-image)))))
(widget-image-insert widget
(if text
(concat widget-push-button-prefix text
widget-push-button-suffix)
"")
(if img
(append img '(:ascent center))))))
;;; The `documentation-link' Widget. ;;; The `documentation-link' Widget.
;; ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment