comparison lisp/tool-bar.el @ 109418:6e96aca307a4

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 27 Jun 2010 22:48:36 +0000
parents 2f0720afc474
children 783986775ee8
comparison
equal deleted inserted replaced
109417:338717febe80 109418:6e96aca307a4
46 "Toggle use of the tool bar. 46 "Toggle use of the tool bar.
47 With numeric ARG, display the tool bar if and only if ARG is positive. 47 With numeric ARG, display the tool bar if and only if ARG is positive.
48 48
49 See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for 49 See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for
50 conveniently adding tool bar items." 50 conveniently adding tool bar items."
51 :init-value nil 51 :init-value t
52 :global t 52 :global t
53 :group 'mouse 53 :group 'mouse
54 :group 'frames 54 :group 'frames
55 (if tool-bar-mode 55 ;; Make tool-bar even if terminal is non-graphical (Bug#1754).
56 (progn 56 (let ((val (if tool-bar-mode 1 0)))
57 ;; Make one tool-bar-line for any - including non-graphical - 57 (dolist (frame (frame-list))
58 ;; terminal, see Bug#1754. If this causes problems, we should 58 (set-frame-parameter frame 'tool-bar-lines val)))
59 ;; handle the problem in `modify-frame-parameters' or do not 59 (when tool-bar-mode
60 ;; call `modify-all-frames-parameters' when toggling the tool 60 (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
61 ;; bar off either. 61 (tool-bar-setup))))
62 (modify-all-frames-parameters (list (cons 'tool-bar-lines 1)))
63 (if (= 1 (length (default-value 'tool-bar-map))) ; not yet setup
64 (tool-bar-setup)))
65 (modify-all-frames-parameters (list (cons 'tool-bar-lines 0)))))
66 62
67 ;;;###autoload 63 ;;;###autoload
68 ;; Used in the Show/Hide menu, to have the toggle reflect the current frame. 64 ;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
69 (defun toggle-tool-bar-mode-from-frame (&optional arg) 65 (defun toggle-tool-bar-mode-from-frame (&optional arg)
70 "Toggle tool bar on or off, based on the status of the current frame. 66 "Toggle tool bar on or off, based on the status of the current frame.
71 See `tool-bar-mode' for more information." 67 See `tool-bar-mode' for more information."
72 (interactive (list (or current-prefix-arg 'toggle))) 68 (interactive (list (or current-prefix-arg 'toggle)))
73 (if (eq arg 'toggle) 69 (if (eq arg 'toggle)
74 (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1)) 70 (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
75 (tool-bar-mode arg))) 71 (tool-bar-mode arg)))
76
77 ;;;###autoload
78 ;; We want to pretend the toolbar by standard is on, as this will make
79 ;; customize consider disabling the toolbar a customization, and save
80 ;; that. We could do this for real by setting :init-value above, but
81 ;; that would turn on the toolbar in MS Windows where it is currently
82 ;; useless, and it would overwrite disabling the tool bar from X
83 ;; resources. If anyone want to implement this in a cleaner way,
84 ;; please do so.
85 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-21.
86 (put 'tool-bar-mode 'standard-value '(t))
87 72
88 (defvar tool-bar-map (make-sparse-keymap) 73 (defvar tool-bar-map (make-sparse-keymap)
89 "Keymap for the tool bar. 74 "Keymap for the tool bar.
90 Define this locally to override the global tool bar.") 75 Define this locally to override the global tool bar.")
91 76