1 ;;; idlw-toolbar.el --- a debugging toolbar for IDLWAVE
2 ;; Copyright (c) 1999, 2000, 2001,2002 Free Software Foundation
4 ;; Author: Carsten Dominik <dominik@astro.uva.nl>
5 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
7 ;; Date: $Date: 2003/09/01 15:45:35 $
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;; This file implements a debugging toolbar for IDLWAVE. It requires
30 ;; Emacs or XEmacs with toolbar and xpm support.
32 ;; New versions of IDLWAVE, documentation, and more information
39 (eval-when-compile (require 'cl
))
41 (defun idlwave-toolbar-make-button (image)
42 (if (featurep 'xemacs
)
43 (toolbar-make-button-list image
)
44 (list 'image
:type
'xpm
:data image
)))
46 (defvar default-toolbar
)
47 (if (not (or (and (featurep 'xemacs
) ; This is XEmacs
48 (featurep 'xpm
) ; need xpm
49 (featurep 'toolbar
)) ; ... and the toolbar
50 (and (not (featurep 'xemacs
)) ; This is Emacs
51 (boundp 'tool-bar-button-margin
) ; need toolbar
52 (fboundp 'image-type-available-p
) ; need image stuff
53 (image-type-available-p 'xpm
)) ; need xpm
55 ;; oops - cannot do the toolbar
56 (message "Sorry, IDLWAVE xpm toolbar cannot be used on this version of Emacs")
57 ;; OK, we can define a toolbar
59 (defconst idlwave-toolbar-is-possible t
60 "When defined, indicates that a toolbar is possible with this Emacs.")
61 (defvar idlwave-toolbar-compile-icon
62 (idlwave-toolbar-make-button
64 static char * file[] = {
66 \" c None s backgroundToolBarColor\",
67 \". c #000000000000\",
76 \" ................... \",
77 \" ........ ........ \",
80 \" ..... .. ... ..... \",
81 \" ...... .. .. ...... \",
82 \" ..... ... .. ..... \",
85 \" ........ ........ \",
86 \" ................... \",
98 (defvar idlwave-toolbar-next-error-icon
99 (idlwave-toolbar-make-button
101 static char * file[] = {
103 \" c None s backgroundToolBarColor\",
104 \". c #000000000000\",
105 \"R c #FFFF00000000\",
113 \" RRRRRRRRRRRRRRRRRRR \",
120 \" ..... .. ... ..... \",
121 \" ...... .. .. ...... \",
122 \" ..... ... .. ..... \",
123 \" ......... .... \",
124 \" ........ ..... \",
125 \" ........ ........ \",
126 \" ................... \",
134 "The Next Error icon.")
136 (defvar idlwave-toolbar-stop-at-icon
137 (idlwave-toolbar-make-button
139 static char * file[] = {
141 \" c None s backgroundToolBarColor\",
142 \". c #000000000000\",
143 \"R c #FFFF00000000\",
151 \" .RRRRRRRRRRRR. \",
152 \" .RRRRRRRRRRRRRR. \",
153 \" .RRRRRRRRRRRRRRRR. \",
154 \" .RRRRRRRRRRRRRRRRRR. \",
155 \" .RRRRRRRRRRRRRRRRRR. \",
156 \" .RRRRRRRRRRRRRRRRRR. \",
157 \" .RRRRRRRRRRRRRRRRRR. \",
158 \" .RRRRRRRRRRRRRRRRRR. \",
159 \" .RRRRRRRRRRRRRRRRRR. \",
160 \" .RRRRRRRRRRRRRRRRRR. \",
161 \" .RRRRRRRRRRRRRRRRRR. \",
162 \" .RRRRRRRRRRRRRRRR. \",
163 \" .RRRRRRRRRRRRRR. \",
164 \" .RRRRRRRRRRRR. \",
174 (defvar idlwave-toolbar-stop-in-icon
175 (idlwave-toolbar-make-button
177 static char * file[] = {
179 \" c None s backgroundToolBarColor\",
180 \"_ c #FFFFFFFFFFFF\",
181 \". c #000000000000\",
182 \"R c #FFFF00000000\",
190 \" .RRRRRRRRRRRR. \",
191 \" .RRR___RR___RRR. \",
192 \" .RRRR__RRRR__RRRR. \",
193 \" .RRRRR__RRRR__RRRRR. \",
194 \" .RRRRR__RRRR__RRRRR. \",
195 \" .RRRRR__RRRR__RRRRR. \",
196 \" .RRRR__RRRRRR__RRRR. \",
197 \" .RRRRR__RRRR__RRRRR. \",
198 \" .RRRRR__RRRR__RRRRR. \",
199 \" .RRRRR__RRRR__RRRRR. \",
200 \" .RRRRR__RRRR__RRRRR. \",
201 \" .RRRR___RR___RRRR. \",
202 \" .RRRRRRRRRRRRRR. \",
203 \" .RRRRRRRRRRRR. \",
214 (defvar idlwave-toolbar-clear-at-icon
215 (idlwave-toolbar-make-button
217 static char * file[] = {
219 \" c None s backgroundToolBarColor\",
220 \". c #000000000000\",
221 \"R c #FFFF00000000\",
226 \" ... ........ ... \",
227 \" ... .RRRRRRRR. ... \",
228 \" ....RRRRRRRRRR.... \",
229 \" ...RRRRRRRRRR... \",
230 \" ....RRRRRRRR.... \",
231 \" .RR...RRRRRR...RR. \",
232 \" .RRRR...RRRR...RRRR. \",
233 \" .RRRRR...RR...RRRRR. \",
234 \" .RRRRRR......RRRRRR. \",
235 \" .RRRRRRR....RRRRRRR. \",
236 \" .RRRRRRR....RRRRRRR. \",
237 \" .RRRRRR......RRRRRR. \",
238 \" .RRRRR...RR...RRRRR. \",
239 \" .RRRR...RRRR...RRRR. \",
240 \" .RR...RRRRRR...RR. \",
241 \" ....RRRRRRRR.... \",
242 \" ...RRRRRRRRRR... \",
243 \" ....RRRRRRRRRR.... \",
244 \" ... .RRRRRRRR. ... \",
245 \" ... ........ ... \",
250 "The Clear At icon.")
252 (defvar idlwave-toolbar-clear-all-icon
253 (idlwave-toolbar-make-button
255 static char * file[] = {
257 \" c None s backgroundToolBarColor\",
258 \". c #000000000000\",
259 \"X c #FFFFFFFFFFFF\",
260 \"R c #FFFF00000000\",
264 \" .. .... .... .. \",
265 \" ...RRRR. .RRRR... \",
266 \" ...RRRR. .RRRR... \",
267 \" .R...RRRR. .RRRR...R. \",
268 \" .RR...RRR. .RRR...RR. \",
269 \" .RRR...RR. .RR...RRR. \",
270 \" .RRRR...R. .R...RRRR. \",
271 \" .RRRR... ...RRRR. \",
272 \" .RRRR... ...RRRR. \",
273 \" .... ... ... .... \",
276 \" .... ..... .... \",
277 \" .RRRR.... ....RRRR. \",
278 \" .RRRRR... ...RRRRR. \",
279 \" .RRRRR.... ....RRRRR. \",
280 \" .RRRR...R. .R...RRRR. \",
281 \" .RRR...RR. .RR...RRR. \",
282 \" .RR...RRR. .RRR...RR. \",
283 \" ....RRR. .RRR.... \",
284 \" ...RRR. .RRR... \",
285 \" ....... ....... \",
289 "The Clear-All icon.")
291 (defvar idlwave-toolbar-edit-cmd-icon
292 (idlwave-toolbar-make-button
294 static char * file[] = {
296 \" c None s backgroundToolBarColor\",
297 \". c #000000000000\",
316 \" ................. \",
328 (defvar idlwave-toolbar-run-icon
329 (idlwave-toolbar-make-button
331 static char * file[] = {
333 \" c None s backgroundToolBarColor\",
334 \". s FgColor c #000000000000\",
335 \"G c #0000BBBB0000\",
349 \" .GGGGGGG. ....... \",
366 (defvar idlwave-toolbar-cont-icon
367 (idlwave-toolbar-make-button
369 static char * file[] = {
371 \" c None s backgroundToolBarColor\",
372 \". s FgColor c #000000000000\",
373 \"G c #0000BBBB0000\",
380 \" .GGGGGG. ....... \",
389 \" .GGGGGGG. ....... \",
404 (defvar idlwave-toolbar-to-here-icon
405 (idlwave-toolbar-make-button
407 static char * file[] = {
409 \" c None s backgroundToolBarColor\",
410 \". c #000000000000\",
411 \"G c #0000BBBB0000\",
412 \"R c #FFFF00000000\",
419 \" ..... ........ \",
422 \" .GG.... ........ \",
426 \" .GG. .G. ...... \",
428 \" .GGGGGGGG. RRRRRR \",
429 \" .GGGGGGGGG. RRRRRR \",
430 \" .GGGGGGG. RRRRRR \",
441 "The Cont-to-here icon.")
443 (defvar idlwave-toolbar-step-over-icon
444 (idlwave-toolbar-make-button
446 static char * file[] = {
448 \" c None s backgroundToolBarColor\",
449 \". c #000000000000\",
450 \"G c #0000BBBB0000\",
458 \" .GGGG. ....... \",
464 \" .GG. .G. ....... \",
467 \" .GGGGGGGGG. ....... \",
479 "The Step Over icon.")
481 (defvar idlwave-toolbar-step-into-icon
482 (idlwave-toolbar-make-button
484 static char * file[] = {
486 \" c None s backgroundToolBarColor\",
487 \". c #000000000000\",
488 \"G c #0000BBBB0000\",
498 \" .GG.... ........ \",
503 \" .GG...GG. ....... \",
506 \" .GGGGGGG. ....... \",
517 "The Step Into icon.")
519 (defvar idlwave-toolbar-step-out-icon
520 (idlwave-toolbar-make-button
522 static char * file[] = {
524 \" c None s backgroundToolBarColor\",
525 \". c #000000000000\",
526 \"G c #0000BBBB0000\",
537 \" .GGGGGGG. ........ \",
540 \" .GG...GG. ........ \",
545 \" .GG....... ....... \",
548 \" ........ ....... \",
558 (defvar idlwave-toolbar-eval-icon
559 (idlwave-toolbar-make-button
561 static char * file[] = {
563 \" c None s backgroundToolBarColor\",
564 \". c #000000000000\",
593 "The Evaluate icon.")
595 (defvar idlwave-toolbar-stack-up-icon
596 (idlwave-toolbar-make-button
598 static char * file[] = {
600 \" c None s backgroundToolBarColor\",
601 \". s FgColor c #000000000000\",
602 \"_ c #FFFFFFFFFFFF\",
603 \"G c #0000BBBB0000\",
604 \"R c #FFFF00000000\",
612 \" .______. ..... \",
613 \" .______. ....... \",
633 "The Stack Up icon.")
635 (defvar idlwave-toolbar-stack-down-icon
636 (idlwave-toolbar-make-button
638 static char * file[] = {
640 \" c None s backgroundToolBarColor\",
641 \". s FgColor c #000000000000\",
642 \"_ c #FFFFFFFFFFFF\",
643 \"G c #0000BBBB0000\",
644 \"R c #FFFF00000000\",
665 \" .RRRRRR. ....... \",
666 \" .RRRRRR. ..... \",
673 "The Stack Down icon.")
675 (defvar idlwave-toolbar-reset-icon
676 (idlwave-toolbar-make-button
678 static char * file[] = {
680 \" c None s backgroundToolBarColor\",
681 \"G c #0000BBBB0000\",
682 \". c #000000000000\",
713 (defvar idlwave-toolbar
715 [idlwave-toolbar-compile-icon
716 idlwave-shell-save-and-compile
718 "Save and Compile this file (or recompile last)"]
719 [idlwave-toolbar-next-error-icon
720 idlwave-shell-goto-next-error
723 [idlwave-toolbar-stop-at-icon
724 idlwave-shell-break-here
725 (eq major-mode
'idlwave-mode
)
726 "Set Breakpoint at selected position"]
727 [idlwave-toolbar-stop-in-icon
728 idlwave-shell-break-in
730 "Stop in Function with name near at point"]
731 [idlwave-toolbar-clear-at-icon
732 idlwave-shell-clear-current-bp
734 "Clear Breakpoint at selected position"]
735 [idlwave-toolbar-clear-all-icon
736 idlwave-shell-clear-all-bp
738 "Clear all Breakpoints"]
739 [idlwave-toolbar-edit-cmd-icon
740 idlwave-shell-edit-default-command-line
742 "Edit Default Command Line"]
743 [idlwave-toolbar-run-icon
744 idlwave-shell-execute-default-command-line
746 "Reset, then Execute Default Command Line"]
747 [idlwave-toolbar-cont-icon
750 "Continue Current Program"]
751 [idlwave-toolbar-to-here-icon
752 idlwave-shell-to-here
753 (eq major-mode
'idlwave-mode
)
754 "Continue to Here (cursor position)"]
755 [idlwave-toolbar-step-over-icon
756 idlwave-shell-stepover
758 "Step Over (aka next)"]
759 [idlwave-toolbar-step-into-icon
762 "Step Into (aka step)"]
763 [idlwave-toolbar-step-out-icon
766 "Step Out (of subroutine)"]
767 [idlwave-toolbar-eval-icon
770 "Print Expression at or before Point"]
771 [idlwave-toolbar-stack-up-icon
772 idlwave-shell-stack-up
774 "Stack Up (towards \"cooler\" - less recently visited - frames)"]
775 [idlwave-toolbar-stack-down-icon
776 idlwave-shell-stack-down
778 "Stack Down (towards \"warmer\" - more recently visited - frames)"]
779 [idlwave-toolbar-reset-icon
782 "Reset IDL (RETALL & CLOSE,/ALL and more)"]
785 ;; When the shell exits, arrange to remove the special toolbar everywhere.
786 (add-hook 'idlwave-shell-cleanup-hook
787 'idlwave-toolbar-remove-everywhere
)
788 );; End can define toolbar
790 (defun idlwave-toolbar-add ()
791 "Add the IDLWAVE toolbar if appropriate."
792 (if (and (featurep 'xemacs
) ; This is a noop on Emacs
793 (boundp 'idlwave-toolbar-is-possible
)
794 (or (eq major-mode
'idlwave-mode
)
795 (eq major-mode
'idlwave-shell-mode
)))
796 (set-specifier default-toolbar
(cons (current-buffer)
799 (defun idlwave-toolbar-remove ()
800 "Add the IDLWAVE toolbar if appropriate."
801 (if (and (featurep 'xemacs
) ; This is a noop on Emacs
802 (boundp 'idlwave-toolbar-is-possible
)
803 (or (eq major-mode
'idlwave-mode
)
804 (eq major-mode
'idlwave-shell-mode
)))
805 (remove-specifier default-toolbar
(current-buffer))))
807 (defvar idlwave-shell-mode-map
)
808 (defvar idlwave-mode-map
)
809 (defvar idlwave-toolbar-visible nil
)
810 (defun idlwave-toolbar-add-everywhere ()
811 "Add the toolbar in all appropriate buffers."
812 (when (boundp 'idlwave-toolbar-is-possible
)
814 ;; First make sure new buffers will get the toolbar
815 (add-hook 'idlwave-mode-hook
'idlwave-toolbar-add
)
816 ;; Then add it to all existing buffers
817 (if (featurep 'xemacs
)
818 ;; For XEmacs, map over all buffers to add toolbar
820 (mapcar (lambda (buf)
822 (idlwave-toolbar-add))
824 ;; For Emacs, add the key definitions to the mode maps
826 (let* ((icon (aref x
0))
830 (key (vector 'tool-bar func
))
831 (def (list 'menu-item
834 :image
(symbol-value icon
)
836 (define-key idlwave-mode-map key def
)
837 (define-key idlwave-shell-mode-map key def
)))
838 (reverse idlwave-toolbar
)))
839 (setq idlwave-toolbar-visible t
)))
841 (defun idlwave-toolbar-remove-everywhere ()
842 "Remove the toolbar in all appropriate buffers."
843 ;; First make sure new buffers won't get the toolbar
844 (when idlwave-toolbar-is-possible
845 (remove-hook 'idlwave-mode-hook
'idlwave-toolbar-add
)
846 ;; Then remove it in all existing buffers.
847 (if (featurep 'xemacs
)
848 ;; For XEmacs, map over all buffers to remove toolbar
850 (mapcar (lambda (buf)
852 (idlwave-toolbar-remove))
854 ;; For Emacs, remove the key definitions from the mode maps
856 (let* (;;(icon (aref x 0))
860 (key (vector 'tool-bar func
)))
861 (define-key idlwave-mode-map key nil
)
862 (define-key idlwave-shell-mode-map key nil
)))
864 (setq idlwave-toolbar-visible nil
)))
866 (defun idlwave-toolbar-toggle (&optional force-on
)
868 (if idlwave-toolbar-visible
869 (or force-on
(idlwave-toolbar-remove-everywhere))
870 (idlwave-toolbar-add-everywhere))
871 ;; Now make sure this
872 (if (featurep 'xemacs
)
873 nil
; no action necessary, toolbar gets updated automatically
874 ;; On Emacs, redraw the frame to make sure the Toolbar is updated.
875 (redraw-frame (selected-frame))))
877 (provide 'idlw-toolbar
)
878 (provide 'idlwave-toolbar
)
880 ;;; idlw-toolbar.el ends here
883 ;;; arch-tag: ec9a3717-c44c-4716-9bda-cdacbe5ddb62