diff options
| author | Carsten Dominik | 2000-02-04 10:08:49 +0000 |
|---|---|---|
| committer | Carsten Dominik | 2000-02-04 10:08:49 +0000 |
| commit | 8124289f5bfe61875890716a6a4387bb1cf63e38 (patch) | |
| tree | e68eb1905dd211a23959b116635dd90ffae2208a | |
| parent | 6081676610f59d0792cfb1cf1f17219dd6e2fd83 (diff) | |
| download | emacs-8124289f5bfe61875890716a6a4387bb1cf63e38.tar.gz emacs-8124289f5bfe61875890716a6a4387bb1cf63e38.zip | |
(idlwave-toolbar-add-everywhere, idlwave-toolbar-remove-everywhere):
Keybindings prefix is now `tool-bar' instead of `toolbar'.
| -rw-r--r-- | lisp/progmodes/idlw-toolbar.el | 115 |
1 files changed, 60 insertions, 55 deletions
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el index 325751bf451..26633b294d9 100644 --- a/lisp/progmodes/idlw-toolbar.el +++ b/lisp/progmodes/idlw-toolbar.el | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | ;; Copyright (c) 1999 Free Software Foundation | 3 | ;; Copyright (c) 1999 Free Software Foundation |
| 4 | 4 | ||
| 5 | ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl> | 5 | ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl> |
| 6 | ;; Version: 3.12 | 6 | ;; Version: 3.15 |
| 7 | ;; Date: $Date: 2000/01/05 12:38:47 $ | 7 | ;; Date: $Date: 2000/02/03 15:40:31 $ |
| 8 | ;; Keywords: processes | 8 | ;; Keywords: processes |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| @@ -44,7 +44,7 @@ | |||
| 44 | (featurep 'xpm) ; need xpm | 44 | (featurep 'xpm) ; need xpm |
| 45 | (featurep 'toolbar)) ; ... and the toolbar | 45 | (featurep 'toolbar)) ; ... and the toolbar |
| 46 | (and (not (featurep 'xemacs)) ; This is Emacs | 46 | (and (not (featurep 'xemacs)) ; This is Emacs |
| 47 | (boundp 'toolbar-button-margin) ; need toolbar | 47 | (boundp 'tool-bar-button-margin) ; need toolbar |
| 48 | (fboundp 'image-type-available-p) ; need image stuff | 48 | (fboundp 'image-type-available-p) ; need image stuff |
| 49 | (image-type-available-p 'xpm)) ; need xpm | 49 | (image-type-available-p 'xpm)) ; need xpm |
| 50 | )) | 50 | )) |
| @@ -52,6 +52,8 @@ | |||
| 52 | (message "Sorry, IDLWAVE xpm toolbar cannot be used on this version of Emacs") | 52 | (message "Sorry, IDLWAVE xpm toolbar cannot be used on this version of Emacs") |
| 53 | ;; OK, we can define a toolbar | 53 | ;; OK, we can define a toolbar |
| 54 | 54 | ||
| 55 | (defconst idlwave-toolbar-is-possible t | ||
| 56 | "When defined, indicates that a toolbar is possible with this Emacs.") | ||
| 55 | (defvar idlwave-toolbar-compile-icon | 57 | (defvar idlwave-toolbar-compile-icon |
| 56 | (idlwave-toolbar-make-button | 58 | (idlwave-toolbar-make-button |
| 57 | "/* XPM */ | 59 | "/* XPM */ |
| @@ -776,12 +778,7 @@ static char * file[] = { | |||
| 776 | "Reset IDL (RETALL & CLOSE,/ALL and more)"] | 778 | "Reset IDL (RETALL & CLOSE,/ALL and more)"] |
| 777 | )) | 779 | )) |
| 778 | 780 | ||
| 779 | 781 | ;; When the shell exits, arrange to remove the special toolbar everywhere. | |
| 780 | ;; Add the toolbar to all open idlwave buffers when the shell starts. | ||
| 781 | (add-hook 'idlwave-shell-mode-hook 'idlwave-toolbar-add-everywhere) | ||
| 782 | ;; Make sure the toolbar will be added to any future idlwave-mode buffers | ||
| 783 | (add-hook 'idlwave-mode-hook 'idlwave-toolbar-add) | ||
| 784 | ;; When the shell exits, remove the special toolbar everywhere. | ||
| 785 | (add-hook 'idlwave-shell-cleanup-hook | 782 | (add-hook 'idlwave-shell-cleanup-hook |
| 786 | 'idlwave-toolbar-remove-everywhere) | 783 | 'idlwave-toolbar-remove-everywhere) |
| 787 | );; End can define toolbar | 784 | );; End can define toolbar |
| @@ -789,6 +786,7 @@ static char * file[] = { | |||
| 789 | (defun idlwave-toolbar-add () | 786 | (defun idlwave-toolbar-add () |
| 790 | "Add the IDLWAVE toolbar if appropriate." | 787 | "Add the IDLWAVE toolbar if appropriate." |
| 791 | (if (and (featurep 'xemacs) ; This is a noop on Emacs | 788 | (if (and (featurep 'xemacs) ; This is a noop on Emacs |
| 789 | (boundp 'idlwave-toolbar-is-possible) | ||
| 792 | (or (eq major-mode 'idlwave-mode) | 790 | (or (eq major-mode 'idlwave-mode) |
| 793 | (eq major-mode 'idlwave-shell-mode))) | 791 | (eq major-mode 'idlwave-shell-mode))) |
| 794 | (set-specifier default-toolbar (cons (current-buffer) | 792 | (set-specifier default-toolbar (cons (current-buffer) |
| @@ -797,6 +795,7 @@ static char * file[] = { | |||
| 797 | (defun idlwave-toolbar-remove () | 795 | (defun idlwave-toolbar-remove () |
| 798 | "Add the IDLWAVE toolbar if appropriate." | 796 | "Add the IDLWAVE toolbar if appropriate." |
| 799 | (if (and (featurep 'xemacs) ; This is a noop on Emacs | 797 | (if (and (featurep 'xemacs) ; This is a noop on Emacs |
| 798 | (boundp 'idlwave-toolbar-is-possible) | ||
| 800 | (or (eq major-mode 'idlwave-mode) | 799 | (or (eq major-mode 'idlwave-mode) |
| 801 | (eq major-mode 'idlwave-shell-mode))) | 800 | (eq major-mode 'idlwave-shell-mode))) |
| 802 | (remove-specifier default-toolbar (current-buffer)))) | 801 | (remove-specifier default-toolbar (current-buffer)))) |
| @@ -805,58 +804,64 @@ static char * file[] = { | |||
| 805 | (defvar idlwave-toolbar-visible nil) | 804 | (defvar idlwave-toolbar-visible nil) |
| 806 | (defun idlwave-toolbar-add-everywhere () | 805 | (defun idlwave-toolbar-add-everywhere () |
| 807 | "Add the toolbar in all appropriate buffers." | 806 | "Add the toolbar in all appropriate buffers." |
| 808 | (if (featurep 'xemacs) | 807 | (when (boundp 'idlwave-toolbar-is-possible) |
| 809 | ;; For XEmacs, map over all buffers to add toolbar | 808 | |
| 810 | (save-excursion | 809 | ;; First make sure new buffers will get the toolbar |
| 811 | (mapcar (lambda (buf) | 810 | (add-hook 'idlwave-mode-hook 'idlwave-toolbar-add) |
| 812 | (set-buffer buf) | 811 | ;; Then add it to all existing buffers |
| 813 | (idlwave-toolbar-add)) | 812 | (if (featurep 'xemacs) |
| 814 | (buffer-list))) | 813 | ;; For XEmacs, map over all buffers to add toolbar |
| 815 | ;; For Emacs, add the key definitions to the mode maps | 814 | (save-excursion |
| 816 | (mapcar (lambda (x) | 815 | (mapcar (lambda (buf) |
| 817 | (let* ((icon (aref x 0)) | 816 | (set-buffer buf) |
| 818 | (func (aref x 1)) | 817 | (idlwave-toolbar-add)) |
| 819 | ;;(show (aref x 2)) | 818 | (buffer-list))) |
| 820 | (help (aref x 3)) | 819 | ;; For Emacs, add the key definitions to the mode maps |
| 821 | (key (vector 'toolbar func)) | 820 | (mapcar (lambda (x) |
| 822 | (def (list 'menu-item | 821 | (let* ((icon (aref x 0)) |
| 823 | "a" | 822 | (func (aref x 1)) |
| 824 | func | 823 | ;;(show (aref x 2)) |
| 825 | :image (symbol-value icon) | 824 | (help (aref x 3)) |
| 826 | :help help))) | 825 | (key (vector 'tool-bar func)) |
| 827 | (define-key idlwave-mode-map key def) | 826 | (def (list 'menu-item |
| 828 | (define-key idlwave-shell-mode-map key def))) | 827 | "a" |
| 829 | (reverse idlwave-toolbar))) | 828 | func |
| 830 | (setq idlwave-toolbar-visible t)) | 829 | :image (symbol-value icon) |
| 830 | :help help))) | ||
| 831 | (define-key idlwave-mode-map key def) | ||
| 832 | (define-key idlwave-shell-mode-map key def))) | ||
| 833 | (reverse idlwave-toolbar))) | ||
| 834 | (setq idlwave-toolbar-visible t))) | ||
| 831 | 835 | ||
| 832 | (defun idlwave-toolbar-remove-everywhere () | 836 | (defun idlwave-toolbar-remove-everywhere () |
| 833 | "Remove the toolbar in all appropriate buffers." | 837 | "Remove the toolbar in all appropriate buffers." |
| 834 | ;; First make sure new buffers won't get the toolbar | 838 | ;; First make sure new buffers won't get the toolbar |
| 835 | (remove-hook 'idlwave-mode-hook 'idlwave-toolbar-add) | 839 | (when idlwave-toolbar-is-possible |
| 836 | ;; Then remove it in all existing buffers. | 840 | (remove-hook 'idlwave-mode-hook 'idlwave-toolbar-add) |
| 837 | (if (featurep 'xemacs) | 841 | ;; Then remove it in all existing buffers. |
| 838 | ;; For XEmacs, map over all buffers to remove toolbar | 842 | (if (featurep 'xemacs) |
| 839 | (save-excursion | 843 | ;; For XEmacs, map over all buffers to remove toolbar |
| 840 | (mapcar (lambda (buf) | 844 | (save-excursion |
| 841 | (set-buffer buf) | 845 | (mapcar (lambda (buf) |
| 842 | (idlwave-toolbar-remove)) | 846 | (set-buffer buf) |
| 843 | (buffer-list))) | 847 | (idlwave-toolbar-remove)) |
| 844 | ;; For Emacs, remove the key definitions from the mode maps | 848 | (buffer-list))) |
| 845 | (mapcar (lambda (x) | 849 | ;; For Emacs, remove the key definitions from the mode maps |
| 846 | (let* (;;(icon (aref x 0)) | 850 | (mapcar (lambda (x) |
| 847 | (func (aref x 1)) | 851 | (let* (;;(icon (aref x 0)) |
| 848 | ;;(show (aref x 2)) | 852 | (func (aref x 1)) |
| 849 | ;;(help (aref x 3)) | 853 | ;;(show (aref x 2)) |
| 850 | (key (vector 'toolbar func))) | 854 | ;;(help (aref x 3)) |
| 851 | (define-key idlwave-mode-map key nil) | 855 | (key (vector 'tool-bar func))) |
| 852 | (define-key idlwave-shell-mode-map key nil))) | 856 | (define-key idlwave-mode-map key nil) |
| 853 | idlwave-toolbar)) | 857 | (define-key idlwave-shell-mode-map key nil))) |
| 854 | (setq idlwave-toolbar-visible nil)) | 858 | idlwave-toolbar)) |
| 855 | 859 | (setq idlwave-toolbar-visible nil))) | |
| 856 | (defun idlwave-toolbar-toggle () | 860 | |
| 861 | (defun idlwave-toolbar-toggle (&optional force-on) | ||
| 857 | (interactive) | 862 | (interactive) |
| 858 | (if idlwave-toolbar-visible | 863 | (if idlwave-toolbar-visible |
| 859 | (idlwave-toolbar-remove-everywhere) | 864 | (or force-on (idlwave-toolbar-remove-everywhere)) |
| 860 | (idlwave-toolbar-add-everywhere))) | 865 | (idlwave-toolbar-add-everywhere))) |
| 861 | 866 | ||
| 862 | (provide 'idlw-toolbar) | 867 | (provide 'idlw-toolbar) |