Mercurial > emacs
diff lisp/wid-edit.el @ 112175:e09ac5ef1fe4
Fix r99654 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.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 09 Jan 2011 16:05:53 -0500 |
parents | 5dbf421ae0b5 |
children | 417b1e4d63cd |
line wrap: on
line diff
--- a/lisp/wid-edit.el Sun Jan 09 20:34:20 2011 +0100 +++ b/lisp/wid-edit.el Sun Jan 09 16:05:53 2011 -0500 @@ -2162,21 +2162,13 @@ (defun widget-toggle-value-create (widget) "Insert text representing the `on' and `off' states." - (if (widget-value widget) - (let ((image (widget-get widget :on-glyph))) - (and (display-graphic-p) - (listp image) - (not (eq (car image) 'image)) - (widget-put widget :on-glyph (setq image (eval image)))) - (widget-image-insert widget - (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)))) + (let* ((val (widget-value widget)) + (text (widget-get widget (if val :on :off))) + (img (widget-image-find + (widget-get widget (if val :on-glyph :off-glyph))))) + (widget-image-insert widget (or text "") + (if img + (append img '(:ascent center)))))) (defun widget-toggle-action (widget &optional event) ;; Toggle value. @@ -2816,34 +2808,22 @@ "An indicator and manipulator for hidden items. 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. -: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." :format "%[%v%]" :button-prefix "" :button-suffix "" - :on-image "down" + :on-glyph "down" :on "Hide" - :off-image "right" + :off-glyph "right" :off "Show" :value-create 'widget-visibility-value-create :action 'widget-toggle-action :match (lambda (widget value) t)) -(defun widget-visibility-value-create (widget) - ;; 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)))))) +(defalias 'widget-visibility-value-create 'widget-toggle-value-create) ;;; The `documentation-link' Widget. ;;