~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/vat/ui-ctrlmenu.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # ui-ctrlmenu.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1998-2002 The Regents of the University of California.
  6 # All rights reserved.
  7 #
  8 # Redistribution and use in source and binary forms, with or without
  9 # modification, are permitted provided that the following conditions are met:
 10 #
 11 # A. Redistributions of source code must retain the above copyright notice,
 12 #    this list of conditions and the following disclaimer.
 13 # B. Redistributions in binary form must reproduce the above copyright notice,
 14 #    this list of conditions and the following disclaimer in the documentation
 15 #    and/or other materials provided with the distribution.
 16 # C. Neither the names of the copyright holders nor the names of its
 17 #    contributors may be used to endorse or promote products derived from this
 18 #    software without specific prior written permission.
 19 #
 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 #
 31 #  @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/vat/ui-ctrlmenu.tcl,v 1.10 2002/02/03 04:30:33 lim Exp $
 32 
 33 
 34 import TextEntry GlobalStatWindow KeyEditor Configuration TopLevelWindow
 35 
 36 #
 37 # A control menu to control the various elements of
 38 # the audio subsystems.
 39 #
 40 Class AudioControlMenu -superclass TopLevelWindow -configuration {
 41         defaultPriority 100
 42         mikeMute true
 43         lectureMode false
 44         meterEnable true
 45         mikeAGC false
 46         speakerAGC false
 47         mikeAGCLevel 0
 48         speakerAGCLevel 0
 49         autoRaise true
 50         externalEchoCancel false
 51         silenceThresh 20
 52         keepSites false
 53         sortSites true
 54         muteNewSites false
 55         speakerMode NetMutesMike
 56         jackMode FullDuplex
 57         lineoutMode NetMutesMike
 58         lineout2Mode NetMutesMike
 59         audioFormat PCM2
 60 }
 61 
 62 
 63 #
 64 # Creates a toplevel window at ".menu".
 65 #
 66 AudioControlMenu instproc init { agent ui panel } {
 67         $self add_default ctrlTitleFont [$self get_option helv12b]
 68         $self add_default ctrlFont [$self get_option helv10b]
 69         $self add_default noAudioFont [$self get_option helv10o]
 70         $self next .menu
 71         $self instvar ui_ agent_ panel_
 72         set agent_ $agent
 73         set ui_ $ui
 74         set panel_ $panel
 75 
 76         $self setup_tkvars
 77 
 78         $self tkvar audioFormat silenceThresh
 79         if { $audioFormat != "" } {
 80                 if { [$agent select_format [string range $audioFormat 0 2] \
 81                                 [string range $audioFormat 3 4]] < 0 } {
 82                         puts stderr "[$self get_option appname]: unknown audio format: $audioFormat"
 83                         exit 1
 84                 }
 85         }
 86         if { $silenceThresh != "" } {
 87                 $agent set_silence_thresh $silenceThresh
 88         }
 89 
 90         $self enable_meters
 91 
 92         $self tkvar recvOnly
 93         $ui set_recv_only $recvOnly
 94         if { $recvOnly || [$self yesno mikeMute] } {
 95                 $panel_ ptt-release
 96         }
 97 }
 98 
 99 #
