]> code.delx.au - gnu-emacs/blobdiff - lisp/tool-bar.el
(display_tool_bar_line): Skip glyphs which are too big
[gnu-emacs] / lisp / tool-bar.el
index ea2bad9dcb27f2d7b486dc7abf1b57089420321f..37d60441648c392ffdf364a43fa178d067aff44b 100644 (file)
@@ -1,7 +1,7 @@
 ;;; tool-bar.el --- setting up the tool bar
 ;;
 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
-;;   2005 Free Software Foundation, Inc.
+;;   2005, 2006 Free Software Foundation, Inc.
 ;;
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: mouse frames
@@ -145,7 +145,7 @@ ICON.xbm, using `find-image'."
 
 ;;;###autoload
 (defun tool-bar-add-item-from-menu (command icon &optional map &rest props)
-  "Define tool bar binding for COMMAND using the given ICON in keymap MAP.
+  "Define tool bar binding for COMMAND in keymap MAP using the given ICON.
 This makes a binding for COMMAND in `tool-bar-map', copying its
 binding from the menu bar in MAP (which defaults to `global-map'), but
 modifies the binding by adding an image specification for ICON.  It
@@ -155,20 +155,21 @@ properties to add to the binding.
 MAP must contain appropriate binding for `[menu-bar]' which holds a keymap.
 
 Use this function only to make bindings in the global value of `tool-bar-map'.
-To define items in any other map, use `tool-bar-local-item'."
+To define items in any other map, use `tool-bar-local-item-from-menu'."
   (apply 'tool-bar-local-item-from-menu command icon
         (default-value 'tool-bar-map) map props))
 
 ;;;###autoload
 (defun tool-bar-local-item-from-menu (command icon in-map &optional from-map &rest props)
-  "Define tool bar binding for COMMAND using the given ICON in keymap MAP.
+  "Define local tool bar binding for COMMAND using the given ICON.
 This makes a binding for COMMAND in IN-MAP, copying its binding from
 the menu bar in FROM-MAP (which defaults to `global-map'), but
 modifies the binding by adding an image specification for ICON.  It
 finds ICON just like `tool-bar-add-item'.  PROPS are additional
 properties to add to the binding.
 
-MAP must contain appropriate binding for `[menu-bar]' which holds a keymap."
+FROM-MAP must contain appropriate binding for `[menu-bar]' which
+holds a keymap."
   (unless from-map
     (setq from-map global-map))
   (let* ((menu-bar-map (lookup-key from-map [menu-bar]))
@@ -232,7 +233,7 @@ MAP must contain appropriate binding for `[menu-bar]' which holds a keymap."
   ;; might inadvertently click that button.
   ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
   (tool-bar-add-item-from-menu 'find-file "new")
-  (tool-bar-add-item-from-menu 'find-file-existing "open")
+  (tool-bar-add-item-from-menu 'menu-find-file-existing "open")
   (tool-bar-add-item-from-menu 'dired "diropen")
   (tool-bar-add-item-from-menu 'kill-this-buffer "close")
   (tool-bar-add-item-from-menu 'save-buffer "save" nil
@@ -266,14 +267,20 @@ MAP must contain appropriate binding for `[menu-bar]' which holds a keymap."
   ;;(tool-bar-add-item-from-menu 'compose-mail "mail/compose")
 
   (tool-bar-add-item-from-menu 'print-buffer "print")
-  (tool-bar-add-item "preferences" 'customize 'customize
-                    :help "Edit preferences (customize)")
-
-  (tool-bar-add-item "help" (lambda ()
-                             (interactive)
-                             (popup-menu menu-bar-help-menu))
-                    'help
-                    :help "Pop up the Help menu")
+
+  ;; tool-bar-add-item-from-menu itself operates on
+  ;; (default-value 'tool-bar-map), but when we don't use that function,
+  ;; we must explicitly operate on the default value.
+
+  (let ((tool-bar-map (default-value 'tool-bar-map)))
+    (tool-bar-add-item "preferences" 'customize 'customize
+                      :help "Edit preferences (customize)")
+
+    (tool-bar-add-item "help" (lambda ()
+                               (interactive)
+                               (popup-menu menu-bar-help-menu))
+                      'help
+                      :help "Pop up the Help menu"))
   )
 
 (provide 'tool-bar)