+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>
* net/ldap.el (ldap-search-internal): Don't use eval.
(push (widget-create-child-and-convert
widget 'custom-visibility
:help-echo "Show the value of this option."
- :on-image "down"
+ :on-glyph "down"
:on "Hide"
- :off-image "right"
+ :off-glyph "right"
:off "Show Value"
:action 'custom-toggle-hide-variable
nil)
:help-echo "Hide the value of this option."
:on "Hide"
:off "Show"
- :on-image "down"
- :off-image "right"
+ :on-glyph "down"
+ :off-glyph "right"
:action 'custom-toggle-hide-variable
t)
buttons)
:help-echo "Hide or show this option."
:on "Hide"
:off "Show"
- :on-image "down"
- :off-image "right"
+ :on-glyph "down"
+ :off-glyph "right"
:action 'custom-toggle-hide-variable
t)
buttons)
:pressed-face 'custom-visibility
:mouse-face 'highlight
:pressed-face 'highlight
- :on-image nil
- :off-image nil)
+ :on-glyph nil
+ :off-glyph nil)
(defface custom-visibility
'((t :height 0.8 :inherit link))
:pressed-face 'custom-visibility
:mouse-face 'highlight
:on "Hide Unused Attributes" :off "Show All Attributes"
- :on-image nil :off-image nil
+ :on-glyph nil :off-glyph nil
:always-active t
:action 'custom-face-edit-value-visibility-action
show-all)
widget 'custom-visibility
:help-echo "Hide or show this face."
:on "Hide" :off "Show"
- :on-image "down" :off-image "right"
+ :on-glyph "down" :off-glyph "right"
:action 'custom-toggle-hide-face
(not hiddenp))
buttons)
(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.
"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.
;;