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