From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: pop-up tool-bar Date: Sun, 10 Oct 2004 21:45:28 -0700 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C4AF12.756AEB70" X-Trace: sea.gmane.org 1097470001 2677 80.91.229.6 (11 Oct 2004 04:46:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Oct 2004 04:46:41 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 11 06:46:30 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 1CGs4r-0008GF-00 for ; Mon, 11 Oct 2004 06:46:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CGsBm-0004Xq-GT for ged-emacs-devel@m.gmane.org; Mon, 11 Oct 2004 00:53:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CGsBY-0004Vq-98 for emacs-devel@gnu.org; Mon, 11 Oct 2004 00:53:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CGsBW-0004Uv-Qb for emacs-devel@gnu.org; Mon, 11 Oct 2004 00:53:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CGsBW-0004Ua-MZ for emacs-devel@gnu.org; Mon, 11 Oct 2004 00:53:22 -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 1CGs4D-00007C-Ay for emacs-devel@gnu.org; Mon, 11 Oct 2004 00:45:49 -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 i9B4eFHg004494 for ; Sun, 10 Oct 2004 21:40:16 -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 i9B4jjcC023875 for ; Sun, 10 Oct 2004 22:45:45 -0600 Original-Received: from dradamslap (dhcp-amer-csvpn-gw1-141-144-65-54.vpn.oracle.com [141.144.65.54]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id i9B4jjeG023867 for ; Sun, 10 Oct 2004 22:45:45 -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) In-Reply-To: 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:28212 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:28212 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C4AF12.756AEB70 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit For those interested, attached is a new patch for the pop-up tool-bar implementation that I sent previously. It fixes a minor bug (scroll-down when bobp). To use: patch the standard file tool-bar.el, load it, and `M-x tool-bar-popup-mode'. Then click "Buttons" in the menu-bar to pop up the tool-bar for a single command (button click). - Drew ------=_NextPart_000_0000_01C4AF12.756AEB70 Content-Type: text/plain; name="diff-tool-bar-pop-up-10-10.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="diff-tool-bar-pop-up-10-10.txt" cd c:/drews-lisp-20/=0A= diff -c "c:/emacs-21.3.50/lisp/toolbar/tool-bar.el" = "c:/drews-lisp-20/tool-bar-w-popup-10-10.el"=0A= *** c:/emacs-21.3.50/lisp/toolbar/tool-bar.el Mon Jul 26 09:42:32 2004=0A= --- c:/drews-lisp-20/tool-bar-w-popup-10-10.el Sun Oct 10 21:23:58 2004=0A= ***************=0A= *** 40,45 ****=0A= --- 40,49 ----=0A= =0A= ;;; Code:=0A= =0A= + =0A= + =0C=0A= + ;;; Global Tool Bar Mode ------------------------=0A= + =0A= ;;;###autoload=0A= (define-minor-mode tool-bar-mode=0A= "Toggle use of the tool bar.=0A= ***************=0A= *** 266,271 ****=0A= --- 270,367 ----=0A= :help "Pop up the Help menu")=0A= )=0A= =0A= + =0A= + =0A= + =0C=0A= + ;;; Local Tool Bar Mode -------------------------=0A= + =0A= + (define-minor-mode tool-bar-here-mode=0A= + "Toggle use of the tool bar on this frame only.=0A= + With numeric ARG, display the tool bar if and only if ARG is positive.=0A= + =0A= + See `tool-bar-add-item' and `tool-bar-add-item-from-menu' for=0A= + conveniently adding tool bar items."=0A= + :init-value nil :global t :group 'mouse :group 'frames=0A= + (and (display-images-p)=0A= + (let ((lines (if tool-bar-here-mode 1 0)))=0A= + ;; Alter existing frame...=0A= + (modify-frame-parameters (selected-frame) (list (cons = 'tool-bar-lines lines))))=0A= + (if (and tool-bar-here-mode=0A= + (display-graphic-p)=0A= + (=3D 1 (length (default-value 'tool-bar-map)))) ; not yet set up=0A= + (tool-bar-setup))))=0A= + =0A= + (make-variable-frame-local 'tool-bar-here-mode)=0A= + =0A= + =0A= + =0C=0A= + ;;; Pop-Up Tool Bar Mode ------------------------=0A= + =0A= + ;; If either of the normal tool-bar modes is turned on, then=0A= + ;; `tool-bar-popup-mode' is not available.=0A= + (define-key global-map [menu-bar pop-up-tool-bar]=0A= + '(menu-item=0A= + "Buttons" show-tool-bar-for-one-command=0A= + :visible (and tool-bar-pop-up-mode (not tool-bar-mode) (not = tool-bar-here-mode))=0A= + :enable (and tool-bar-pop-up-mode (not tool-bar-mode) (not = tool-bar-here-mode))=0A= + :help "Use tool bar for one command"))=0A= + =0A= + (setq menu-bar-final-items (append menu-bar-final-items (list = 'pop-up-tool-bar)))=0A= + =0A= + =0A= + =0A= + (define-minor-mode tool-bar-pop-up-mode=0A= + "Toggle tool-bar pop-up.=0A= + With numeric ARG, turn on tool-bar pop-up if and only if ARG is = positive.=0A= + =0A= + Note: Command `tool-bar-pop-up-mode' functions as a toggle only=0A= + if neither `tool-bar-mode' nor `tool-bar-here-mode' is on.=0A= + =0A= + If either of those modes is on, then command=0A= + `tool-bar-pop-up-mode' turns them both off and turns=0A= + `tool-bar-pop-up-mode' on."=0A= + :init-value nil :global t :group 'mouse :group 'frames=0A= + (when (or tool-bar-mode tool-bar-here-mode)=0A= + (setq tool-bar-pop-up-mode t)=0A= + (tool-bar-mode -99)=0A= + (tool-bar-here-mode -99)))=0A= + =0A= + =0A= + ;; Note: This treats mouse events specially: it scrolls the buffer=0A= + ;; text (window) down to compensate for the disappearance of the=0A= + ;; tool-bar. That is, it replaces the tool-bar with an equivalent=0A= + ;; number of lines of buffer text.=0A= + ;;=0A= + ;; The reason for this is so that where you click the mouse when the=0A= + ;; tool-bar is visible corresponds to where the mouse is after the=0A= + ;; tool-bar disappears. Otherwise, the buffer text moves up, relative=0A= + ;; to the mouse, and a region is selected (without ever physically=0A= + ;; moving the mouse).=0A= + ;;=0A= + (defun show-tool-bar-for-one-command ()=0A= + "Pop up the tool bar so you can click a button.=0A= + The tool bar stays visible until one command is executed=0A= + \(whether or not it was initiated by clicking a button)."=0A= + (interactive)=0A= + (unless tool-bar-pop-up-mode=0A= + (error "You must turn on `tool-bar-pop-up-mode' to use this = command"))=0A= + (let (evnt tb-lines)=0A= + (unwind-protect=0A= + (progn=0A= + (tool-bar-here-mode 99) ; Show tool-bar=0A= + (setq evnt (read-event))=0A= + (push evnt unread-command-events))=0A= + (when (and (consp evnt)=0A= + (member (event-basic-type (car evnt)) '(mouse-1 = mouse-2 mouse-3)))=0A= + (setq tb-lines (cdr (assq 'tool-bar-lines (frame-parameters = (selected-frame)))))=0A= + (condition-case nil=0A= + (when tb-lines (scroll-down tb-lines))=0A= + (error (tool-bar-here-mode -99)))) ; E.g. "Beginning of = buffer" error=0A= + (tool-bar-here-mode -99)))) ; Hide tool-bar=0A= + =0A= + =0A= + ;;;;;;;;;;;;;;;;;;=0A= + =0A= (provide 'tool-bar)=0A= =0A= ;;; arch-tag: 15f30f0a-d0d7-4d50-bbb7-f48fd0c8582f=0A= =0A= Diff finished at Sun Oct 10 21:24:58=0A= ------=_NextPart_000_0000_01C4AF12.756AEB70 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel ------=_NextPart_000_0000_01C4AF12.756AEB70--