From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel,gmane.emacs.sources Subject: pop-up tool-bar Date: Thu, 7 Oct 2004 00:51:56 -0700 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1097135587 20997 80.91.229.6 (7 Oct 2004 07:53:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 7 Oct 2004 07:53:07 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 07 09:52:58 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CFT58-0001rG-00 for ; Thu, 07 Oct 2004 09:52:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CFTBr-0005wh-6y for ged-emacs-devel@m.gmane.org; Thu, 07 Oct 2004 03:59:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CFTBK-0005w9-Pm for emacs-devel@gnu.org; Thu, 07 Oct 2004 03:59:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CFTBJ-0005vr-HL for emacs-devel@gnu.org; Thu, 07 Oct 2004 03:59:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CFTBJ-0005vS-5r; Thu, 07 Oct 2004 03:59:21 -0400 Original-Received: from [148.87.2.204] (helo=inet-mail4.oracle.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CFT4F-0007ip-0b; Thu, 07 Oct 2004 03:52:03 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.191.12]) by inet-mail4.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i977kXmZ021911; Thu, 7 Oct 2004 00:46:34 -0700 (PDT) Original-Received: from rgmgw3.us.oracle.com (localhost [127.0.0.1]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i977pxRB021568; Thu, 7 Oct 2004 01:51:59 -0600 Original-Received: from dradamslap (dhcp-amer-csvpn-gw1-141-144-64-229.vpn.oracle.com [141.144.64.229]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id i977pwMd021556; Thu, 7 Oct 2004 01:51:58 -0600 Original-To: , "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Importance: Normal X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:28022 gmane.emacs.sources:997 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28022 This code adds a minor mode, `tool-bar-here-mode', which is the same as `tool-bar-mode', except that it affects only the selected frame. It also adds a "button" named "Tool Bar" to the far right of the menu-bar whenever the tool-bar is not visible (both `tool-bar-here-mode' and `tool-bar-mode' are turned off). You can click the button to pop up the tool-bar on the selected frame for the execution of a single command (typically a tool-bar button click). The Tool Bar button is absent whenever the tool-bar is visible, and vice versa. The idea is to _conserve frame real estate_ but still have quick access to the tool-bar: No reason to have a tool-bar on each frame. No reason to have a tool-bar visible all the time; just pop it up when you need it. Any interest in adding something like this to Emacs (file tool-bar.el)? It's not intended to replace `tool-bar-mode'; it's just an alternative for people who might want to use the tool-bar sometimes but don't want to sacrifice real estate from every frame all the time. - Drew ---------------8<----------------------------------- (define-key global-map [menu-bar temp-tool-bar] '(menu-item "Tool Bar" show-tool-bar-for-one-command :visible (and (not tool-bar-mode) (not tool-bar-here-mode)) :enable (and (not tool-bar-mode) (not tool-bar-here-mode)) :help "Use tool bar for one command")) (setq menu-bar-final-items (append menu-bar-final-items (list 'temp-tool-bar))) (define-minor-mode tool-bar-here-mode "Toggle use of the tool bar on this frame only. With numeric ARG, display the tool bar if and only if ARG is positive. See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for conveniently adding tool bar items." :init-value nil :global t :group 'mouse :group 'frames (and (display-images-p) (let ((lines (if tool-bar-here-mode 1 0))) ;; Alter existing frame... (modify-frame-parameters (selected-frame) (list (cons 'tool-bar-lines lines)))) (if (and tool-bar-here-mode (display-graphic-p) (= 1 (length (default-value 'tool-bar-map)))) ; not yet set up (tool-bar-setup)))) (defun show-tool-bar-for-one-command () "Pop up the tool bar so you can click a button. The tool bar stays visible until one command is executed \(whether or not it was initiated by clicking a button)." (interactive) (unwind-protect (let (evnt) (tool-bar-here-mode 99) ; Show tool-bar (setq evnt (read-event)) (push evnt unread-command-events)) (tool-bar-here-mode -99))) ; Hide tool-bar