100 AudioControlMenu instproc test_tone type {
101         $self instvar agent_ panel_
102         $panel_ action
103         $agent_ audio_test $type
104 }
105 
106 #
107 AudioControlMenu instproc mk.tests { w } {
108         label $w.label -text "Audio Tests" -font [$self get_option ctrlTitleFont]
109         frame $w.frame -borderwidth 2 -relief sunken
110         frame $w.frame.p1
111         frame $w.frame.p2
112 
113         set f [$self get_option ctrlFont]
114         set p $w.frame.p1
115         $self instvar agent_
116         radiobutton $p.none -text none -relief flat \
117                 -command "$self test_tone none" \
118                 -anchor w -variable [$self tkvarname audioTest] \
119                 -font $f -value none
120         $p.none select
121         pack $p.none -fill x
122         $self instvar agent_
123         if ![$agent_ is_halfduplex] {
124                 radiobutton $p.loop -text "loopback" -relief flat \
125                         -command "$self test_tone loopback" -value loopback \
126                         -anchor w -variable [$self tkvarname audioTest] \
127                         -font $f
128                 pack $p.loop -fill x
129         }
130         set p $w.frame.p2
131         radiobutton $p.t6 -text "-6dBm tone" -relief flat -value t6 \
132                 -command "$self test_tone low" -anchor w \
133                 -variable [$self tkvarname audioTest] -font $f
134         radiobutton $p.t0 -text "0dBm tone" -relief flat -value t0 \
135                 -command "$self test_tone med" -anchor w \
136                 -variable [$self tkvarname audioTest] -font $f
137         radiobutton $p.tmax -text "max tone" -relief flat -value tmax \
138                 -command "$self test_tone max" -anchor w \
139                 -variable [$self tkvarname audioTest] -font $f
140         pack $p.t6 $p.t0 $p.tmax -expand 1 -fill x
141 
142         pack $w.frame.p1 -side left -anchor center
143         pack $w.frame.p2 -side left -expand 1 -fill both
144 
145         pack $w.label -fill x
146         pack $w.frame -fill both -expand 1
147 
148         $self tkvar audioTest
149         set audioTest none
150 }
151 
152 #
153 AudioControlMenu instproc enable_meters {} {
154         $self instvar panel_
155         $self tkvar meterEnable
156         $panel_ enable_meters $meterEnable
157 }
158 
159 #
160 AudioControlMenu instproc set-pri p {
161         $self instvar ui_ panel_
162         #FIXME
163         [$panel_ set arbiter_] set-pri $p
164 }
165 
166 #
167 AudioControlMenu instproc pri_accept { w pri } {
168         $self tkvar audioPri
169         if { $audioPri == 0 } {
170                 $self set-pri $pri
171         }
172         return 0
173 }
174 
175 #
176 AudioControlMenu instproc mk.pri { w } {
177         label $w.label -text "Priority" -font [$self get_option ctrlTitleFont]
178         frame $w.frame -borderwidth 2 -relief sunken
179         set f [$self get_option ctrlFont]
180         set p $w.frame.inset
181         frame $p -borderwidth 0
182         pack $p -anchor c
183         radiobutton $p.high -text "high (200)" -relief flat -value 200 \
184                 -variable [$self tkvarname audioPri] \
185                 -command "$self set-pri 200" -font $f
186         radiobutton $p.med -text "med (100)" -relief flat -value 100 \
187                 -variable [$self tkvarname audioPri] \
188                 -command "$self set-pri 100" -font $f
189         radiobutton $p.low -text "low (10)" -relief flat -value 10 \
190                 -variable [$self tkvarname audioPri] \
191                 -command "$self set-pri 10" -font $f
192         frame $p.f
193         radiobutton $p.f.rb -text "" -relief flat -value 0 \
194                 -command "$self set-pri \[$p.f.entry get\]" \
195                 -variable [$self tkvarname audioPri] -font $f
196 
197         new TextEntry "$self pri_accept" $p.f.entry ""
198         #FIXME
199         $p.f.entry configure -width 4
200 
201         pack $p.f.rb $p.f.entry -side left
202         pack $p.f.entry -side left -expand 1 -fill x
203 
204         set pri [$self get_option defaultPriority]
205         if { $pri == 10 } {
206                 $p.low select
207         } elseif { $pri == 100 } {
208                 $p.med select
209         } elseif { $pri == 200 } {
210                 $p.high select
211         } else {
212                 $p.f.rb select
213         }
214         $p.f.entry insert 0 $pri
215         set entryTab($p.f.entry:value) $pri
216 
217         pack $p.high $p.med $p.low $p.f -expand 1 -fill x
218         pack $w.label $w.frame -expand 1 -fill x
219 }
220 
221 #
222 AudioControlMenu instproc mk.oradio { w } {
223         $self set duplex_panel_ $w
224         set f [$self get_option ctrlFont]
225         $self instvar agent_
226         set labels [$agent_ get_output_ports]
227         set i 0
228         set n [llength $labels]
229         while { $i < $n } {
230                 set p $w.p$i
231                 frame $p
232                 set port [lindex $labels $i]
233                 set label $port
234                 global omode$i
235                 if { $label == "speaker" } { set label "spkr" }
236                 label $p.label -text $label -font $f
237                 radiobutton $p.mmn -text "" -relief flat -value MikeMutesNet \
238                         -command "$agent_ set_speakerphone $port mikemutesnet"\
239                         -variable omode$i -font $f
240                 radiobutton $p.nmm -text "" -relief flat -value NetMutesMike \
241                         -command "$agent_ set_speakerphone $port netmutesmike"\
242                         -variable omode$i -font $f
243                 radiobutton $p.fd -text "" -relief flat -value FullDuplex \
244                         -command "$agent_ set_speakerphone $port fullduplex" \
245                         -variable omode$i -font $f
246                 pack $p.label $p.mmn $p.nmm $p.fd
247                 if { [$self yesno externalEchoCancel] } {
248                         radiobutton $p.ec -text "" -relief flat \
249                         -value EchoCancel \
250                         -command "$agent_ set_speakerphone $port echocancel" \
251                         -variable omode$i -font $f
252                         pack $p.ec
253                 }
254                 pack $p -side left -anchor w
255                 set omode$i [$self get_option $port\Mode]
256                 eval "$agent_ set_speakerphone $port \$omode$i"
257 
258                 incr i
259         }
260         frame $w.label
261         label $w.label.blank -text "" -font $f
262         label $w.label.mmn -text "Mike mutes net" -font $f
263         label $w.label.nmm -text "Net mutes mike" -font $f
264         label $w.label.fd -text "Full duplex" -font $f
265         pack $w.label.blank $w.label.mmn $w.label.nmm $w.label.fd -anchor w
266         if { [$self yesno externalEchoCancel] } {
267                 label $w.label.ec -text "Ext. Echo Cancel" -font $f
268                 pack $w.label.ec -anchor w
269         }
270         pack $w.label -side left -anchor w -fill x
271 }
272 
273 
274 AudioControlMenu instproc update_duplex { } {
275         $self instvar duplex_panel_ agent_
276         if ![$agent_ is_halfduplex] {
277                 if [info exists duplex_panel_] {
278                         catch {pack $duplex_panel_ \
279                                         -before [winfo parent \
280                                         $duplex_panel_].buttons \
281                                         -anchor c -pady 4 -fill x -padx 5}
282                 }
283 
284                 foreach port [$agent_ get_output_ports] {
285                         set omode [$self get_option $port\Mode]
286                         $agent_ set_speakerphone $port $omode
287                 }
288         } else {
289                 if [info exists duplex_panel_] {
290                         catch {pack forget $duplex_panel_}
291                 }
292                 foreach port [$agent_ get_output_ports] {
293                         $agent_ set_speakerphone $port mikemutesnet
294                 }
295         }
296 }
297 
298 
299 #
300 # place
301 # global tcl variables.  Called
302 # after command line options have been parsed.
303 #
304 AudioControlMenu instproc setup_tkvars {} {
305         foreach r { autoRaise keepSites sortSites muteNewSites mikeAGC \
306                         speakerAGC meterEnable lectureMode recvOnly } {
307                 $self tkvar $r
308                 set $r [$self yesno $r]
309         }
310         foreach r { audioFormat iconPrefix silenceThresh } {
311                 $self tkvar $r
312                 set $r [$self get_option $r]
313         }
314         set audioFormat [string toupper $audioFormat]
315 }
316 
317 #
318 # Query one of the variables controlled by tk widgets.
319 #
320 AudioControlMenu instproc query which {
321         $self tkvar $which
322         return [set $which]
323 }
324 
325 #
326 AudioControlMenu instproc set_silence_thresh {} {
327         $self instvar agent_
328         $self tkvar silenceSuppressor silenceThresh
329         if $silenceSuppressor {
330                 $agent_ set_silence_thresh $silenceThresh
331         } else {
332                 $agent_ set_silence_thresh 0
333         }
334 }
335 
336 #
337 AudioControlMenu instproc mk.obuttons { w } {
338 
339         set f [$self get_option ctrlFont]
340         frame $w.p0 -borderwidth 0
341         frame $w.p1 -borderwidth 0
342         pack $w.p0 $w.p1 -side left -fill x -anchor n
343 
344         set p $w.p0
345         checkbutton $p.ar -text "Autoraise" -relief flat -font $f \
346                 -variable [$self tkvarname autoRaise]
347 
348         checkbutton $p.dm -text "Disable Meters" -relief flat -font $f \
349                 -command "$self enable_meters" \
350                 -variable [$self tkvarname meterEnable] \
351                 -onvalue 0 -offvalue 1
352 
353         checkbutton $p.nss -text "Suppress Silence" -relief flat -font $f \
354                 -command "$self set_silence_thresh" \
355                 -variable [$self tkvarname silenceSuppressor]
356         $self tkvar silenceSuppressor
357         $self instvar silenceSuppressorButton_
358         set silenceSuppressor 1
359         set silenceSuppressorButton_ $p.nss
360 
361         pack $p.ar $p.dm $p.nss -expand 1 -fill x
362 
363         set p $w.p1
364         $self tkvar keepSites sortSites
365         checkbutton $p.mns -text "Mute New Sites" -relief flat -font $f \
366                 -variable [$self tkvarname muteNewSites]
367 
368         $self instvar agent_
369         checkbutton $p.kas -text "Keep All Sites" -relief flat -font $f \
370             -command "$agent_ keep-sites \[set [$self tkvarname keepSites]]" \
371                 -variable [$self tkvarname keepSites]
372         $agent_ keep-sites $keepSites
373         $agent_ site-drop-time [$agent_ get_option siteDropTime]
374 
375         $self instvar ui_
376         checkbutton $p.kss -text "Keep Sites Sorted" -relief flat -font $f \
377             -command "$ui_ keep-sorted \[set [$self tkvarname sortSites]]" \
378                 -variable [$self tkvarname sortSites]
379         $ui_ keep-sorted $sortSites
380 
381         pack $p.mns $p.kas $p.kss -expand 1 -fill x
382 }
383 
384 proc setAGC { w which level } {
385         $w.label configure -text "$level dB"
386         controller agc-$which $level
387 }
388 
389 proc enableAGC { w which } {
390         global doAGC
391         if $doAGC($which) {
392                 controller agc-$which [$w.scale get]
393                 controller agc-$which-enable 1
394                 $w.scale configure -state normal
395         } else {
396                 controller agc-$which-enable 0
397                 $w.scale configure -state disabled
398         }
399 }
400 
401 proc oneagc { w which label } {
402         set f [$self get_option ctrlFont]
403         checkbutton $w.button -text $label -relief flat -font $f \
404                 -command "enableAGC $w $which" -variable doAGC($which)
405         scale $w.scale -orient horizontal \
406                         -showvalue 0 \
407                         -from -10 -to 10 \
408                         -command "setAGC $w $which" \
409                         -relief groove -borderwidth 2 -width 10 \
410                         -state disabled
411 
412         label  $w.label -text "0 dB" -width 5 -font $f
413         pack $w.button $w.scale $w.label -side left
414         pack $w.scale -expand 1 -fill x -pady 3
415 
416         global AGCbutton
417         set AGCbutton($which) $w.button
418 }
419 
420 #
421 AudioControlMenu instproc mk.agc { w } {
422         label $w.label -text "Automatic Gain Control" -font [$self get_option ctrlTitleFont]
423         frame $w.frame -borderwidth 2 -relief sunken
424 
425         frame $w.frame.spkr -borderwidth 0
426         frame $w.frame.mike -borderwidth 0
427 
428         oneagc $w.frame.spkr output Spkr
429         $w.frame.spkr.scale set [$self get_option speakerAGCLevel]
430         oneagc $w.frame.mike input Mike
431         $w.frame.mike.scale set [$self get_option mikeAGCLevel]
432 
433         pack $w.frame.spkr $w.frame.mike -fill x
434         pack $w.label $w.frame -expand 1 -fill x
435         pack $w.frame -padx 6
436 }
437 
438 #
439 AudioControlMenu instproc set_ssthresh { w level } {
440         $self tkvar silenceThresh silenceSuppressor
441         $self instvar silenceSuppressorButton_
442         $w.label configure -text $level
443         set silenceThresh $level
444         $self set_silence_thresh
445         if !$silenceSuppressor {
446                 $silenceSuppressorButton_ invoke
447         }
448 }
449 
450 #
451 AudioControlMenu instproc mk.ssthresh w {
452         set f [$self get_option ctrlFont]
453 
454         $self tkvar silenceThresh
455         label $w.button -text "Silence Thresh: " -relief flat -font $f
456         scale $w.scale -orient horizontal \
457                         -showvalue 0 \
458                         -from 10 -to 60 \
459                         -command "$self set_ssthresh $w" \
460                         -relief groove -borderwidth 2 -width 10
461         $w.scale set $silenceThresh
462         label  $w.label -text $silenceThresh -width 3 -font $f
463         pack $w.button $w.scale $w.label -side left
464         pack $w.scale -expand 1 -fill x -pady 3
465 }
466 
467 #
468 AudioControlMenu instproc mk.omode { w } {
469         label $w.label -text "Output Mode" -font [$self get_option ctrlTitleFont]
470 
471         frame $w.frame -borderwidth 2 -relief sunken
472         frame $w.frame.radios -borderwidth 0
473         frame $w.frame.buttons -borderwidth 0
474 
475         $self mk.oradio $w.frame.radios
476 
477         $self mk.obuttons $w.frame.buttons
478         frame $w.frame.ssthresh
479         # mk.ssthresh $w.frame.ssthresh
480         #pack $w.frame.radios $w.frame.buttons $w.frame.ssthresh \
481         #       -anchor c -pady 4
482         pack $w.frame.radios $w.frame.buttons \
483                 -anchor c -pady 4 -fill x -padx 5
484         pack $w.label $w.frame -expand 1 -fill x
485 
486         $self instvar agent_
487         if [$agent_ is_halfduplex] {
488                 $self update_duplex
489         }
490 }
491 
492 #
493 AudioControlMenu instproc mk.me w {
494         set f [$self get_option ctrlFont]
495         frame $w.mode -borderwidth 2 -relief sunken
496         frame $w.mode.inset -borderwidth 0
497         set p $w.mode.inset
498         label $p.title -text "Tx Mode" -font $f
499         pack $p.title -side top -anchor n -expand 1 -fill both
500         $self instvar ui_
501         checkbutton $p.lec -text "Lecture" \
502                 -command "$ui_ set_lecture_mode \
503                         \[set [$self tkvarname lectureMode]]" \
504                 -variable [$self tkvarname lectureMode] -font $f
505 
506         checkbutton $p.ro -text "RecvOnly" \
507                 -command "$ui_ set_recv_only \
508                         \[set [$self tkvarname recvOnly]]" \
509                 -variable [$self tkvarname recvOnly] -font $f
510 
511         pack $p.lec $p.ro -fill x
512         pack $p -anchor n
513         pack $p -side left -expand 1 -fill x
514 
515         frame $w.fmt -borderwidth 2 -relief sunken
516         label $w.fmt.title -text "Output Format" -font $f
517         pack $w.fmt.title -side top
518         frame $w.fmt.p1
519         set p $w.fmt.p1
520         $self instvar agent_
521         radiobutton $p.pcm -text PCM -font $f -value PCM \
522                 -command "$agent_ select_format PCM 1" \
523                 -variable [$self tkvarname audioFormat]
524         radiobutton $p.pcm2 -text PCM2 -font $f -value PCM2 \
525                 -command "$agent_ select_format PCM 2" \
526                 -variable [$self tkvarname audioFormat]
527         radiobutton $p.pcm4 -text PCM4 -font $f -value PCM4 \
528                 -command "$agent_ select_format PCM 4" \
529                 -variable [$self tkvarname audioFormat]
530         pack $p.pcm $p.pcm2 $p.pcm4 -expand 1 -fill x
531 
532         frame $w.fmt.p2
533         set p $w.fmt.p2
534         radiobutton $p.dvi -text DVI -font $f -value DVI \
535                 -command "$agent_ select_format ADPCM 1" \
536                 -variable [$self tkvarname audioFormat]
537         radiobutton $p.dvi2 -text DVI2 -font $f -value DVI2 \
538                 -command "$agent_ select_format ADPCM 2" \
539                 -variable [$self tkvarname audioFormat]
540         radiobutton $p.dvi4 -text DVI4 -font $f -value DVI4 \
541                 -command "$agent_ select_format ADPCM 4" \
542                 -variable [$self tkvarname audioFormat]
543         pack $p.dvi $p.dvi2 $p.dvi4 -expand 1 -fill x
544 
545         frame $w.fmt.p3
546         set p $w.fmt.p3
547         radiobutton $p.gsm -text GSM -font $f -value GSM \
548                 -command "$agent_ select_format GSM 4" \
549                 -variable [$self tkvarname audioFormat]
550         radiobutton $p.lpc4 -text LPC4 -font $f -value LPC4 \
551                 -command "$agent_ select_format LPC 4" \
552                 -variable [$self tkvarname audioFormat]
553         pack $p.gsm $p.lpc4 -expand 1 -fill x
554         pack $w.fmt.p1 $w.fmt.p2 $w.fmt.p3 -side left
555         pack $w.mode -side left -expand 1 -fill both
556         pack $w.fmt -side left
557         set ttl [$self get_option defaultTTL]
558         $self tkvar audioFormat
559         if {$ttl > 160} {
560                 $w.fmt.p1.pcm configure -state disabled
561                 if {$audioFormat  == "PCM"} {
562                         set audioFormat PCM2
563                 }
564                 if {$ttl > 192} {
565                         $w.fmt.p1.pcm2 configure -state disabled
566                         $w.fmt.p1.pcm4 configure -state disabled
567                         if {[regexp -nocase pcm $audioFormat]} {
568                                 set audioFormat DVI2
569                         }
570                         if {$ttl > 200} {
571                                 $w.fmt.p2.dvi configure -state disabled
572                                 $w.fmt.p2.dvi2 configure -state disabled
573                                 $w.fmt.p2.dvi4 configure -state disabled
574                                 if {[regexp -nocase dvi $audioFormat]} {
575                                         set audioFormat GSM
576                                 }
577                         }
578                 }
579         }
580 }
581 
582 #
583 AudioControlMenu instproc new_hostspec {} {
584         $self instvar agent_ addrlabel_
585         if ![info exists addrlabel_] {
586                 return
587         }
588         set addr [$agent_ session-addr]
589         set port [$agent_ session-port]
590         set ttl [$agent_ session-ttl]
591         $addrlabel_ configure -text \
592                 "Dest: $addr  Port: $port  TTL: $ttl"
593 }
594 
595 #
596 AudioControlMenu instproc mk.info { w } {
597         $self instvar agent_ addrlabel_
598         set addr [$agent_ session-addr]
599         set port [$agent_ session-port]
600         set ttl [$agent_ session-ttl]
601         label $w.label -font [$self get_option ctrlFont] -text \
602                 "Dest: $addr  Port: $port  TTL: $ttl"
603         set addrlabel_ $w.label
604         pack $w.label -expand 1 -fill x
605 }
606 
607 #
608 # Creates a global window
609 #
610 AudioControlMenu instproc create-global-window {} {
611         $self instvar src_ global_win_
612         if [info exists global_win_] {
613                 $self delete-global-window
614         } else {
615                 set global_win_ [new GlobalStatWindow .gstat \
616                                         "RTP Statistics" \
617                                         "RTP Statistics" \
618                                         "$self get-global-stats" \
619                                         "$self delete-global-window"]
620         }
621 }
622 
623 #
624 AudioControlMenu instproc delete-global-window {} {
625         $self instvar global_win_
626         delete $global_win_
627         unset global_win_
628 }
629 
630 #
631 AudioControlMenu instproc get-global-stats {} {
632         return "Foo 1"
633 }
634 
635 
636 #
637 AudioControlMenu instproc mk.entries { w } {
638 #       global sessionKey
639 #       set sessionKey [$self get_option sessionKey]
640 
641         frame $w.name
642         label $w.name.label -text "Name: " -font [$self get_option ctrlFont] -anchor e -width 6
643         new TextEntry "$self update_name" $w.name.entry \
644             [$self get_option rtpName]
645         pack $w.name.label -side left
646         pack $w.name.entry -side left -expand 1 -fill x -pady 2
647 
648         frame $w.msg
649         label $w.msg.label -text "Note: " -font [$self get_option ctrlFont] -anchor e -width 6
650         new TextEntry "$self update_note" $w.msg.entry ""
651         pack $w.msg.label -side left
652         pack $w.msg.entry -side left -expand 1 -fill x -pady 2
653 
654         #
655         # Create the entry widget for editing the session's
656         # encryption key.  The audio agent exports methods
657         # (invoked by the KeyEditor) to enable/disable encryption.
658         #
659         $self instvar agent_
660         new KeyEditor $w $agent_
661 
662         pack $w.name $w.msg $w.key -expand 1 -fill x
663 
664         frame $w.b
665 
666         # for now (i.e. until GlobalStatWindow is further implemented)
667         button $w.b.stats -text "Global Stats" -borderwidth 2 \
668                 -anchor c -font [$self get_option ctrlFont] \
669                 -command "$self create-global-window"
670         pack $w.b.stats -side left -padx 4 -pady 2 -anchor c
671         $w.b.stats configure -state disabled
672 
673         pack $w.b -pady 2 -anchor c
674 }
675 
676 #
677 AudioControlMenu instproc update_name name {
678         if { $name != ""} {
679                 $self instvar agent_
680                 $agent_ set_local_sdes name $name
681                 return 0
682         }
683         return -1
684 }
685 
686 #
687 AudioControlMenu instproc update_note note {
688         $self instvar agent_
689         $agent_ set_local_sdes note $note
690         return 0
691 }
692 
693 #
694 AudioControlMenu instproc mk.net { w } {
695         label $w.label -text "Network" -font [$self get_option ctrlTitleFont]
696         frame $w.frame -borderwidth 0
697         frame $w.frame.me -borderwidth 0
698         frame $w.frame.ie -borderwidth 2 -relief sunken
699         frame $w.frame.ie.info -borderwidth 0
700         frame $w.frame.ie.entries -borderwidth 0
701 
702         $self mk.me $w.frame.me
703         $self mk.info $w.frame.ie.info
704         $self mk.entries $w.frame.ie.entries
705 
706         pack $w.label $w.frame -expand 1 -fill x
707         pack $w.frame -padx 6
708 
709         pack $w.frame.ie.info $w.frame.ie.entries -expand 1 -fill x
710         pack $w.frame.me $w.frame.ie -expand 1 -fill x
711 }
712 
713 #
714 # Build the menu panel.  Called from toggle_window,
715 # the first time the Menu button is hit.
716 #
717 AudioControlMenu instproc build w {
718         $self create-window $w "Audio Settings"
719 #       wm withdraw $w
720         bind $w <Enter> "focus $w"
721         frame $w.tp
722         frame $w.tp.tests
723         frame $w.tp.pri
724         frame $w.omode
725         #FIXMEframe $w.agc
726         frame $w.net
727 
728         $self mk.tests $w.tp.tests
729         $self mk.pri $w.tp.pri
730         $self mk.omode $w.omode
731         #FIXME NOT YET mk.agc $w.agc
732         $self mk.net $w.net
733         button $w.ok -text " Dismiss " -borderwidth 2 -relief raised \
734                 -command "$self toggle" -font [$self get_option ctrlTitleFont]
735         frame $w.pad -borderwidth 0 -height 6
736 
737         pack $w.tp.tests -side left -expand 1 -fill both -padx 2
738         pack $w.tp.pri -side left -expand 1 -fill x -padx 2
739         #FIXME pack $w.tp $w.omode $w.agc $w.net -expand 1 -fill x
740         pack $w.tp $w.omode $w.net -expand 1 -fill x
741         pack $w.ok -pady 6 -anchor c
742         pack $w.tp -padx 4
743         pack $w.omode -padx 6
744 
745         wm protocol $w WM_DELETE_WINDOW "$self toggle"
746 }
747 
748 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.