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