diff options
| author | Gerd Moellmann | 2000-11-29 19:21:47 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-11-29 19:21:47 +0000 |
| commit | 3fae165ccb06ba4e0cfb74863f86f1b923507c42 (patch) | |
| tree | 755dc65f6702245170e7c172fca84759a8571c11 | |
| parent | e3fa42c299bab0cb846c2b8b264390ae6983ed89 (diff) | |
| download | emacs-3fae165ccb06ba4e0cfb74863f86f1b923507c42.tar.gz emacs-3fae165ccb06ba4e0cfb74863f86f1b923507c42.zip | |
(tool-bar-add-item-from-menu): Use
face-attribute instead of face-foreground and face-background.
(tool-bar-add-item): Likewise, and handle unspecified colors.
| -rw-r--r-- | lisp/toolbar/tool-bar.el | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/lisp/toolbar/tool-bar.el b/lisp/toolbar/tool-bar.el index 901eabc0908..4cfff846f8a 100644 --- a/lisp/toolbar/tool-bar.el +++ b/lisp/toolbar/tool-bar.el | |||
| @@ -89,24 +89,22 @@ function will try to use first ICON.xpm, ICON.pbm then ICON.xbm using | |||
| 89 | Keybindings are made in the map `tool-bar-map'. To define items in | 89 | Keybindings are made in the map `tool-bar-map'. To define items in |
| 90 | some local map, bind `tool-bar-map' with `let' around calls of this | 90 | some local map, bind `tool-bar-map' with `let' around calls of this |
| 91 | function." | 91 | function." |
| 92 | (let* ((fg (face-foreground 'tool-bar)) | 92 | (let* ((fg (face-attribute 'tool-bar :foreground)) |
| 93 | (bg (face-background 'tool-bar)) | 93 | (bg (face-attribute 'tool-bar :background)) |
| 94 | (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) | ||
| 95 | (if (eq bg 'unspecified) nil (list :background bg)))) | ||
| 94 | (image (find-image | 96 | (image (find-image |
| 95 | (if (display-color-p) | 97 | (if (display-color-p) |
| 96 | `((:type xpm :file ,(concat icon ".xpm")) | 98 | (list (list :type 'xpm :file (concat icon ".xpm")) |
| 97 | (:type pbm :file ,(concat icon ".pbm") | 99 | (append (list :type 'pbm :file (concat icon ".pbm")) |
| 98 | :background ,bg | 100 | colors) |
| 99 | :foreground ,fg) | 101 | (append (list :type 'xbm :file (concat icon ".xbm")) |
| 100 | (:type xbm :file ,(concat icon ".xbm") | 102 | colors)) |
| 101 | :background ,bg | 103 | (list (append (list :type 'pbm :file (concat icon ".pbm")) |
| 102 | :foreground ,fg)) | 104 | colors) |
| 103 | `((:type pbm :file ,(concat icon ".pbm") | 105 | (append (list :type 'xbm :file (concat icon ".xbm")) |
| 104 | :background ,bg | 106 | colors) |
| 105 | :foreground ,fg) | 107 | (list :type 'xpm :file (concat icon ".xpm"))))))) |
| 106 | (:type xbm :file ,(concat icon ".xbm") | ||
| 107 | :background ,bg | ||
| 108 | :foreground ,fg) | ||
| 109 | (:type xpm :file ,(concat icon ".xpm"))))))) | ||
| 110 | (when image | 108 | (when image |
| 111 | (unless (image-mask-p image) | 109 | (unless (image-mask-p image) |
| 112 | (setq image (append image '(:mask heuristic)))) | 110 | (setq image (append image '(:mask heuristic)))) |
| @@ -129,13 +127,10 @@ function." | |||
| 129 | (setq map global-map)) | 127 | (setq map global-map)) |
| 130 | (let* ((menu-bar-map (lookup-key map [menu-bar])) | 128 | (let* ((menu-bar-map (lookup-key map [menu-bar])) |
| 131 | (keys (where-is-internal command menu-bar-map)) | 129 | (keys (where-is-internal command menu-bar-map)) |
| 132 | (fg (if (eq (face-foreground 'tool-bar) 'unspecified) | 130 | (fg (face-attribute 'tool-bar :foreground)) |
| 133 | nil | 131 | (bg (face-attribute 'tool-bar :background)) |
| 134 | (list :foreground (face-foreground 'tool-bar)))) | 132 | (colors (nconc (if (eq fg 'unspecified) nil (list :foreground fg)) |
| 135 | (bg (if (eq (face-background 'tool-bar) 'unspecified) | 133 | (if (eq bg 'unspecified) nil (list :background bg)))) |
| 136 | nil | ||
| 137 | (list :background (face-background 'tool-bar)))) | ||
| 138 | (colors (nconc fg bg)) | ||
| 139 | (spec (if (display-color-p) | 134 | (spec (if (display-color-p) |
| 140 | (list (list :type 'xpm :file (concat icon ".xpm")) | 135 | (list (list :type 'xpm :file (concat icon ".xpm")) |
| 141 | (append (list :type 'pbm :file (concat icon ".pbm")) | 136 | (append (list :type 'pbm :file (concat icon ".pbm")) |