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