(cvs-vc-command-advice): Handle the case where args
[emacs.git] / lisp / progmodes / idlw-toolbar.el
blobe6f243d411c98be35a736c878b45c7581c9ac9ea
1 ;;; idlw-toolbar.el --- a debugging toolbar for IDLWAVE
2 ;; Copyright (c) 1999, 2000 Free Software Foundation
4 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
5 ;; Maintainer: John-David Smith <jdsmith@astro.cornell.edu>
6 ;; Version: 4.7
7 ;; Date: $Date: 2001/07/16 12:22:59 $
8 ;; Keywords: processes
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)
15 ;; any later version.
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.
27 ;;; Commentary:
29 ;; This file implements a debugging toolbar for IDLWAVE. It requires
30 ;; Emacs or XEmacs with toolbar and xpm support.
33 ;;; Code:
35 (eval-when-compile (require 'cl))
37 (defun idlwave-toolbar-make-button (image)
38 (if (featurep 'xemacs)
39 (toolbar-make-button-list image)
40 (list 'image :type 'xpm :data image)))
42 (defvar default-toolbar)
43 (if (not (or (and (featurep 'xemacs) ; This is XEmacs
44 (featurep 'xpm) ; need xpm
45 (featurep 'toolbar)) ; ... and the toolbar
46 (and (not (featurep 'xemacs)) ; This is Emacs
47 (boundp 'tool-bar-button-margin) ; need toolbar
48 (fboundp 'image-type-available-p) ; need image stuff
49 (image-type-available-p 'xpm)) ; need xpm
51 ;; oops - cannot do the toolbar
52 (message "Sorry, IDLWAVE xpm toolbar cannot be used on this version of Emacs")
53 ;; OK, we can define a toolbar
55 (defconst idlwave-toolbar-is-possible t
56 "When defined, indicates that a toolbar is possible with this Emacs.")
57 (defvar idlwave-toolbar-compile-icon
58 (idlwave-toolbar-make-button
59 "/* XPM */
60 static char * file[] = {
61 \"28 28 2 1\",
62 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
63 \". c #000000000000\",
64 \" \",
65 \" \",
66 \" \",
67 \" . \",
68 \" .. ... .. \",
69 \" .... ... .... \",
70 \" ............. \",
71 \" ........... \",
72 \" ................... \",
73 \" ........ ........ \",
74 \" ..... ........ \",
75 \" .... ......... \",
76 \" ..... .. ... ..... \",
77 \" ...... .. .. ...... \",
78 \" ..... ... .. ..... \",
79 \" ......... .... \",
80 \" ........ ..... \",
81 \" ........ ........ \",
82 \" ................... \",
83 \" ........... \",
84 \" ............. \",
85 \" .... ... .... \",
86 \" .. ... .. \",
87 \" . \",
88 \" \",
89 \" \",
90 \" \",
91 \" \"};")
92 "The compile icon.")
94 (defvar idlwave-toolbar-next-error-icon
95 (idlwave-toolbar-make-button
96 "/* XPM */
97 static char * file[] = {
98 \"28 28 3 1\",
99 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
100 \". c #000000000000\",
101 \"R c #FFFF00000000\",
102 \" \",
103 \" \",
104 \" R \",
105 \" RR RRR RR \",
106 \" RRRR RRR RRRR \",
107 \" RRRRRRRRRRRRR \",
108 \" RRRRRRRRRRR \",
109 \" RRRRRRRRRRRRRRRRRRR \",
110 \" RRRRRRRR \",
111 \" RRRRR \",
112 \" RRRR \",
113 \" ........ \",
114 \" ........ \",
115 \" ......... \",
116 \" ..... .. ... ..... \",
117 \" ...... .. .. ...... \",
118 \" ..... ... .. ..... \",
119 \" ......... .... \",
120 \" ........ ..... \",
121 \" ........ ........ \",
122 \" ................... \",
123 \" ........... \",
124 \" ............. \",
125 \" .... ... .... \",
126 \" .. ... .. \",
127 \" . \",
128 \" \",
129 \" \"};")
130 "The Next Error icon.")
132 (defvar idlwave-toolbar-stop-at-icon
133 (idlwave-toolbar-make-button
134 "/* XPM */
135 static char * file[] = {
136 \"28 28 3 1\",
137 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
138 \". c #000000000000\",
139 \"R c #FFFF00000000\",
140 \" \",
141 \" \",
142 \" \",
143 \" \",
144 \" ........ \",
145 \" .RRRRRRRR. \",
146 \" .RRRRRRRRRR. \",
147 \" .RRRRRRRRRRRR. \",
148 \" .RRRRRRRRRRRRRR. \",
149 \" .RRRRRRRRRRRRRRRR. \",
150 \" .RRRRRRRRRRRRRRRRRR. \",
151 \" .RRRRRRRRRRRRRRRRRR. \",
152 \" .RRRRRRRRRRRRRRRRRR. \",
153 \" .RRRRRRRRRRRRRRRRRR. \",
154 \" .RRRRRRRRRRRRRRRRRR. \",
155 \" .RRRRRRRRRRRRRRRRRR. \",
156 \" .RRRRRRRRRRRRRRRRRR. \",
157 \" .RRRRRRRRRRRRRRRRRR. \",
158 \" .RRRRRRRRRRRRRRRR. \",
159 \" .RRRRRRRRRRRRRR. \",
160 \" .RRRRRRRRRRRR. \",
161 \" .RRRRRRRRRR. \",
162 \" .RRRRRRRR. \",
163 \" ........ \",
164 \" \",
165 \" \",
166 \" \",
167 \" \"};")
168 "The Stop At icon.")
170 (defvar idlwave-toolbar-stop-in-icon
171 (idlwave-toolbar-make-button
172 "/* XPM */
173 static char * file[] = {
174 \"28 28 4 1\",
175 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
176 \"_ c #FFFFFFFFFFFF\",
177 \". c #000000000000\",
178 \"R c #FFFF00000000\",
179 \" \",
180 \" \",
181 \" \",
182 \" \",
183 \" ........ \",
184 \" .RRRRRRRR. \",
185 \" .RRRRRRRRRR. \",
186 \" .RRRRRRRRRRRR. \",
187 \" .RRR___RR___RRR. \",
188 \" .RRRR__RRRR__RRRR. \",
189 \" .RRRRR__RRRR__RRRRR. \",
190 \" .RRRRR__RRRR__RRRRR. \",
191 \" .RRRRR__RRRR__RRRRR. \",
192 \" .RRRR__RRRRRR__RRRR. \",
193 \" .RRRRR__RRRR__RRRRR. \",
194 \" .RRRRR__RRRR__RRRRR. \",
195 \" .RRRRR__RRRR__RRRRR. \",
196 \" .RRRRR__RRRR__RRRRR. \",
197 \" .RRRR___RR___RRRR. \",
198 \" .RRRRRRRRRRRRRR. \",
199 \" .RRRRRRRRRRRR. \",
200 \" .RRRRRRRRRR. \",
201 \" .RRRRRRRR. \",
202 \" ........ \",
203 \" \",
204 \" \",
205 \" \",
206 \" \"};")
207 "The Stop in icon.")
210 (defvar idlwave-toolbar-clear-at-icon
211 (idlwave-toolbar-make-button
212 "/* XPM */
213 static char * file[] = {
214 \"28 28 3 1\",
215 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
216 \". c #000000000000\",
217 \"R c #FFFF00000000\",
218 \" \",
219 \" \",
220 \" \",
221 \" ... ... \",
222 \" ... ........ ... \",
223 \" ... .RRRRRRRR. ... \",
224 \" ....RRRRRRRRRR.... \",
225 \" ...RRRRRRRRRR... \",
226 \" ....RRRRRRRR.... \",
227 \" .RR...RRRRRR...RR. \",
228 \" .RRRR...RRRR...RRRR. \",
229 \" .RRRRR...RR...RRRRR. \",
230 \" .RRRRRR......RRRRRR. \",
231 \" .RRRRRRR....RRRRRRR. \",
232 \" .RRRRRRR....RRRRRRR. \",
233 \" .RRRRRR......RRRRRR. \",
234 \" .RRRRR...RR...RRRRR. \",
235 \" .RRRR...RRRR...RRRR. \",
236 \" .RR...RRRRRR...RR. \",
237 \" ....RRRRRRRR.... \",
238 \" ...RRRRRRRRRR... \",
239 \" ....RRRRRRRRRR.... \",
240 \" ... .RRRRRRRR. ... \",
241 \" ... ........ ... \",
242 \" ... ... \",
243 \" \",
244 \" \",
245 \" \"};")
246 "The Clear At icon.")
248 (defvar idlwave-toolbar-clear-all-icon
249 (idlwave-toolbar-make-button
250 "/* XPM */
251 static char * file[] = {
252 \"28 28 4 1\",
253 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
254 \". c #000000000000\",
255 \"X c #FFFFFFFFFFFF\",
256 \"R c #FFFF00000000\",
257 \" \",
258 \" \",
259 \" \",
260 \" .. .... .... .. \",
261 \" ...RRRR. .RRRR... \",
262 \" ...RRRR. .RRRR... \",
263 \" .R...RRRR. .RRRR...R. \",
264 \" .RR...RRR. .RRR...RR. \",
265 \" .RRR...RR. .RR...RRR. \",
266 \" .RRRR...R. .R...RRRR. \",
267 \" .RRRR... ...RRRR. \",
268 \" .RRRR... ...RRRR. \",
269 \" .... ... ... .... \",
270 \" ..... \",
271 \" ... \",
272 \" .... ..... .... \",
273 \" .RRRR.... ....RRRR. \",
274 \" .RRRRR... ...RRRRR. \",
275 \" .RRRRR.... ....RRRRR. \",
276 \" .RRRR...R. .R...RRRR. \",
277 \" .RRR...RR. .RR...RRR. \",
278 \" .RR...RRR. .RRR...RR. \",
279 \" ....RRR. .RRR.... \",
280 \" ...RRR. .RRR... \",
281 \" ....... ....... \",
282 \" \",
283 \" \",
284 \" \"};")
285 "The Clear-All icon.")
287 (defvar idlwave-toolbar-edit-cmd-icon
288 (idlwave-toolbar-make-button
289 "/* XPM */
290 static char * file[] = {
291 \"28 28 2 1\",
292 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
293 \". c #000000000000\",
294 \" \",
295 \" \",
296 \" \",
297 \" \",
298 \" \",
299 \" \",
300 \" \",
301 \" \",
302 \" \",
303 \" \",
304 \" \",
305 \" .. \",
306 \" .. \",
307 \" .. \",
308 \" .. \",
309 \" .. \",
310 \" \",
311 \" \",
312 \" ................. \",
313 \" \",
314 \" \",
315 \" \",
316 \" \",
317 \" \",
318 \" \",
319 \" \",
320 \" \",
321 \" \"};")
322 "The edit-cmd icon")
324 (defvar idlwave-toolbar-run-icon
325 (idlwave-toolbar-make-button
326 "/* XPM */
327 static char * file[] = {
328 \"28 28 3 1\",
329 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
330 \". s FgColor c #000000000000\",
331 \"G c #0000BBBB0000\",
332 \" \",
333 \" \",
334 \" \",
335 \" \",
336 \" ..... \",
337 \" .GGG. \",
338 \" .GGG. \",
339 \" .GGG. ....... \",
340 \" .GGG. \",
341 \" .GGG. \",
342 \" .GGG. ....... \",
343 \" .GGG. \",
344 \" ....GGG.... \",
345 \" .GGGGGGG. ....... \",
346 \" .GGGGG. \",
347 \" .GGG. \",
348 \" .G. ....... \",
349 \" . \",
350 \" \",
351 \" ....... \",
352 \" \",
353 \" \",
354 \" ....... \",
355 \" \",
356 \" \",
357 \" \",
358 \" \",
359 \" \"};")
360 "The Run icon.")
362 (defvar idlwave-toolbar-cont-icon
363 (idlwave-toolbar-make-button
364 "/* XPM */
365 static char * file[] = {
366 \"28 28 3 1\",
367 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
368 \". s FgColor c #000000000000\",
369 \"G c #0000BBBB0000\",
370 \" \",
371 \" \",
372 \" \",
373 \" ....... \",
374 \" \",
375 \" ....... \",
376 \" .GGGGGG. ....... \",
377 \" .GGGGGGG. \",
378 \" .GGG..... \",
379 \" .GGG. ....... \",
380 \" .GGG. \",
381 \" .GGG. \",
382 \" .GGG. ....... \",
383 \" .GGG. \",
384 \" ....GGG.... \",
385 \" .GGGGGGG. ....... \",
386 \" .GGGGG. \",
387 \" .GGG. \",
388 \" .G. ....... \",
389 \" . \",
390 \" \",
391 \" ....... \",
392 \" \",
393 \" \",
394 \" \",
395 \" \",
396 \" \",
397 \" \"};")
398 "The Cont icon.")
400 (defvar idlwave-toolbar-to-here-icon
401 (idlwave-toolbar-make-button
402 "/* XPM */
403 static char * file[] = {
404 \"28 28 4 1\",
405 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
406 \". c #000000000000\",
407 \"G c #0000BBBB0000\",
408 \"R c #FFFF00000000\",
409 \" \",
410 \" \",
411 \" \",
412 \" \",
413 \" \",
414 \" \",
415 \" ..... ........ \",
416 \" .GGGG. \",
417 \" .GGGGG. \",
418 \" .GG.... ........ \",
419 \" .GG. \",
420 \" .GG. . \",
421 \" .GG. .. \",
422 \" .GG. .G. ...... \",
423 \" .GG...GG. \",
424 \" .GGGGGGGG. RRRRRR \",
425 \" .GGGGGGGGG. RRRRRR \",
426 \" .GGGGGGG. RRRRRR \",
427 \" ....GG. \",
428 \" .G. ...... \",
429 \" .. \",
430 \" . \",
431 \" \",
432 \" \",
433 \" \",
434 \" \",
435 \" \",
436 \" \"};")
437 "The Cont-to-here icon.")
439 (defvar idlwave-toolbar-step-over-icon
440 (idlwave-toolbar-make-button
441 "/* XPM */
442 static char * file[] = {
443 \"28 28 3 1\",
444 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
445 \". c #000000000000\",
446 \"G c #0000BBBB0000\",
447 \" \",
448 \" \",
449 \" \",
450 \" \",
451 \" \",
452 \" \",
453 \" ..... \",
454 \" .GGGG. ....... \",
455 \" .GGGGG. \",
456 \" .GG.... \",
457 \" .GG. ....... \",
458 \" .GG. . \",
459 \" .GG. .. \",
460 \" .GG. .G. ....... \",
461 \" .GG...GG. \",
462 \" .GGGGGGGG. \",
463 \" .GGGGGGGGG. ....... \",
464 \" .GGGGGGG. \",
465 \" ....GG. \",
466 \" .G. ....... \",
467 \" .. \",
468 \" . \",
469 \" ....... \",
470 \" \",
471 \" \",
472 \" \",
473 \" \",
474 \" \"};")
475 "The Step Over icon.")
477 (defvar idlwave-toolbar-step-into-icon
478 (idlwave-toolbar-make-button
479 "/* XPM */
480 static char * file[] = {
481 \"28 28 3 1\",
482 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
483 \". c #000000000000\",
484 \"G c #0000BBBB0000\",
485 \" \",
486 \" \",
487 \" \",
488 \" \",
489 \" \",
490 \" \",
491 \" ..... ....... \",
492 \" .GGGG. \",
493 \" .GGGGG. \",
494 \" .GG.... ........ \",
495 \" .GG. \",
496 \" .GG. . \",
497 \" .GG. .. \",
498 \" .GG. .G. \",
499 \" .GG...GG. ....... \",
500 \" .GGGGGGGG. \",
501 \" .GGGGGGGGG. \",
502 \" .GGGGGGG. ....... \",
503 \" ....GG. \",
504 \" .G. \",
505 \" .. ....... \",
506 \" . \",
507 \" \",
508 \" \",
509 \" \",
510 \" \",
511 \" \",
512 \" \"};")
513 "The Step Into icon.")
515 (defvar idlwave-toolbar-step-out-icon
516 (idlwave-toolbar-make-button
517 "/* XPM */
518 static char * file[] = {
519 \"28 28 3 1\",
520 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
521 \". c #000000000000\",
522 \"G c #0000BBBB0000\",
523 \" \",
524 \" \",
525 \" \",
526 \" \",
527 \" \",
528 \" \",
529 \" . \",
530 \" .. ........ \",
531 \" .G. \",
532 \" ....GG. \",
533 \" .GGGGGGG. ........ \",
534 \" .GGGGGGGGG. \",
535 \" .GGGGGGGG. \",
536 \" .GG...GG. ........ \",
537 \" .GG. .G. \",
538 \" .GG. .. \",
539 \" .GG. . \",
540 \" .GG. \",
541 \" .GG....... ....... \",
542 \" .GGGGGGGG. \",
543 \" .GGGGGGG. \",
544 \" ........ ....... \",
545 \" \",
546 \" \",
547 \" \",
548 \" \",
549 \" \",
550 \" \"};")
551 "The Step up icon.")
554 (defvar idlwave-toolbar-eval-icon
555 (idlwave-toolbar-make-button
556 "/* XPM */
557 static char * file[] = {
558 \"28 28 2 1\",
559 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
560 \". c #000000000000\",
561 \" \",
562 \" \",
563 \" \",
564 \" \",
565 \" \",
566 \" \",
567 \" \",
568 \" \",
569 \" \",
570 \" \",
571 \" \",
572 \" .... \",
573 \" .. .. ...... \",
574 \" .. .. ...... \",
575 \" .. .. \",
576 \" .. .. ...... \",
577 \" .. .. ...... \",
578 \" .... \",
579 \" .. \",
580 \" .. \",
581 \" \",
582 \" \",
583 \" \",
584 \" \",
585 \" \",
586 \" \",
587 \" \",
588 \" \"};")
589 "The Evaluate icon.")
591 (defvar idlwave-toolbar-stack-up-icon
592 (idlwave-toolbar-make-button
593 "/* XPM */
594 static char * file[] = {
595 \"28 28 5 1\",
596 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
597 \". s FgColor c #000000000000\",
598 \"_ c #FFFFFFFFFFFF\",
599 \"G c #0000BBBB0000\",
600 \"R c #FFFF00000000\",
601 \" \",
602 \" \",
603 \" \",
604 \" \",
605 \" \",
606 \" ........ . \",
607 \" .______. ... \",
608 \" .______. ..... \",
609 \" .______. ....... \",
610 \" .______. ... \",
611 \" .______. ... \",
612 \" ........ ... \",
613 \" .GGGGGG. ... \",
614 \" .GGGGGG. ... \",
615 \" .GGGGGG. \",
616 \" .GGGGGG. \",
617 \" .GGGGGG. \",
618 \" ........ \",
619 \" .RRRRRR. \",
620 \" .RRRRRR. \",
621 \" .RRRRRR. \",
622 \" .RRRRRR. \",
623 \" .RRRRRR. \",
624 \" ........ \",
625 \" \",
626 \" \",
627 \" \",
628 \" \"};")
629 "The Stack Up icon.")
631 (defvar idlwave-toolbar-stack-down-icon
632 (idlwave-toolbar-make-button
633 "/* XPM */
634 static char * file[] = {
635 \"28 28 5 1\",
636 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
637 \". s FgColor c #000000000000\",
638 \"_ c #FFFFFFFFFFFF\",
639 \"G c #0000BBBB0000\",
640 \"R c #FFFF00000000\",
641 \" \",
642 \" \",
643 \" \",
644 \" \",
645 \" \",
646 \" ........ \",
647 \" .______. \",
648 \" .______. \",
649 \" .______. \",
650 \" .______. \",
651 \" .______. \",
652 \" ........ \",
653 \" .GGGGGG. \",
654 \" .GGGGGG. \",
655 \" .GGGGGG. \",
656 \" .GGGGGG. ... \",
657 \" .GGGGGG. ... \",
658 \" ........ ... \",
659 \" .RRRRRR. ... \",
660 \" .RRRRRR. ... \",
661 \" .RRRRRR. ....... \",
662 \" .RRRRRR. ..... \",
663 \" .RRRRRR. ... \",
664 \" ........ . \",
665 \" \",
666 \" \",
667 \" \",
668 \" \"};")
669 "The Stack Down icon.")
671 (defvar idlwave-toolbar-reset-icon
672 (idlwave-toolbar-make-button
673 "/* XPM */
674 static char * file[] = {
675 \"28 28 3 1\",
676 \" c #C8C8C8C8C8C8 s backgroundToolBarColor\",
677 \"G c #0000BBBB0000\",
678 \". c #000000000000\",
679 \" \",
680 \" \",
681 \" \",
682 \" . \",
683 \" .G. . \",
684 \" .GGG.. .G. \",
685 \" .GGGGG..GG. \",
686 \" ..GGGGGGGG. \",
687 \" ..GGGGGG. \",
688 \" ..GGGGG. \",
689 \" .GGGGGG. \",
690 \" .G...... \",
691 \" \",
692 \" ..... \",
693 \" ......... \",
694 \" ......... \",
695 \" ......... \",
696 \" . ..... . \",
697 \" . . \",
698 \" . . \",
699 \" . . \",
700 \" . . \",
701 \" . . \",
702 \" .. .. \",
703 \" ....... \",
704 \" ..... \",
705 \" \",
706 \" \"};")
707 "The Reset icon.")
709 (defvar idlwave-toolbar
711 [idlwave-toolbar-compile-icon
712 idlwave-shell-save-and-compile
714 "Save and Compile this file (or recompile last)"]
715 [idlwave-toolbar-next-error-icon
716 idlwave-shell-goto-next-error
718 "Goto Next Error"]
719 [idlwave-toolbar-stop-at-icon
720 idlwave-shell-break-here
721 (eq major-mode 'idlwave-mode)
722 "Set Breakpoint at selected position"]
723 [idlwave-toolbar-stop-in-icon
724 idlwave-shell-break-in
726 "Stop in Function with name near at point"]
727 [idlwave-toolbar-clear-at-icon
728 idlwave-shell-clear-current-bp
730 "Clear Breakpoint at selected position"]
731 [idlwave-toolbar-clear-all-icon
732 idlwave-shell-clear-all-bp
734 "Clear all Breakpoints"]
735 [idlwave-toolbar-edit-cmd-icon
736 idlwave-shell-edit-default-command-line
738 "Edit Default Command Line"]
739 [idlwave-toolbar-run-icon
740 idlwave-shell-execute-default-command-line
742 "Reset, then Execute Default Command Line"]
743 [idlwave-toolbar-cont-icon
744 idlwave-shell-cont
746 "Continue Current Program"]
747 [idlwave-toolbar-to-here-icon
748 idlwave-shell-to-here
749 (eq major-mode 'idlwave-mode)
750 "Continue to Here (cursor position)"]
751 [idlwave-toolbar-step-over-icon
752 idlwave-shell-stepover
754 "Step Over (aka next)"]
755 [idlwave-toolbar-step-into-icon
756 idlwave-shell-step
758 "Step Into (aka step)"]
759 [idlwave-toolbar-step-out-icon
760 idlwave-shell-out
762 "Step Out (of subroutine)"]
763 [idlwave-toolbar-eval-icon
764 idlwave-shell-print
766 "Print Expression at or before Point"]
767 [idlwave-toolbar-stack-up-icon
768 idlwave-shell-stack-up
770 "Stack Up (towards \"cooler\" - less recently visited - frames)"]
771 [idlwave-toolbar-stack-down-icon
772 idlwave-shell-stack-down
774 "Stack Down (towards \"warmer\" - more recently visited - frames)"]
775 [idlwave-toolbar-reset-icon
776 idlwave-shell-reset
778 "Reset IDL (RETALL & CLOSE,/ALL and more)"]
781 ;; When the shell exits, arrange to remove the special toolbar everywhere.
782 (add-hook 'idlwave-shell-cleanup-hook
783 'idlwave-toolbar-remove-everywhere)
784 );; End can define toolbar
786 (defun idlwave-toolbar-add ()
787 "Add the IDLWAVE toolbar if appropriate."
788 (if (and (featurep 'xemacs) ; This is a noop on Emacs
789 (boundp 'idlwave-toolbar-is-possible)
790 (or (eq major-mode 'idlwave-mode)
791 (eq major-mode 'idlwave-shell-mode)))
792 (set-specifier default-toolbar (cons (current-buffer)
793 idlwave-toolbar))))
795 (defun idlwave-toolbar-remove ()
796 "Add the IDLWAVE toolbar if appropriate."
797 (if (and (featurep 'xemacs) ; This is a noop on Emacs
798 (boundp 'idlwave-toolbar-is-possible)
799 (or (eq major-mode 'idlwave-mode)
800 (eq major-mode 'idlwave-shell-mode)))
801 (remove-specifier default-toolbar (current-buffer))))
803 (defvar idlwave-shell-mode-map)
804 (defvar idlwave-mode-map)
805 (defvar idlwave-toolbar-visible nil)
806 (defun idlwave-toolbar-add-everywhere ()
807 "Add the toolbar in all appropriate buffers."
808 (when (boundp 'idlwave-toolbar-is-possible)
810 ;; First make sure new buffers will get the toolbar
811 (add-hook 'idlwave-mode-hook 'idlwave-toolbar-add)
812 ;; Then add it to all existing buffers
813 (if (featurep 'xemacs)
814 ;; For XEmacs, map over all buffers to add toolbar
815 (save-excursion
816 (mapcar (lambda (buf)
817 (set-buffer buf)
818 (idlwave-toolbar-add))
819 (buffer-list)))
820 ;; For Emacs, add the key definitions to the mode maps
821 (mapcar (lambda (x)
822 (let* ((icon (aref x 0))
823 (func (aref x 1))
824 ;;(show (aref x 2))
825 (help (aref x 3))
826 (key (vector 'tool-bar func))
827 (def (list 'menu-item
829 func
830 :image (symbol-value icon)
831 :help help)))
832 (define-key idlwave-mode-map key def)
833 (define-key idlwave-shell-mode-map key def)))
834 (reverse idlwave-toolbar)))
835 (setq idlwave-toolbar-visible t)))
837 (defun idlwave-toolbar-remove-everywhere ()
838 "Remove the toolbar in all appropriate buffers."
839 ;; First make sure new buffers won't get the toolbar
840 (when idlwave-toolbar-is-possible
841 (remove-hook 'idlwave-mode-hook 'idlwave-toolbar-add)
842 ;; Then remove it in all existing buffers.
843 (if (featurep 'xemacs)
844 ;; For XEmacs, map over all buffers to remove toolbar
845 (save-excursion
846 (mapcar (lambda (buf)
847 (set-buffer buf)
848 (idlwave-toolbar-remove))
849 (buffer-list)))
850 ;; For Emacs, remove the key definitions from the mode maps
851 (mapcar (lambda (x)
852 (let* (;;(icon (aref x 0))
853 (func (aref x 1))
854 ;;(show (aref x 2))
855 ;;(help (aref x 3))
856 (key (vector 'tool-bar func)))
857 (define-key idlwave-mode-map key nil)
858 (define-key idlwave-shell-mode-map key nil)))
859 idlwave-toolbar))
860 (setq idlwave-toolbar-visible nil)))
862 (defun idlwave-toolbar-toggle (&optional force-on)
863 (interactive)
864 (if idlwave-toolbar-visible
865 (or force-on (idlwave-toolbar-remove-everywhere))
866 (idlwave-toolbar-add-everywhere))
867 ;; Now make sure this
868 (if (featurep 'xemacs)
869 nil ; no action necessary, toolbar gets updated automatically
870 ;; On Emacs, redraw the frame to make sure the Toolbar is updated.
871 (redraw-frame (selected-frame))))
873 (provide 'idlw-toolbar)
874 (provide 'idlwave-toolbar)
876 ;;; idlw-toolbar.el ends here