diff options
| author | Chong Yidong | 2008-10-11 19:45:51 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-10-11 19:45:51 +0000 |
| commit | afb465eb0e3f9f5558fa6cc38a50453576ff670f (patch) | |
| tree | 376d96f936600a075af1f0d4d6a21c91d17b1311 | |
| parent | fe4d6c1877d205af63edd56b37185004d2df324f (diff) | |
| download | emacs-afb465eb0e3f9f5558fa6cc38a50453576ff670f.tar.gz emacs-afb465eb0e3f9f5558fa6cc38a50453576ff670f.zip | |
(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.
| -rw-r--r-- | lisp/tool-bar.el | 38 |
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'." | |||
| 159 | (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) | 159 | (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) |
| 160 | (if (eq bg 'unspecified) nil (list :background bg)))) | 160 | (if (eq bg 'unspecified) nil (list :background bg)))) |
| 161 | (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) | 161 | (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) |
| 162 | (xpm-lo-spec (if (> (display-color-cells) 256) | 162 | (xpm-lo-spec (list :type 'xpm :file |
| 163 | nil | 163 | (concat "low-color/" icon ".xpm"))) |
| 164 | (list :type 'xpm :file | ||
| 165 | (concat "low-color/" icon ".xpm")))) | ||
| 166 | (pbm-spec (append (list :type 'pbm :file | 164 | (pbm-spec (append (list :type 'pbm :file |
| 167 | (concat icon ".pbm")) colors)) | 165 | (concat icon ".pbm")) colors)) |
| 168 | (xbm-spec (append (list :type 'xbm :file | 166 | (xbm-spec (append (list :type 'xbm :file |
| 169 | (concat icon ".xbm")) colors)) | 167 | (concat icon ".xbm")) colors)) |
| 170 | (image-exp `(tool-bar-find-image | 168 | (image-exp `(tool-bar-find-image |
| 171 | (if (display-color-p) | 169 | (cond ((not (display-color-p)) |
| 172 | ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec) | 170 | ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)) |
| 173 | ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec))))) | 171 | ((< (display-color-cells) 256) |
| 174 | 172 | ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec)) | |
| 173 | (t | ||
| 174 | ',(list xpm-spec pbm-spec xbm-spec)))))) | ||
| 175 | (define-key-after map (vector key) | 175 | (define-key-after map (vector key) |
| 176 | `(menu-item ,(symbol-name key) ,def :image ,image-exp ,@props)))) | 176 | `(menu-item ,(symbol-name key) ,def :image ,image-exp ,@props)))) |
| 177 | 177 | ||
| @@ -211,18 +211,19 @@ holds a keymap." | |||
| 211 | (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) | 211 | (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) |
| 212 | (if (eq bg 'unspecified) nil (list :background bg)))) | 212 | (if (eq bg 'unspecified) nil (list :background bg)))) |
| 213 | (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) | 213 | (xpm-spec (list :type 'xpm :file (concat icon ".xpm"))) |
| 214 | (xpm-lo-spec (if (> (display-color-cells) 256) | 214 | (xpm-lo-spec (list :type 'xpm :file |
| 215 | nil | 215 | (concat "low-color/" icon ".xpm"))) |
| 216 | (list :type 'xpm :file | ||
| 217 | (concat "low-color/" icon ".xpm")))) | ||
| 218 | (pbm-spec (append (list :type 'pbm :file | 216 | (pbm-spec (append (list :type 'pbm :file |
| 219 | (concat icon ".pbm")) colors)) | 217 | (concat icon ".pbm")) colors)) |
| 220 | (xbm-spec (append (list :type 'xbm :file | 218 | (xbm-spec (append (list :type 'xbm :file |
| 221 | (concat icon ".xbm")) colors)) | 219 | (concat icon ".xbm")) colors)) |
| 222 | (image-exp `(tool-bar-find-image | 220 | (image-exp `(tool-bar-find-image |
| 223 | (if (display-color-p) | 221 | (cond ((not (display-color-p)) |
| 224 | ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec) | 222 | ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)) |
| 225 | ',(list pbm-spec xbm-spec xpm-lo-spec xpm-spec)))) | 223 | ((< (display-color-cells) 256) |
| 224 | ',(list xpm-lo-spec xpm-spec pbm-spec xbm-spec)) | ||
| 225 | (t | ||
| 226 | ',(list xpm-spec pbm-spec xbm-spec))))) | ||
| 226 | submap key) | 227 | submap key) |
| 227 | ;; We'll pick up the last valid entry in the list of keys if | 228 | ;; We'll pick up the last valid entry in the list of keys if |
| 228 | ;; there's more than one. | 229 | ;; there's more than one. |
| @@ -262,12 +263,7 @@ holds a keymap." | |||
| 262 | 263 | ||
| 263 | (defun tool-bar-setup (&optional frame) | 264 | (defun tool-bar-setup (&optional frame) |
| 264 | (unless (or tool-bar-setup | 265 | (unless (or tool-bar-setup |
| 265 | (null tool-bar-mode) | 266 | (null tool-bar-mode)) |
| 266 | ;; No-op if the initial frame is on a tty, deferring | ||
| 267 | ;; action until called from x-create-frame-with-faces. | ||
| 268 | ;; Tool-bar icons can depend on X settings, which are | ||
| 269 | ;; initially unavailable in this case. | ||
| 270 | (not (display-graphic-p frame))) | ||
| 271 | (with-selected-frame (or frame (selected-frame)) | 267 | (with-selected-frame (or frame (selected-frame)) |
| 272 | ;; People say it's bad to have EXIT on the tool bar, since users | 268 | ;; People say it's bad to have EXIT on the tool bar, since users |
| 273 | ;; might inadvertently click that button. | 269 | ;; might inadvertently click that button. |