2 ; module illustrating how to add your own menus to gwave
5 (define-module (app gwave extra-menus)
7 :use-module (gnome gtk)
8 :use-module (app gwave cmds)
9 :use-module (app gwave std-menus)
13 (read-enable 'positions)
15 (dbprint "extra-menus.scm running\n")
17 ; demonstrating how we can add our own menu to the end
18 ; of the menubar by using append-hook.
19 ; this adds some debugging options.
23 ; (display "in new-wavewin-hook") (newline)
24 (let* ((mbar (get-wavewin-menubar))
25 (menu (menu-create mbar "Debug")))
26 (add-menuitem menu "my menu" #f)
27 (add-menuitem menu "garbage collect" gc)
29 (add-menuitem menu "list panels"
31 (display "panel-list:") (newline)
32 (for-each (lambda (wp)
34 (if (wavepanel-selected? wp)
35 (display "[selected]"))
40 (add-menuitem menu "list visiblewaves"
42 (for-each (lambda (wp)
43 (display "wp:") (display wp) (newline)
44 (for-each (lambda (vw)
45 (display vw)(newline))
46 (wavepanel-visiblewaves wp)))
47 (wtable-wavepanels))))
49 (add-menuitem menu "list files"
51 (format #t "wavefile-list: ~a\n" (wavefile-list))))
53 (add-menuitem menu "waveform calculate test"
55 (display "calculate-waves stub\n")
56 (let ((wvlist (all-selected-waves)))
58 ((eq? 2 (length wvlist))
59 (let* ((w1 (car wvlist))
61 (newname (format #f "~a-~a"
62 (visiblewave-varname w1)
63 (visiblewave-varname w2))))
64 (format #t "calc ~s - ~s => ~s\n" w1 w2 newname)
65 (new-wavevar-calc! newname - w1 w2)
68 ((eq? 1 (length wvlist))
69 (let* ((w1 (car wvlist))
70 (newname (format #f "(-~a)"
71 (visiblewave-varname w1))))
72 (format #t "calc - ~s => ~s\n" w1 newname)
73 (new-wavevar-calc! newname - w1)
76 (else (display "calculate requires one or two waves.\n"))
86 ; (display "in extra-menus new-wavelist-hook for") (display df) (newline)
87 (let* ((mbar (wavefile-listwin-menubar df))
88 (menu (menu-create mbar "Debug")))
89 (add-menuitem menu "List Variables"
91 (display (wavefile-all-variables df))
94 (add-menuitem menu "List Sweeps"
96 (format #t "~s sweeps:\n" (wavefile-nsweeps df))
97 (display (wavefile-sweeps df)) (newline)
99 (format #t " ~s = ~s\n" (car s) (cdr s)))
100 (wavefile-sweeps df))
103 (add-menuitem menu #f #f)
106 (dbprint "extra-menus.scm done\n")