]> code.delx.au - gnu-emacs/blob - lisp/progmodes/idlw-toolbar.el
tag of miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-137
[gnu-emacs] / lisp / progmodes / idlw-toolbar.el
1 ;;; idlw-toolbar.el --- a debugging toolbar for IDLWAVE
2 ;; Copyright (c) 1999, 2000, 2001,2002 Free Software Foundation
3
4 ;; Author: Carsten Dominik <dominik@astro.uva.nl>
5 ;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
6 ;; Version: 4.15
7 ;; Date: $Date: 2003/09/01 15:45:35 $
8 ;; Keywords: processes
9
10 ;; This file is part of GNU Emacs.
11
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.
16
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.
21
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.
26
27 ;;; Commentary:
28
29 ;; This file implements a debugging toolbar for IDLWAVE. It requires
30 ;; Emacs or XEmacs with toolbar and xpm support.
31
32 ;; New versions of IDLWAVE, documentation, and more information
33 ;; available from:
34 ;; http://idlwave.org
35
36 \f
37 ;;; Code:
38
39 (eval-when-compile (require 'cl))
40
41 (defun idlwave-toolbar-make-button (image)
42 (if (featurep 'xemacs)
43 (toolbar-make-button-list image)
44 (list 'image :type 'xpm :data image)))
45
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
54 ))
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
58
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
63 "/* XPM */
64 static char * file[] = {
65 \"28 28 2 1\",
66 \" c None s backgroundToolBarColor\",
67 \". c #000000000000\",
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 \" \",
93 \" \",
94 \" \",
95 \" \"};")
96 "The compile icon.")
97
98 (defvar idlwave-toolbar-next-error-icon
99 (idlwave-toolbar-make-button
100 "/* XPM */
101 static char * file[] = {
102 \"28 28 3 1\",
103 \" c None s backgroundToolBarColor\",
104 \". c #000000000000\",
105 \"R c #FFFF00000000\",
106 \" \",
107 \" \",
108 \" R \",
109 \" RR RRR RR \",
110 \" RRRR RRR RRRR \",
111 \" RRRRRRRRRRRRR \",
112 \" RRRRRRRRRRR \",
113 \" RRRRRRRRRRRRRRRRRRR \",
114 \" RRRRRRRR \",
115 \" RRRRR \",
116 \" RRRR \",
117 \" ........ \",
118 \" ........ \",
119 \" ......... \",
120 \" ..... .. ... ..... \",
121 \" ...... .. .. ...... \",
122 \" ..... ... .. ..... \",
123 \" ......... .... \",
124 \" ........ ..... \",
125 \" ........ ........ \",
126 \" ................... \",
127 \" ........... \",
128 \" ............. \",
129 \" .... ... .... \",
130 \" .. ... .. \",
131 \" . \",
132 \" \",
133 \" \"};")
134 "The Next Error icon.")
135
136 (defvar idlwave-toolbar-stop-at-icon
137 (idlwave-toolbar-make-button
138 "/* XPM */
139 static char * file[] = {
140 \"28 28 3 1\",
141 \" c None s backgroundToolBarColor\",
142 \". c #000000000000\",
143 \"R c #FFFF00000000\",
144 \" \",
145 \" \",
146 \" \",
147 \" \",
148 \" ........ \",
149 \" .RRRRRRRR. \",
150 \" .RRRRRRRRRR. \",
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. \",
165 \" .RRRRRRRRRR. \",
166 \" .RRRRRRRR. \",
167 \" ........ \",
168 \" \",
169 \" \",
170 \" \",
171 \" \"};")
172 "The Stop At icon.")
173
174 (defvar idlwave-toolbar-stop-in-icon
175 (idlwave-toolbar-make-button
176 "/* XPM */
177 static char * file[] = {
178 \"28 28 4 1\",
179 \" c None s backgroundToolBarColor\",
180 \"_ c #FFFFFFFFFFFF\",
181 \". c #000000000000\",
182 \"R c #FFFF00000000\",
183 \" \",
184 \" \",
185 \" \",
186 \" \",
187 \" ........ \",
188 \" .RRRRRRRR. \",
189 \" .RRRRRRRRRR. \",
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. \",
204 \" .RRRRRRRRRR. \",
205 \" .RRRRRRRR. \",
206 \" ........ \",
207 \" \",
208 \" \",
209 \" \",
210 \" \"};")
211 "The Stop in icon.")
212
213
214 (defvar idlwave-toolbar-clear-at-icon
215 (idlwave-toolbar-make-button
216 "/* XPM */
217 static char * file[] = {
218 \"28 28 3 1\",
219 \" c None s backgroundToolBarColor\",
220 \". c #000000000000\",
221 \"R c #FFFF00000000\",
222 \" \",
223 \" \",
224 \" \",
225 \" ... ... \",
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 \" ... ........ ... \",
246 \" ... ... \",
247 \" \",
248 \" \",
249 \" \"};")
250 "The Clear At icon.")
251
252 (defvar idlwave-toolbar-clear-all-icon
253 (idlwave-toolbar-make-button
254 "/* XPM */
255 static char * file[] = {
256 \"28 28 4 1\",
257 \" c None s backgroundToolBarColor\",
258 \". c #000000000000\",
259 \"X c #FFFFFFFFFFFF\",
260 \"R c #FFFF00000000\",
261 \" \",
262 \" \",
263 \" \",
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 \" .... ... ... .... \",
274 \" ..... \",
275 \" ... \",
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 \" ....... ....... \",
286 \" \",
287 \" \",
288 \" \"};")
289 "The Clear-All icon.")
290
291 (defvar idlwave-toolbar-edit-cmd-icon
292 (idlwave-toolbar-make-button
293 "/* XPM */
294 static char * file[] = {
295 \"28 28 2 1\",
296 \" c None s backgroundToolBarColor\",
297 \". c #000000000000\",
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 \" \",
323 \" \",
324 \" \",
325 \" \"};")
326 "The edit-cmd icon")
327
328 (defvar idlwave-toolbar-run-icon
329 (idlwave-toolbar-make-button
330 "/* XPM */
331 static char * file[] = {
332 \"28 28 3 1\",
333 \" c None s backgroundToolBarColor\",
334 \". s FgColor c #000000000000\",
335 \"G c #0000BBBB0000\",
336 \" \",
337 \" \",
338 \" \",
339 \" \",
340 \" ..... \",
341 \" .GGG. \",
342 \" .GGG. \",
343 \" .GGG. ....... \",
344 \" .GGG. \",
345 \" .GGG. \",
346 \" .GGG. ....... \",
347 \" .GGG. \",
348 \" ....GGG.... \",
349 \" .GGGGGGG. ....... \",
350 \" .GGGGG. \",
351 \" .GGG. \",
352 \" .G. ....... \",
353 \" . \",
354 \" \",
355 \" ....... \",
356 \" \",
357 \" \",
358 \" ....... \",
359 \" \",
360 \" \",
361 \" \",
362 \" \",
363 \" \"};")
364 "The Run icon.")
365
366 (defvar idlwave-toolbar-cont-icon
367 (idlwave-toolbar-make-button
368 "/* XPM */
369 static char * file[] = {
370 \"28 28 3 1\",
371 \" c None s backgroundToolBarColor\",
372 \". s FgColor c #000000000000\",
373 \"G c #0000BBBB0000\",
374 \" \",
375 \" \",
376 \" \",
377 \" ....... \",
378 \" \",
379 \" ....... \",
380 \" .GGGGGG. ....... \",
381 \" .GGGGGGG. \",
382 \" .GGG..... \",
383 \" .GGG. ....... \",
384 \" .GGG. \",
385 \" .GGG. \",
386 \" .GGG. ....... \",
387 \" .GGG. \",
388 \" ....GGG.... \",
389 \" .GGGGGGG. ....... \",
390 \" .GGGGG. \",
391 \" .GGG. \",
392 \" .G. ....... \",
393 \" . \",
394 \" \",
395 \" ....... \",
396 \" \",
397 \" \",
398 \" \",
399 \" \",
400 \" \",
401 \" \"};")
402 "The Cont icon.")
403
404 (defvar idlwave-toolbar-to-here-icon
405 (idlwave-toolbar-make-button
406 "/* XPM */
407 static char * file[] = {
408 \"28 28 4 1\",
409 \" c None s backgroundToolBarColor\",
410 \". c #000000000000\",
411 \"G c #0000BBBB0000\",
412 \"R c #FFFF00000000\",
413 \" \",
414 \" \",
415 \" \",
416 \" \",
417 \" \",
418 \" \",
419 \" ..... ........ \",
420 \" .GGGG. \",
421 \" .GGGGG. \",
422 \" .GG.... ........ \",
423 \" .GG. \",
424 \" .GG. . \",
425 \" .GG. .. \",
426 \" .GG. .G. ...... \",
427 \" .GG...GG. \",
428 \" .GGGGGGGG. RRRRRR \",
429 \" .GGGGGGGGG. RRRRRR \",
430 \" .GGGGGGG. RRRRRR \",
431 \" ....GG. \",
432 \" .G. ...... \",
433 \" .. \",
434 \" . \",
435 \" \",
436 \" \",
437 \" \",
438 \" \",
439 \" \",
440 \" \"};")
441 "The Cont-to-here icon.")
442
443 (defvar idlwave-toolbar-step-over-icon
444 (idlwave-toolbar-make-button
445 "/* XPM */
446 static char * file[] = {
447 \"28 28 3 1\",
448 \" c None s backgroundToolBarColor\",
449 \". c #000000000000\",
450 \"G c #0000BBBB0000\",
451 \" \",
452 \" \",
453 \" \",
454 \" \",
455 \" \",
456 \" \",
457 \" ..... \",
458 \" .GGGG. ....... \",
459 \" .GGGGG. \",
460 \" .GG.... \",
461 \" .GG. ....... \",
462 \" .GG. . \",
463 \" .GG. .. \",
464 \" .GG. .G. ....... \",
465 \" .GG...GG. \",
466 \" .GGGGGGGG. \",
467 \" .GGGGGGGGG. ....... \",
468 \" .GGGGGGG. \",
469 \" ....GG. \",
470 \" .G. ....... \",
471 \" .. \",
472 \" . \",
473 \" ....... \",
474 \" \",
475 \" \",
476 \" \",
477 \" \",
478 \" \"};")
479 "The Step Over icon.")
480
481 (defvar idlwave-toolbar-step-into-icon
482 (idlwave-toolbar-make-button
483 "/* XPM */
484 static char * file[] = {
485 \"28 28 3 1\",
486 \" c None s backgroundToolBarColor\",
487 \". c #000000000000\",
488 \"G c #0000BBBB0000\",
489 \" \",
490 \" \",
491 \" \",
492 \" \",
493 \" \",
494 \" \",
495 \" ..... ....... \",
496 \" .GGGG. \",
497 \" .GGGGG. \",
498 \" .GG.... ........ \",
499 \" .GG. \",
500 \" .GG. . \",
501 \" .GG. .. \",
502 \" .GG. .G. \",
503 \" .GG...GG. ....... \",
504 \" .GGGGGGGG. \",
505 \" .GGGGGGGGG. \",
506 \" .GGGGGGG. ....... \",
507 \" ....GG. \",
508 \" .G. \",
509 \" .. ....... \",
510 \" . \",
511 \" \",
512 \" \",
513 \" \",
514 \" \",
515 \" \",
516 \" \"};")
517 "The Step Into icon.")
518
519 (defvar idlwave-toolbar-step-out-icon
520 (idlwave-toolbar-make-button
521 "/* XPM */
522 static char * file[] = {
523 \"28 28 3 1\",
524 \" c None s backgroundToolBarColor\",
525 \". c #000000000000\",
526 \"G c #0000BBBB0000\",
527 \" \",
528 \" \",
529 \" \",
530 \" \",
531 \" \",
532 \" \",
533 \" . \",
534 \" .. ........ \",
535 \" .G. \",
536 \" ....GG. \",
537 \" .GGGGGGG. ........ \",
538 \" .GGGGGGGGG. \",
539 \" .GGGGGGGG. \",
540 \" .GG...GG. ........ \",
541 \" .GG. .G. \",
542 \" .GG. .. \",
543 \" .GG. . \",
544 \" .GG. \",
545 \" .GG....... ....... \",
546 \" .GGGGGGGG. \",
547 \" .GGGGGGG. \",
548 \" ........ ....... \",
549 \" \",
550 \" \",
551 \" \",
552 \" \",
553 \" \",
554 \" \"};")
555 "The Step up icon.")
556
557
558 (defvar idlwave-toolbar-eval-icon
559 (idlwave-toolbar-make-button
560 "/* XPM */
561 static char * file[] = {
562 \"28 28 2 1\",
563 \" c None s backgroundToolBarColor\",
564 \". c #000000000000\",
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 \" \",
590 \" \",
591 \" \",
592 \" \"};")
593 "The Evaluate icon.")
594
595 (defvar idlwave-toolbar-stack-up-icon
596 (idlwave-toolbar-make-button
597 "/* XPM */
598 static char * file[] = {
599 \"28 28 5 1\",
600 \" c None s backgroundToolBarColor\",
601 \". s FgColor c #000000000000\",
602 \"_ c #FFFFFFFFFFFF\",
603 \"G c #0000BBBB0000\",
604 \"R c #FFFF00000000\",
605 \" \",
606 \" \",
607 \" \",
608 \" \",
609 \" \",
610 \" ........ . \",
611 \" .______. ... \",
612 \" .______. ..... \",
613 \" .______. ....... \",
614 \" .______. ... \",
615 \" .______. ... \",
616 \" ........ ... \",
617 \" .GGGGGG. ... \",
618 \" .GGGGGG. ... \",
619 \" .GGGGGG. \",
620 \" .GGGGGG. \",
621 \" .GGGGGG. \",
622 \" ........ \",
623 \" .RRRRRR. \",
624 \" .RRRRRR. \",
625 \" .RRRRRR. \",
626 \" .RRRRRR. \",
627 \" .RRRRRR. \",
628 \" ........ \",
629 \" \",
630 \" \",
631 \" \",
632 \" \"};")
633 "The Stack Up icon.")
634
635 (defvar idlwave-toolbar-stack-down-icon
636 (idlwave-toolbar-make-button
637 "/* XPM */
638 static char * file[] = {
639 \"28 28 5 1\",
640 \" c None s backgroundToolBarColor\",
641 \". s FgColor c #000000000000\",
642 \"_ c #FFFFFFFFFFFF\",
643 \"G c #0000BBBB0000\",
644 \"R c #FFFF00000000\",
645 \" \",
646 \" \",
647 \" \",
648 \" \",
649 \" \",
650 \" ........ \",
651 \" .______. \",
652 \" .______. \",
653 \" .______. \",
654 \" .______. \",
655 \" .______. \",
656 \" ........ \",
657 \" .GGGGGG. \",
658 \" .GGGGGG. \",
659 \" .GGGGGG. \",
660 \" .GGGGGG. ... \",
661 \" .GGGGGG. ... \",
662 \" ........ ... \",
663 \" .RRRRRR. ... \",
664 \" .RRRRRR. ... \",
665 \" .RRRRRR. ....... \",
666 \" .RRRRRR. ..... \",
667 \" .RRRRRR. ... \",
668 \" ........ . \",
669 \" \",
670 \" \",
671 \" \",
672 \" \"};")
673 "The Stack Down icon.")
674
675 (defvar idlwave-toolbar-reset-icon
676 (idlwave-toolbar-make-button
677 "/* XPM */
678 static char * file[] = {
679 \"28 28 3 1\",
680 \" c None s backgroundToolBarColor\",
681 \"G c #0000BBBB0000\",
682 \". c #000000000000\",
683 \" \",
684 \" \",
685 \" \",
686 \" . \",
687 \" .G. . \",
688 \" .GGG.. .G. \",
689 \" .GGGGG..GG. \",
690 \" ..GGGGGGGG. \",
691 \" ..GGGGGG. \",
692 \" ..GGGGG. \",
693 \" .GGGGGG. \",
694 \" .G...... \",
695 \" \",
696 \" ..... \",
697 \" ......... \",
698 \" ......... \",
699 \" ......... \",
700 \" . ..... . \",
701 \" . . \",
702 \" . . \",
703 \" . . \",
704 \" . . \",
705 \" . . \",
706 \" .. .. \",
707 \" ....... \",
708 \" ..... \",
709 \" \",
710 \" \"};")
711 "The Reset icon.")
712
713 (defvar idlwave-toolbar
714 '(
715 [idlwave-toolbar-compile-icon
716 idlwave-shell-save-and-compile
717 t
718 "Save and Compile this file (or recompile last)"]
719 [idlwave-toolbar-next-error-icon
720 idlwave-shell-goto-next-error
721 t
722 "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
729 t
730 "Stop in Function with name near at point"]
731 [idlwave-toolbar-clear-at-icon
732 idlwave-shell-clear-current-bp
733 t
734 "Clear Breakpoint at selected position"]
735 [idlwave-toolbar-clear-all-icon
736 idlwave-shell-clear-all-bp
737 t
738 "Clear all Breakpoints"]
739 [idlwave-toolbar-edit-cmd-icon
740 idlwave-shell-edit-default-command-line
741 t
742 "Edit Default Command Line"]
743 [idlwave-toolbar-run-icon
744 idlwave-shell-execute-default-command-line
745 t
746 "Reset, then Execute Default Command Line"]
747 [idlwave-toolbar-cont-icon
748 idlwave-shell-cont
749 t
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
757 t
758 "Step Over (aka next)"]
759 [idlwave-toolbar-step-into-icon
760 idlwave-shell-step
761 t
762 "Step Into (aka step)"]
763 [idlwave-toolbar-step-out-icon
764 idlwave-shell-out
765 t
766 "Step Out (of subroutine)"]
767 [idlwave-toolbar-eval-icon
768 idlwave-shell-print
769 t
770 "Print Expression at or before Point"]
771 [idlwave-toolbar-stack-up-icon
772 idlwave-shell-stack-up
773 t
774 "Stack Up (towards \"cooler\" - less recently visited - frames)"]
775 [idlwave-toolbar-stack-down-icon
776 idlwave-shell-stack-down
777 t
778 "Stack Down (towards \"warmer\" - more recently visited - frames)"]
779 [idlwave-toolbar-reset-icon
780 idlwave-shell-reset
781 t
782 "Reset IDL (RETALL & CLOSE,/ALL and more)"]
783 ))
784
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
789
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)
797 idlwave-toolbar))))
798
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))))
806
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)
813
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
819 (save-excursion
820 (mapcar (lambda (buf)
821 (set-buffer buf)
822 (idlwave-toolbar-add))
823 (buffer-list)))
824 ;; For Emacs, add the key definitions to the mode maps
825 (mapcar (lambda (x)
826 (let* ((icon (aref x 0))
827 (func (aref x 1))
828 ;;(show (aref x 2))
829 (help (aref x 3))
830 (key (vector 'tool-bar func))
831 (def (list 'menu-item
832 "a"
833 func
834 :image (symbol-value icon)
835 :help help)))
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)))
840
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
849 (save-excursion
850 (mapcar (lambda (buf)
851 (set-buffer buf)
852 (idlwave-toolbar-remove))
853 (buffer-list)))
854 ;; For Emacs, remove the key definitions from the mode maps
855 (mapcar (lambda (x)
856 (let* (;;(icon (aref x 0))
857 (func (aref x 1))
858 ;;(show (aref x 2))
859 ;;(help (aref x 3))
860 (key (vector 'tool-bar func)))
861 (define-key idlwave-mode-map key nil)
862 (define-key idlwave-shell-mode-map key nil)))
863 idlwave-toolbar))
864 (setq idlwave-toolbar-visible nil)))
865
866 (defun idlwave-toolbar-toggle (&optional force-on)
867 (interactive)
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))))
876
877 (provide 'idlw-toolbar)
878 (provide 'idlwave-toolbar)
879
880 ;;; idlw-toolbar.el ends here
881
882
883 ;;; arch-tag: ec9a3717-c44c-4716-9bda-cdacbe5ddb62