emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/tool-bar.el,v


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/tool-bar.el,v
Date: Wed, 29 Aug 2007 05:28:40 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Miles Bader <miles>     07/08/29 05:28:10

Index: lisp/tool-bar.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/tool-bar.el,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- lisp/tool-bar.el    26 Jul 2007 05:26:35 -0000      1.8
+++ lisp/tool-bar.el    29 Aug 2007 05:28:03 -0000      1.9
@@ -55,23 +55,23 @@
   :group 'mouse
   :group 'frames
   (and (display-images-p)
-       (let ((lines (if tool-bar-mode 1 0)))
-        ;; Alter existing frames...
-        (mapc (lambda (frame)
-                (modify-frame-parameters frame
-                                         (list (cons 'tool-bar-lines lines))))
-              (frame-list))
-        ;; ...and future ones.
-        (let ((elt (assq 'tool-bar-lines default-frame-alist)))
-          (if elt
-              (setcdr elt lines)
-            (add-to-list 'default-frame-alist (cons 'tool-bar-lines lines)))))
+       (modify-all-frames-parameters (list (cons 'tool-bar-lines
+                                                (if tool-bar-mode 1 0))))
        (if (and tool-bar-mode
-               (display-graphic-p)
-               (= 1 (length (default-value 'tool-bar-map)))) ; not yet setup
+               (display-graphic-p))
           (tool-bar-setup))))
 
 ;;;###autoload
+;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
+(defun toggle-tool-bar-mode-from-frame (&optional arg)
+  "Toggle tool bar on or off, based on the status of the current frame.
+See `tool-bar-mode' for more information."
+  (interactive (list (or current-prefix-arg 'toggle)))
+  (if (eq arg 'toggle)
+      (tool-bar-mode (if (> (frame-parameter nil 'tool-bar-lines) 0) 0 1))
+    (tool-bar-mode arg)))
+
+;;;###autoload
 ;; We want to pretend the toolbar by standard is on, as this will make
 ;; customize consider disabling the toolbar a customization, and save
 ;; that.  We could do this for real by setting :init-value above, but
@@ -228,7 +228,12 @@
 
 ;;; Set up some global items.  Additions/deletions up for grabs.
 
-(defun tool-bar-setup ()
+(defvar tool-bar-setup nil
+  "t if the tool-bar has been set up by `tool-bar-setup'.")
+
+(defun tool-bar-setup (&optional frame)
+  (unless tool-bar-setup
+    (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.
   ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
@@ -281,9 +286,9 @@
                                (popup-menu menu-bar-help-menu))
                       'help
                       :help "Pop up the Help menu"))
-  )
+  (setq tool-bar-setup t))))
 
-(provide 'tool-bar)
 
+(provide 'tool-bar)
 ;;; arch-tag: 15f30f0a-d0d7-4d50-bbb7-f48fd0c8582f
 ;;; tool-bar.el ends here




reply via email to

[Prev in Thread] Current Thread [Next in Thread]