Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[bpt/emacs.git] / lisp / progmodes / idlw-toolbar.el
CommitLineData
e8af40ee 1;;; idlw-toolbar.el --- a debugging toolbar for IDLWAVE
d7a0267c 2
ab422c4d 3;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
8c7b4ec8 4
5e72c6b2
S
5;; Author: Carsten Dominik <dominik@astro.uva.nl>
6;; Maintainer: J.D. Smith <jdsmith@as.arizona.edu>
bd78fa1d 7;; Version: 6.1.22
8c7b4ec8 8;; Keywords: processes
aad4679e 9;; Package: idlwave
8c7b4ec8
EZ
10
11;; This file is part of GNU Emacs.
12
b1fc2b50 13;; GNU Emacs is free software: you can redistribute it and/or modify
8c7b4ec8 14;; it under the terms of the GNU General Public License as published by
b1fc2b50
GM
15;; the Free Software Foundation, either version 3 of the License, or
16;; (at your option) any later version.
8c7b4ec8
EZ
17
18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details.
22
23;; You should have received a copy of the GNU General Public License
b1fc2b50 24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
8c7b4ec8
EZ
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
5e72c6b2
S
31;; New versions of IDLWAVE, documentation, and more information
32;; available from:
33;; http://idlwave.org
34
8c7b4ec8
EZ
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
c56509c0 45(defvar idlwave-toolbar)
8e0b12d3 46(defvar default-toolbar)
c56509c0
RS
47(defvar idlwave-toolbar-is-possible)
48
8c7b4ec8
EZ
49(if (not (or (and (featurep 'xemacs) ; This is XEmacs
50 (featurep 'xpm) ; need xpm
51 (featurep 'toolbar)) ; ... and the toolbar
52 (and (not (featurep 'xemacs)) ; This is Emacs
8124289f 53 (boundp 'tool-bar-button-margin) ; need toolbar
8c7b4ec8
EZ
54 (fboundp 'image-type-available-p) ; need image stuff
55 (image-type-available-p 'xpm)) ; need xpm
56 ))
57 ;; oops - cannot do the toolbar
58 (message "Sorry, IDLWAVE xpm toolbar cannot be used on this version of Emacs")
59;; OK, we can define a toolbar
60
8124289f
CD
61(defconst idlwave-toolbar-is-possible t
62 "When defined, indicates that a toolbar is possible with this Emacs.")
8c7b4ec8
EZ
63(defvar idlwave-toolbar-compile-icon
64 (idlwave-toolbar-make-button
65 "/* XPM */
66static char * file[] = {
67\"28 28 2 1\",
5e72c6b2 68\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
69\". c #000000000000\",
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\" \",
97\" \"};")
98 "The compile icon.")
99
100(defvar idlwave-toolbar-next-error-icon
101 (idlwave-toolbar-make-button
102 "/* XPM */
103static char * file[] = {
104\"28 28 3 1\",
5e72c6b2 105\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
106\". c #000000000000\",
107\"R c #FFFF00000000\",
108\" \",
109\" \",
110\" R \",
111\" RR RRR RR \",
112\" RRRR RRR RRRR \",
113\" RRRRRRRRRRRRR \",
114\" RRRRRRRRRRR \",
115\" RRRRRRRRRRRRRRRRRRR \",
116\" RRRRRRRR \",
117\" RRRRR \",
118\" RRRR \",
119\" ........ \",
120\" ........ \",
121\" ......... \",
122\" ..... .. ... ..... \",
123\" ...... .. .. ...... \",
124\" ..... ... .. ..... \",
125\" ......... .... \",
126\" ........ ..... \",
127\" ........ ........ \",
128\" ................... \",
129\" ........... \",
130\" ............. \",
131\" .... ... .... \",
132\" .. ... .. \",
133\" . \",
134\" \",
135\" \"};")
136 "The Next Error icon.")
137
138(defvar idlwave-toolbar-stop-at-icon
139 (idlwave-toolbar-make-button
140 "/* XPM */
141static char * file[] = {
142\"28 28 3 1\",
5e72c6b2 143\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
144\". c #000000000000\",
145\"R c #FFFF00000000\",
146\" \",
147\" \",
148\" \",
149\" \",
150\" ........ \",
151\" .RRRRRRRR. \",
152\" .RRRRRRRRRR. \",
153\" .RRRRRRRRRRRR. \",
154\" .RRRRRRRRRRRRRR. \",
155\" .RRRRRRRRRRRRRRRR. \",
156\" .RRRRRRRRRRRRRRRRRR. \",
157\" .RRRRRRRRRRRRRRRRRR. \",
158\" .RRRRRRRRRRRRRRRRRR. \",
159\" .RRRRRRRRRRRRRRRRRR. \",
160\" .RRRRRRRRRRRRRRRRRR. \",
161\" .RRRRRRRRRRRRRRRRRR. \",
162\" .RRRRRRRRRRRRRRRRRR. \",
163\" .RRRRRRRRRRRRRRRRRR. \",
164\" .RRRRRRRRRRRRRRRR. \",
165\" .RRRRRRRRRRRRRR. \",
166\" .RRRRRRRRRRRR. \",
167\" .RRRRRRRRRR. \",
168\" .RRRRRRRR. \",
169\" ........ \",
170\" \",
171\" \",
172\" \",
173\" \"};")
174 "The Stop At icon.")
175
8c7b4ec8
EZ
176
177(defvar idlwave-toolbar-clear-at-icon
178 (idlwave-toolbar-make-button
179 "/* XPM */
180static char * file[] = {
181\"28 28 3 1\",
5e72c6b2 182\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
183\". c #000000000000\",
184\"R c #FFFF00000000\",
185\" \",
186\" \",
187\" \",
188\" ... ... \",
189\" ... ........ ... \",
190\" ... .RRRRRRRR. ... \",
191\" ....RRRRRRRRRR.... \",
192\" ...RRRRRRRRRR... \",
193\" ....RRRRRRRR.... \",
194\" .RR...RRRRRR...RR. \",
195\" .RRRR...RRRR...RRRR. \",
196\" .RRRRR...RR...RRRRR. \",
197\" .RRRRRR......RRRRRR. \",
198\" .RRRRRRR....RRRRRRR. \",
199\" .RRRRRRR....RRRRRRR. \",
200\" .RRRRRR......RRRRRR. \",
201\" .RRRRR...RR...RRRRR. \",
202\" .RRRR...RRRR...RRRR. \",
203\" .RR...RRRRRR...RR. \",
204\" ....RRRRRRRR.... \",
205\" ...RRRRRRRRRR... \",
206\" ....RRRRRRRRRR.... \",
207\" ... .RRRRRRRR. ... \",
208\" ... ........ ... \",
209\" ... ... \",
210\" \",
211\" \",
212\" \"};")
213 "The Clear At icon.")
214
215(defvar idlwave-toolbar-clear-all-icon
216 (idlwave-toolbar-make-button
217 "/* XPM */
218static char * file[] = {
219\"28 28 4 1\",
5e72c6b2 220\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
221\". c #000000000000\",
222\"X c #FFFFFFFFFFFF\",
223\"R c #FFFF00000000\",
224\" \",
225\" \",
226\" \",
227\" .. .... .... .. \",
228\" ...RRRR. .RRRR... \",
229\" ...RRRR. .RRRR... \",
230\" .R...RRRR. .RRRR...R. \",
231\" .RR...RRR. .RRR...RR. \",
232\" .RRR...RR. .RR...RRR. \",
233\" .RRRR...R. .R...RRRR. \",
234\" .RRRR... ...RRRR. \",
235\" .RRRR... ...RRRR. \",
236\" .... ... ... .... \",
237\" ..... \",
238\" ... \",
239\" .... ..... .... \",
240\" .RRRR.... ....RRRR. \",
241\" .RRRRR... ...RRRRR. \",
242\" .RRRRR.... ....RRRRR. \",
243\" .RRRR...R. .R...RRRR. \",
244\" .RRR...RR. .RR...RRR. \",
245\" .RR...RRR. .RRR...RR. \",
246\" ....RRR. .RRR.... \",
247\" ...RRR. .RRR... \",
248\" ....... ....... \",
249\" \",
250\" \",
251\" \"};")
252 "The Clear-All icon.")
253
52a244eb
S
254(defvar idlwave-toolbar-stop-beginning-icon
255 (idlwave-toolbar-make-button
256 "/* XPM */
257static char * file[] = {
258\"28 28 4 1\",
259\" c None s backgroundToolBarColor\",
260\". c #000000000000\",
261\"X c #FFFF00000000\",
262\"_ c #FFFFFFFFFFFF\",
263\" \",
264\" \",
265\" \",
266\" \",
267\" ........ \",
268\" .XXXXXXXX. \",
269\" .XXXXXXXXXX. \",
270\" .XXXXXXXXXXXX. \",
271\" .XX..XXXXXXXXXX. \",
272\" .XX.XX.X______XXX. \",
273\" .XXX.XX.X______XXXX. \",
274\" .XXXX..XXXXXXXXXXXX. \",
275\" .XXXXXXXXXX____XXXX. \",
276\" .XXXXXXXXXX____XXXX. \",
277\" .XXXXXXXXXXXXXXXXXX. \",
278\" .XXXXXXXXXX____XXXX. \",
279\" .XXXXXXXXXX____XXXX. \",
280\" .XXXXXXXXXXXXXXXXXX. \",
281\" .XXXXXXXXX____XXX. \",
282\" .XXXXXXXX____XX. \",
283\" .XXXXXXXXXXXX. \",
284\" .XXXXXXXXXX. \",
285\" .XXXXXXXX. \",
286\" ........ \",
287\" \",
288\" \",
289\" \",
290\" \"};")
291 "The Stop at Beginning icon.")
292
293(defvar idlwave-toolbar-stop-in-icon
294 (idlwave-toolbar-make-button
295 "/* XPM */
296static char * file[] = {
297\"28 28 4 1\",
298\" c None s backgroundToolBarColor\",
299\"_ c #FFFFFFFFFFFF\",
300\". c #000000000000\",
301\"R c #FFFF00000000\",
302\" \",
303\" \",
304\" \",
305\" \",
306\" ........ \",
307\" .RRRRRRRR. \",
308\" .RRRRRRRRRR. \",
309\" .RRRRRRRRRRRR. \",
310\" .RRR___RR___RRR. \",
311\" .RRRR__RRRR__RRRR. \",
312\" .RRRRR__RRRR__RRRRR. \",
313\" .RRRRR__RRRR__RRRRR. \",
314\" .RRRRR__RRRR__RRRRR. \",
315\" .RRRR__RRRRRR__RRRR. \",
316\" .RRRRR__RRRR__RRRRR. \",
317\" .RRRRR__RRRR__RRRRR. \",
318\" .RRRRR__RRRR__RRRRR. \",
319\" .RRRRR__RRRR__RRRRR. \",
320\" .RRRR___RR___RRRR. \",
321\" .RRRRRRRRRRRRRR. \",
322\" .RRRRRRRRRRRR. \",
323\" .RRRRRRRRRR. \",
324\" .RRRRRRRR. \",
325\" ........ \",
326\" \",
327\" \",
328\" \",
329\" \"};")
330 "The Stop in icon.")
331
8c7b4ec8
EZ
332(defvar idlwave-toolbar-edit-cmd-icon
333 (idlwave-toolbar-make-button
334 "/* XPM */
335static char * file[] = {
336\"28 28 2 1\",
5e72c6b2 337\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
338\". c #000000000000\",
339\" \",
340\" \",
341\" \",
342\" \",
343\" \",
344\" \",
345\" \",
346\" \",
347\" \",
348\" \",
349\" \",
350\" .. \",
351\" .. \",
352\" .. \",
353\" .. \",
354\" .. \",
355\" \",
356\" \",
357\" ................. \",
358\" \",
359\" \",
360\" \",
361\" \",
362\" \",
363\" \",
364\" \",
365\" \",
366\" \"};")
367 "The edit-cmd icon")
368
369(defvar idlwave-toolbar-run-icon
370 (idlwave-toolbar-make-button
371 "/* XPM */
372static char * file[] = {
373\"28 28 3 1\",
5e72c6b2 374\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
375\". s FgColor c #000000000000\",
376\"G c #0000BBBB0000\",
377\" \",
378\" \",
379\" \",
380\" \",
381\" ..... \",
382\" .GGG. \",
383\" .GGG. \",
384\" .GGG. ....... \",
385\" .GGG. \",
386\" .GGG. \",
387\" .GGG. ....... \",
388\" .GGG. \",
389\" ....GGG.... \",
390\" .GGGGGGG. ....... \",
391\" .GGGGG. \",
392\" .GGG. \",
393\" .G. ....... \",
394\" . \",
395\" \",
396\" ....... \",
397\" \",
398\" \",
399\" ....... \",
400\" \",
401\" \",
402\" \",
403\" \",
404\" \"};")
405 "The Run icon.")
406
407(defvar idlwave-toolbar-cont-icon
408 (idlwave-toolbar-make-button
409 "/* XPM */
410static char * file[] = {
411\"28 28 3 1\",
5e72c6b2 412\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
413\". s FgColor c #000000000000\",
414\"G c #0000BBBB0000\",
415\" \",
416\" \",
417\" \",
418\" ....... \",
419\" \",
420\" ....... \",
421\" .GGGGGG. ....... \",
422\" .GGGGGGG. \",
423\" .GGG..... \",
424\" .GGG. ....... \",
425\" .GGG. \",
426\" .GGG. \",
427\" .GGG. ....... \",
428\" .GGG. \",
429\" ....GGG.... \",
430\" .GGGGGGG. ....... \",
431\" .GGGGG. \",
432\" .GGG. \",
433\" .G. ....... \",
434\" . \",
435\" \",
436\" ....... \",
437\" \",
438\" \",
439\" \",
440\" \",
441\" \",
442\" \"};")
52a244eb 443 "The Cont icon.")
8c7b4ec8
EZ
444
445(defvar idlwave-toolbar-to-here-icon
446 (idlwave-toolbar-make-button
447 "/* XPM */
448static char * file[] = {
449\"28 28 4 1\",
5e72c6b2 450\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
451\". c #000000000000\",
452\"G c #0000BBBB0000\",
453\"R c #FFFF00000000\",
454\" \",
455\" \",
456\" \",
457\" \",
458\" \",
459\" \",
460\" ..... ........ \",
461\" .GGGG. \",
462\" .GGGGG. \",
463\" .GG.... ........ \",
464\" .GG. \",
465\" .GG. . \",
466\" .GG. .. \",
467\" .GG. .G. ...... \",
468\" .GG...GG. \",
469\" .GGGGGGGG. RRRRRR \",
470\" .GGGGGGGGG. RRRRRR \",
471\" .GGGGGGG. RRRRRR \",
472\" ....GG. \",
473\" .G. ...... \",
474\" .. \",
475\" . \",
476\" \",
477\" \",
478\" \",
479\" \",
480\" \",
481\" \"};")
482 "The Cont-to-here icon.")
483
484(defvar idlwave-toolbar-step-over-icon
485 (idlwave-toolbar-make-button
486 "/* XPM */
487static char * file[] = {
488\"28 28 3 1\",
5e72c6b2 489\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
490\". c #000000000000\",
491\"G c #0000BBBB0000\",
492\" \",
493\" \",
494\" \",
495\" \",
496\" \",
497\" \",
498\" ..... \",
499\" .GGGG. ....... \",
500\" .GGGGG. \",
501\" .GG.... \",
502\" .GG. ....... \",
503\" .GG. . \",
504\" .GG. .. \",
505\" .GG. .G. ....... \",
506\" .GG...GG. \",
507\" .GGGGGGGG. \",
508\" .GGGGGGGGG. ....... \",
509\" .GGGGGGG. \",
510\" ....GG. \",
511\" .G. ....... \",
512\" .. \",
513\" . \",
514\" ....... \",
515\" \",
516\" \",
517\" \",
518\" \",
519\" \"};")
520 "The Step Over icon.")
521
522(defvar idlwave-toolbar-step-into-icon
523 (idlwave-toolbar-make-button
524 "/* XPM */
525static char * file[] = {
526\"28 28 3 1\",
5e72c6b2 527\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
528\". c #000000000000\",
529\"G c #0000BBBB0000\",
530\" \",
531\" \",
532\" \",
533\" \",
534\" \",
535\" \",
536\" ..... ....... \",
537\" .GGGG. \",
538\" .GGGGG. \",
539\" .GG.... ........ \",
540\" .GG. \",
541\" .GG. . \",
542\" .GG. .. \",
543\" .GG. .G. \",
544\" .GG...GG. ....... \",
545\" .GGGGGGGG. \",
546\" .GGGGGGGGG. \",
547\" .GGGGGGG. ....... \",
548\" ....GG. \",
549\" .G. \",
550\" .. ....... \",
551\" . \",
552\" \",
553\" \",
554\" \",
555\" \",
556\" \",
557\" \"};")
558 "The Step Into icon.")
559
560(defvar idlwave-toolbar-step-out-icon
561 (idlwave-toolbar-make-button
562 "/* XPM */
563static char * file[] = {
564\"28 28 3 1\",
5e72c6b2 565\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
566\". c #000000000000\",
567\"G c #0000BBBB0000\",
568\" \",
569\" \",
570\" \",
571\" \",
572\" \",
573\" \",
574\" . \",
575\" .. ........ \",
576\" .G. \",
577\" ....GG. \",
578\" .GGGGGGG. ........ \",
579\" .GGGGGGGGG. \",
580\" .GGGGGGGG. \",
581\" .GG...GG. ........ \",
582\" .GG. .G. \",
583\" .GG. .. \",
584\" .GG. . \",
585\" .GG. \",
586\" .GG....... ....... \",
587\" .GGGGGGGG. \",
588\" .GGGGGGG. \",
589\" ........ ....... \",
590\" \",
591\" \",
592\" \",
593\" \",
594\" \",
595\" \"};")
596 "The Step up icon.")
597
598
599(defvar idlwave-toolbar-eval-icon
600 (idlwave-toolbar-make-button
601 "/* XPM */
602static char * file[] = {
603\"28 28 2 1\",
5e72c6b2 604\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
605\". c #000000000000\",
606\" \",
607\" \",
608\" \",
609\" \",
610\" \",
611\" \",
612\" \",
613\" \",
614\" \",
615\" \",
616\" \",
617\" .... \",
618\" .. .. ...... \",
619\" .. .. ...... \",
620\" .. .. \",
621\" .. .. ...... \",
622\" .. .. ...... \",
623\" .... \",
624\" .. \",
625\" .. \",
626\" \",
627\" \",
628\" \",
629\" \",
630\" \",
631\" \",
632\" \",
633\" \"};")
634 "The Evaluate icon.")
635
636(defvar idlwave-toolbar-stack-up-icon
637 (idlwave-toolbar-make-button
638 "/* XPM */
639static char * file[] = {
640\"28 28 5 1\",
5e72c6b2 641\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
642\". s FgColor c #000000000000\",
643\"_ c #FFFFFFFFFFFF\",
644\"G c #0000BBBB0000\",
645\"R c #FFFF00000000\",
646\" \",
647\" \",
648\" \",
649\" \",
650\" \",
651\" ........ . \",
652\" .______. ... \",
653\" .______. ..... \",
654\" .______. ....... \",
655\" .______. ... \",
656\" .______. ... \",
657\" ........ ... \",
658\" .GGGGGG. ... \",
659\" .GGGGGG. ... \",
660\" .GGGGGG. \",
661\" .GGGGGG. \",
662\" .GGGGGG. \",
663\" ........ \",
664\" .RRRRRR. \",
665\" .RRRRRR. \",
666\" .RRRRRR. \",
667\" .RRRRRR. \",
668\" .RRRRRR. \",
669\" ........ \",
670\" \",
671\" \",
672\" \",
673\" \"};")
674 "The Stack Up icon.")
675
676(defvar idlwave-toolbar-stack-down-icon
677 (idlwave-toolbar-make-button
678 "/* XPM */
679static char * file[] = {
680\"28 28 5 1\",
5e72c6b2 681\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
682\". s FgColor c #000000000000\",
683\"_ c #FFFFFFFFFFFF\",
684\"G c #0000BBBB0000\",
685\"R c #FFFF00000000\",
686\" \",
687\" \",
688\" \",
689\" \",
690\" \",
691\" ........ \",
692\" .______. \",
693\" .______. \",
694\" .______. \",
695\" .______. \",
696\" .______. \",
697\" ........ \",
698\" .GGGGGG. \",
699\" .GGGGGG. \",
700\" .GGGGGG. \",
701\" .GGGGGG. ... \",
702\" .GGGGGG. ... \",
703\" ........ ... \",
704\" .RRRRRR. ... \",
705\" .RRRRRR. ... \",
706\" .RRRRRR. ....... \",
707\" .RRRRRR. ..... \",
708\" .RRRRRR. ... \",
709\" ........ . \",
710\" \",
711\" \",
712\" \",
713\" \"};")
714 "The Stack Down icon.")
715
716(defvar idlwave-toolbar-reset-icon
717 (idlwave-toolbar-make-button
718 "/* XPM */
719static char * file[] = {
720\"28 28 3 1\",
5e72c6b2 721\" c None s backgroundToolBarColor\",
8c7b4ec8
EZ
722\"G c #0000BBBB0000\",
723\". c #000000000000\",
724\" \",
725\" \",
726\" \",
727\" . \",
728\" .G. . \",
729\" .GGG.. .G. \",
730\" .GGGGG..GG. \",
731\" ..GGGGGGGG. \",
732\" ..GGGGGG. \",
733\" ..GGGGG. \",
734\" .GGGGGG. \",
735\" .G...... \",
736\" \",
737\" ..... \",
738\" ......... \",
739\" ......... \",
740\" ......... \",
741\" . ..... . \",
742\" . . \",
743\" . . \",
744\" . . \",
745\" . . \",
746\" . . \",
747\" .. .. \",
748\" ....... \",
749\" ..... \",
750\" \",
751\" \"};")
752 "The Reset icon.")
753
52a244eb
S
754(defvar idlwave-toolbar-electric-debug-icon
755 (idlwave-toolbar-make-button
756 "/* XPM */
757static char * file[] = {
758\"28 28 8 1\",
759\" c None s backgroundToolBarColor\",
760\". c #CFC854\",
761\"+ c #EEDB0E\",
762\"@ c #D2C739\",
763\"# c #A39C54\",
764\"$ c #CDC020\",
765\"% c #020202\",
766\"& c #D60E36\",
767\" \",
768\" \",
769\" .. \",
770\" +++++@ \",
771\" ++++++ \",
772\" +++++@ \",
773\" +++++ \",
774\" #++++@ \",
775\" $+++@ %% %% \",
776\" ++++++$ % % \",
777\" #+++++$ % % \",
778\" #++$# %%% \",
779\" #+++ %%%%%%% \",
780\" .++ %%%%%%%%%%% \",
781\" ++$$ %%%%%%%%%%% \",
782\" .+@# &&%%%%%%%&& \",
783\" .++++# &&&&&%%%&&&&& \",
784\" +++++$ &&%%&&&&&%%&& \",
785\" $+++$ &&%%&&&&&%%&& \",
786\" $++@ &&&&&&%&&&&&& \",
787\" $+@ &&&&&&%&&&&&& \",
788\" @+ &&%%&&&&&%%&& \",
789\" ++. &%%&&%&&%%& \",
790\" +. &&&&%%%&&&& \",
791\" .+ &&%%%%%&& \",
792\" ++ %%%%%%% \",
793\" . %%% \",
794\" \"};")
795 "The electric debug icon.")
796
8c7b4ec8
EZ
797(defvar idlwave-toolbar
798 '(
799 [idlwave-toolbar-compile-icon
800 idlwave-shell-save-and-compile
801 t
802 "Save and Compile this file (or recompile last)"]
803 [idlwave-toolbar-next-error-icon
804 idlwave-shell-goto-next-error
805 t
806 "Goto Next Error"]
807 [idlwave-toolbar-stop-at-icon
808 idlwave-shell-break-here
175069ef 809 (derived-mode-p 'idlwave-mode)
8c7b4ec8 810 "Set Breakpoint at selected position"]
8c7b4ec8
EZ
811 [idlwave-toolbar-clear-at-icon
812 idlwave-shell-clear-current-bp
813 t
814 "Clear Breakpoint at selected position"]
815 [idlwave-toolbar-clear-all-icon
816 idlwave-shell-clear-all-bp
817 t
818 "Clear all Breakpoints"]
52a244eb
S
819 [idlwave-toolbar-stop-beginning-icon
820 idlwave-shell-break-this-module
175069ef 821 (derived-mode-p 'idlwave-mode)
52a244eb
S
822 "Stop at beginning of enclosing Routine"]
823 [idlwave-toolbar-stop-in-icon
824 idlwave-shell-break-in
825 t
826 "Stop in Routine with name near point"]
8c7b4ec8
EZ
827 [idlwave-toolbar-edit-cmd-icon
828 idlwave-shell-edit-default-command-line
829 t
830 "Edit Default Command Line"]
831 [idlwave-toolbar-run-icon
832 idlwave-shell-execute-default-command-line
833 t
834 "Reset, then Execute Default Command Line"]
835 [idlwave-toolbar-cont-icon
836 idlwave-shell-cont
837 t
838 "Continue Current Program"]
839 [idlwave-toolbar-to-here-icon
840 idlwave-shell-to-here
175069ef 841 (derived-mode-p 'idlwave-mode)
8c7b4ec8
EZ
842 "Continue to Here (cursor position)"]
843 [idlwave-toolbar-step-over-icon
844 idlwave-shell-stepover
845 t
846 "Step Over (aka next)"]
847 [idlwave-toolbar-step-into-icon
848 idlwave-shell-step
849 t
850 "Step Into (aka step)"]
851 [idlwave-toolbar-step-out-icon
852 idlwave-shell-out
853 t
854 "Step Out (of subroutine)"]
855 [idlwave-toolbar-eval-icon
856 idlwave-shell-print
857 t
858 "Print Expression at or before Point"]
859 [idlwave-toolbar-stack-up-icon
860 idlwave-shell-stack-up
861 t
862 "Stack Up (towards \"cooler\" - less recently visited - frames)"]
863 [idlwave-toolbar-stack-down-icon
864 idlwave-shell-stack-down
865 t
866 "Stack Down (towards \"warmer\" - more recently visited - frames)"]
867 [idlwave-toolbar-reset-icon
868 idlwave-shell-reset
869 t
870 "Reset IDL (RETALL & CLOSE,/ALL and more)"]
52a244eb
S
871 [idlwave-toolbar-electric-debug-icon
872 idlwave-shell-electric-debug-mode
175069ef 873 (derived-mode-p 'idlwave-mode)
52a244eb 874 "Toggle Electric Debug Mode"]
8c7b4ec8
EZ
875 ))
876
8124289f 877;; When the shell exits, arrange to remove the special toolbar everywhere.
8c7b4ec8
EZ
878(add-hook 'idlwave-shell-cleanup-hook
879 'idlwave-toolbar-remove-everywhere)
880);; End can define toolbar
881
882(defun idlwave-toolbar-add ()
883 "Add the IDLWAVE toolbar if appropriate."
884 (if (and (featurep 'xemacs) ; This is a noop on Emacs
8124289f 885 (boundp 'idlwave-toolbar-is-possible)
175069ef 886 (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
8c7b4ec8
EZ
887 (set-specifier default-toolbar (cons (current-buffer)
888 idlwave-toolbar))))
889
890(defun idlwave-toolbar-remove ()
891 "Add the IDLWAVE toolbar if appropriate."
892 (if (and (featurep 'xemacs) ; This is a noop on Emacs
8124289f 893 (boundp 'idlwave-toolbar-is-possible)
175069ef 894 (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
8c7b4ec8
EZ
895 (remove-specifier default-toolbar (current-buffer))))
896
897(defvar idlwave-shell-mode-map)
15e42531 898(defvar idlwave-mode-map)
8c7b4ec8
EZ
899(defvar idlwave-toolbar-visible nil)
900(defun idlwave-toolbar-add-everywhere ()
901 "Add the toolbar in all appropriate buffers."
8124289f
CD
902 (when (boundp 'idlwave-toolbar-is-possible)
903
904 ;; First make sure new buffers will get the toolbar
905 (add-hook 'idlwave-mode-hook 'idlwave-toolbar-add)
906 ;; Then add it to all existing buffers
907 (if (featurep 'xemacs)
908 ;; For XEmacs, map over all buffers to add toolbar
909 (save-excursion
910 (mapcar (lambda (buf)
911 (set-buffer buf)
912 (idlwave-toolbar-add))
913 (buffer-list)))
914 ;; For Emacs, add the key definitions to the mode maps
e430c623
GM
915 (mapc (lambda (x)
916 (let* ((icon (aref x 0))
917 (func (aref x 1))
918 (show (aref x 2))
919 (help (aref x 3))
920 (key (vector 'tool-bar func))
921 (def (list 'menu-item
922 "a"
923 func
924 :image (symbol-value icon)
925 :visible show
926 :help help)))
927 (define-key idlwave-mode-map key def)
928 (define-key idlwave-shell-mode-map key def)))
929 (reverse idlwave-toolbar)))
8124289f 930 (setq idlwave-toolbar-visible t)))
8c7b4ec8
EZ
931
932(defun idlwave-toolbar-remove-everywhere ()
933 "Remove the toolbar in all appropriate buffers."
934 ;; First make sure new buffers won't get the toolbar
8124289f
CD
935 (when idlwave-toolbar-is-possible
936 (remove-hook 'idlwave-mode-hook 'idlwave-toolbar-add)
937 ;; Then remove it in all existing buffers.
938 (if (featurep 'xemacs)
939 ;; For XEmacs, map over all buffers to remove toolbar
940 (save-excursion
941 (mapcar (lambda (buf)
942 (set-buffer buf)
943 (idlwave-toolbar-remove))
944 (buffer-list)))
945 ;; For Emacs, remove the key definitions from the mode maps
e430c623
GM
946 (mapc (lambda (x)
947 (let* (;;(icon (aref x 0))
948 (func (aref x 1))
949 ;;(show (aref x 2))
950 ;;(help (aref x 3))
951 (key (vector 'tool-bar func)))
952 (define-key idlwave-mode-map key nil)
953 (define-key idlwave-shell-mode-map key nil)))
954 idlwave-toolbar))
8124289f
CD
955 (setq idlwave-toolbar-visible nil)))
956
957(defun idlwave-toolbar-toggle (&optional force-on)
8c7b4ec8
EZ
958 (interactive)
959 (if idlwave-toolbar-visible
8124289f 960 (or force-on (idlwave-toolbar-remove-everywhere))
15e42531
CD
961 (idlwave-toolbar-add-everywhere))
962 ;; Now make sure this
963 (if (featurep 'xemacs)
964 nil ; no action necessary, toolbar gets updated automatically
965 ;; On Emacs, redraw the frame to make sure the Toolbar is updated.
966 (redraw-frame (selected-frame))))
8c7b4ec8
EZ
967
968(provide 'idlw-toolbar)
1a4bfedd 969(provide 'idlwave-toolbar)
8c7b4ec8
EZ
970
971;;; idlw-toolbar.el ends here