Debian Codegraph @

filterbank~.tcl

raw
1 ############ filterbank procedures -- [email protected] #########
2
3 proc filterbank_apply {id} {
4 # strip "." from the TK id to make a variable name suffix
5 set vid [string trimleft $id .]
6 # for each variable, make a local variable to hold its name...
7 set var_graph_lowfreq [concat graph_lowfreq_$vid]
8 global $var_graph_lowfreq
9 set var_graph_highfreq [concat graph_highfreq_$vid]
10 global $var_graph_highfreq
11
12 set cmd [concat $id dialog \
13 [eval concat $$var_graph_lowfreq] \
14 [eval concat $$var_graph_highfreq] \
15 \;]
16 #puts stderr $cmd
17 pdsend $cmd
18 }
19
20 proc filterbank_cancel {id} {
21 set cmd [concat $id cancel \;]
22 #puts stderr $cmd
23 pdsend $cmd
24 }
25
26 proc filterbank_ok {id} {
27 filterbank_apply $id
28 filterbank_cancel $id
29 }
30
31 proc pdtk_filterbank_dialog {id lowfreq highfreq} {
32 set vid [string trimleft $id .]
33 set var_graph_lowfreq [concat graph_lowfreq_$vid]
34 global $var_graph_lowfreq
35 set var_graph_highfreq [concat graph_highfreq_$vid]
36 global $var_graph_highfreq
37
38 set $var_graph_lowfreq $lowfreq
39 set $var_graph_highfreq $highfreq
40
41 toplevel $id
42 wm title $id {filterbank}
43 wm protocol $id WM_DELETE_WINDOW [concat filterbank_cancel $id]
44
45 label $id.label -text {FILTERBANK PROPERTIES}
46 pack $id.label -side top
47
48 frame $id.buttonframe
49 pack $id.buttonframe -side bottom -fill x -pady 2m
50 button $id.buttonframe.cancel -text {Cancel}\
51 -command "filterbank_cancel $id"
52 button $id.buttonframe.apply -text {Apply}\
53 -command "filterbank_apply $id"
54 button $id.buttonframe.ok -text {OK}\
55 -command "filterbank_ok $id"
56 pack $id.buttonframe.cancel -side left -expand 1
57 pack $id.buttonframe.apply -side left -expand 1
58 pack $id.buttonframe.ok -side left -expand 1
59
60 frame $id.1rangef
61 pack $id.1rangef -side top
62 label $id.1rangef.llowfreq -text "Lower Frequency :"
63 entry $id.1rangef.lowfreq -textvariable $var_graph_lowfreq -width 7
64 pack $id.1rangef.llowfreq $id.1rangef.lowfreq -side left
65
66 frame $id.2rangef
67 pack $id.2rangef -side top
68 label $id.2rangef.lhighfreq -text "Higher Frequency :"
69 entry $id.2rangef.highfreq -textvariable $var_graph_highfreq -width 7
70 pack $id.2rangef.lhighfreq $id.2rangef.highfreq -side left
71
72 bind $id.1rangef.lowfreq <KeyPress-Return> [concat filterbank_ok $id]
73 bind $id.2rangef.highfreq <KeyPress-Return> [concat filterbank_ok $id]
74 focus $id.1rangef.lowfreq
75 }
76
77 ############ filterbank procedures END -- [email protected] #########