summaryrefslogtreecommitdiff
path: root/lisp/tool-bar.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2008-10-11 19:45:51 +0000
committerChong Yidong <cyd@stupidchicken.com>2008-10-11 19:45:51 +0000
commitafb465eb0e3f9f5558fa6cc38a50453576ff670f (patch)
tree376d96f936600a075af1f0d4d6a21c91d17b1311 /lisp/tool-bar.el
parentfe4d6c1877d205af63edd56b37185004d2df324f (diff)
downloademacs-afb465eb0e3f9f5558fa6cc38a50453576ff670f.tar.gz
(tool-bar-local-item)
(tool-bar-local-item-from-menu): Put the check for number of display colors into the image expression. (tool-bar-setup): Don't be a no-op on ttys.
Diffstat (limited to 'lisp/tool-bar.el')
-rw-r--r--lisp/tool-bar.el38
1 files changed, 17 insertions, 21 deletions
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index dc43f9cdc3b..e38f02df907 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -159,19 +159,19 @@ ICON.xbm, using `find-image'."
(colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg))
(if (eq bg 'unspecified) nil (list :background bg))))
(xpm-spec (list :type 'xpm :file (concat icon ".xpm")))
- (xpm-lo-spec (if (> (display-color-cells) 256)
- nil
- (list :type 'xpm :file
- (concat "low-color/" icon ".xpm"))))
+ (xpm-lo-spec (list :type 'xpm :file
+ (concat "low-color/" icon ".xpm")))
(pbm-spec (append (list :type 'pbm :file
(concat icon ".pbm")) colors))
(xbm-spec (append (list :type 'xbm :file
(concat icon ".xbm")) colors))
(image-exp `(tool-bar-find-image
- (if (display-color-p)
- ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec)
- ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)))))
-
+ (cond ((not (display-color-p))
+ ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec))
+ ((< (display-color-cells) 256)
+ ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec))
+ (t
+ ',(list xpm-spec pbm-spec xbm-spec))))))
(define-key-after map (vector key)
`(menu-item ,(symbol-name key) ,def :image ,image-exp ,@props))))
@@ -211,18 +211,19 @@ holds a keymap."
(colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg))
(if (eq bg 'unspecified) nil (list :background bg))))
(xpm-spec (list :type 'xpm :file (concat icon ".xpm")))
- (xpm-lo-spec (if (> (display-color-cells) 256)
- nil
- (list :type 'xpm :file
- (concat "low-color/" icon ".xpm"))))
+ (xpm-lo-spec (list :type 'xpm :file
+ (concat "low-color/" icon ".xpm")))
(pbm-spec (append (list :type 'pbm :file
(concat icon ".pbm")) colors))
(xbm-spec (append (list :type 'xbm :file
(concat icon ".xbm")) colors))
(image-exp `(tool-bar-find-image
- (if (display-color-p)
- ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec)
- ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec))))
+ (cond ((not (display-color-p))
+ ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec))
+ ((< (display-color-cells) 256)
+ ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec))
+ (t
+ ',(list xpm-spec pbm-spec xbm-spec)))))
submap key)
;; We'll pick up the last valid entry in the list of keys if
;; there's more than one.
@@ -262,12 +263,7 @@ holds a keymap."
(defun tool-bar-setup (&optional frame)
(unless (or tool-bar-setup
- (null tool-bar-mode)
- ;; No-op if the initial frame is on a tty, deferring
- ;; action until called from x-create-frame-with-faces.
- ;; Tool-bar icons can depend on X settings, which are
- ;; initially unavailable in this case.
- (not (display-graphic-p frame)))
+ (null tool-bar-mode))
(with-selected-frame (or frame (selected-frame))
;; People say it's bad to have EXIT on the tool bar, since users
;; might inadvertently click that button.