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

Open Mash Cross Reference
mash/tcl/applications/collaborator/ui-main.tcl

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

  1 # ui-main.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/applications/collaborator/ui-main.tcl,v 1.22 2002/02/03 04:21:46 lim Exp $
 32 
 33 
 34 import AudioPanel AudioControlMenu MultiSourceManager ScrolledListbox \
 35                 VisualFrame TipManager MultiSourceIcons VideoContainer \
 36                 MultiControlMenu UIMinimize Observer/Mb Observer/Mbv2 \
 37                 PaneManager RoverPanel MBv2UI CollaboratorIcons MashLogoIcon
 38 
 39 Class CollaboratorUI -superclass Observer -configuration {
 40         sessionType rtp
 41         speakerMute false
 42         inputPort {mike microphone mic}
 43         outputPort {speaker wave}
 44         mikeAGC false
 45         speakerAGC false
 46         buttonforeground gray40
 47         meterEnable true
 48 }
 49 
 50 
 51 CollaboratorUI public unknown {args} {
 52         puts "invoked unknown $args"
 53 }
 54 
 55 
 56 CollaboratorUI instproc keep-sorted {sense} {
 57     # FIXME
 58     # The code below is what vat would do, but collaborator doesn't have a
 59     # Sitebox.  This method is just here for now to silence the "invoked
 60     # unknown" message.
 61     #
 62     # [$self set sitebox_] keep-sorted $sense
 63 }
 64 
 65 
 66 CollaboratorUI public init { usemega exitCmd } {
 67         $self set useMega_ $usemega
 68         $self set exitCmd_ $exitCmd
 69 
 70         $self instvar as_
 71         set as_(video) 0
 72         set as_(audio) 0
 73         set as_(mb)    0
 74         set as_(mars)  0
 75         $self next
 76 }
 77 
 78 
 79 CollaboratorUI public default_options {prefix} {
 80         set defaults {
 81                 { *Menu*borderWidth 1 }
 82                 { *Menu*activeBorderWidth 1 }
 83                 { *Menu*font WidgetDefault }
 84                 { *ScrolledListbox.scrollbar both }
 85                 { *ScrolledListbox.bbox.highlightThickness 1 }
 86                 { *ScrolledListbox.Scrollbar.borderWidth 1 }
 87                 { *ScrolledListbox.Scrollbar.highlightThickness 1 }
 88                 { *ScrolledListbox.Scrollbar.width 10 }
 89                 { *ScrolledListbox*Canvas.width 225 }
 90                 { *ScrolledListbox*Canvas.height 120 }
 91                 { *ScrolledWinMgr.scrollbar both }
 92                 { *ScrolledWinMgr.Scrollbar.borderWidth 1 }
 93                 { *ScrolledWinMgr.Scrollbar.highlightThickness 1 }
 94                 { *ScrolledWinMgr.Scrollbar.width 10 }
 95                 { *ScrolledListbox/CanvasList*Canvas.relief sunken }
 96                 { *ScrolledListbox/CanvasList*Canvas.borderWidth 1 }
 97                 { *AudioPanelPane*borderWidth 1 }
 98         }
 99 
100         foreach optval $defaults {
101                 set option [lindex $optval 0]
102                 set value [lindex $optval 1]
103                 option add ${prefix}$option $value widgetDefault
104         }
105 
106         set defaults {
107                 { *ScrolledWindow.scrollbar both }
108                 { *ScrolledWindow.Scrollbar.borderWidth 1 }
109                 { *ScrolledWindow.Scrollbar.highlightThickness 1 }
110                 { *ScrolledWindow.Scrollbar.width 10 }
111                 { *ScrolledWindow*Canvas.height 300 }
112         }
113 
114         foreach optval $defaults {
115                 set option [lindex $optval 0]
116                 set value [lindex $optval 1]
117                 option add $option $value widgetDefault
118         }
119 
120         option add ${prefix}*AudioPanelPane*borderWidth 1
121 }
122 
123 
124 CollaboratorUI public build_widget { path } {
125         $self instvar sm_ path_ paneMgrs_ useMega_
126 
127         set path_ $path
128         $self default_options "*[$path cget -class]"
129 
130         # create the menubar
131 
132         # in mplug mode, if the toplevel is . we will have problems making
133         # $path.menu the menu of the toplevel, so let's just make a menu
134         # button for it
135         global mash
136         if { [info exists mash(environ)] && $mash(environ)=="mplug" && \
137                         [winfo toplevel $path]=="." } {
138                 #menubutton $path.menubutton -bd 1 -text "Menu..." \
139                 #               -menu $path.menu
140                 #pack $path.menubutton -in $path.bottom -side left -fill y \
141                 #               -after $path.label
142 
143                 menu $path.menu -type menubar
144                 $self build_menu $path.menu
145                 pack $path.menu -side top -fill x
146         } else {
147                 menu $path.menu -type menubar
148                 $self build_menu $path.menu
149                 [winfo toplevel $path] configure -menu $path.menu
150         }
151 
152         # create the container frames
153 
154         frame $path.frame
155         frame $path.bottom -bd 2 -relief ridge
156 
157         # must create this label here, since the arbiter is going to
158         # try to set its font
159         label $path.label
160 
161         # create a source manager widget
162         if [$self get_local_option have_mb] {
163                 # must create the "enable mb hack" button
164                 $self tkvar mb_hack_
165                 set mb_hack_ 0
166                 frame $path.list
167                 checkbutton $path.hack -text "Enable MB cname hack" \
168                                 -variable [$self tkvarname mb_hack_] \
169                                 -command "$self enable_mb_hack" \
170                                 -bd 1 -anchor w
171                 pack $path.hack -in $path.list -side bottom -fill x
172                 set list $path.list_with_hack
173         } elseif [$self get_local_option have_mbv2] {
174                 frame $path.list
175                 set list $path.mbv2list
176                 $self set mbv2_list_frame_  $path.list
177                 $self set mbv2_member_list_ $list
178         } else { set list $path.list }
179 
180         frame $list
181         label $list.label -anchor w -text "Member list:" -bd 1 -relief raised
182         ScrolledListbox ${list}.list -itemclass UIMultiSource -scrollbar both
183         set sm_ [new MultiSourceManager ${list}.list]
184         pack $list.label -fill x
185         pack $list.list -fill both -expand 1
186 
187         if { [$self get_local_option have_mb] || \
188                         [$self get_local_option have_mbv2] } {
189                 pack $list -in $path.list -fill both -expand 1 -side top
190         }
191 
192         # create MultiControlMenu
193         set cm [new MultiControlMenu .menu $self]
194         $self set_local_option controlmenu $cm
195 
196         # create a rover panel if required
197         if [$self get_local_option have_rover] {
198                 frame $path.rest
199                 raise $path.rest $path.frame
200                 $self make_rover_panel $path.roverpanel
201                 set encloser $path.rest
202         } else {
203                 set encloser $path.frame
204         }
205 
206         # create an mb panel if required
207         if [$self get_local_option have_mb] {
208                 frame $path.mbpanel -class MbPanel
209                 $self make_mb_panel $path.mbpanel
210 
211                 set mcm [$cm add_mb_page]
212                 set observers(mb) [new Observer/Mb $sm_ \
213                                 [[$self get_local_option mbUI] source_list]]
214                 $self set_local_option observer,mb $observers(mb)
215                 if $useMega_ {
216                         $cm original_session_spec mb \
217                                         [$self get_option mbSessionSpec]
218                 }
219         }
220 
221         # create an mbv2 panel if required
222         if [$self get_local_option have_mbv2] {
223                 #frame $path.mbv2panel -class Mbv2Panel
224                 $self make_mbv2_panel $path.mbv2panel
225 
226                 set mcm [$cm add_mbv2_page]
227                 set observers(mbv2) [new Observer/Mbv2 $sm_ \
228                                 [$self get_local_option mbv2UI]]
229                 $self set_local_option observer,mbv2 $observers(mbv2)
230                 if $useMega_ {
231                         $cm original_session_spec mbv2 \
232                                         [$self get_option mbv2SessionSpec]
233                 }
234         }
235 
236         # create a video panel if required
237         if [$self get_local_option have_video] {
238                 set videoAgent [$self get_local_option videoAgent]
239                 set scubaSess [$self get_local_option scubaSession]
240                 set canVoiceSwitch [$self get_local_option can_voiceswitch]
241 
242                 set vc [$self make_video_panel $path.videopanel]
243 
244                 set observers(video) [new Observer/Video $sm_ $videoAgent $vc\
245                                 $canVoiceSwitch $scubaSess]
246                 $self set_local_option observer,video $observers(video)
247                 if $canVoiceSwitch {
248                         [$self get_local_option local_channel] register \
249                                         FOCUS_SPEAKER \
250                                         "$observers(video) focus_speaker"
251                 }
252 
253                 set visualFrame [new VisualFrame $path.visual]
254                 # FIXME use_hw_decoder
255                 UISource/Video decoder_params [$visualFrame set colorModel_] 0
256                 $visualFrame attach_observer $observers(video)
257                 $self set_local_option visualFrame $visualFrame
258 
259                 set vcm [$cm add_video_page]
260                 if $useMega_ {
261                         $cm original_session_spec video \
262                                         [$self get_option videoSessionSpec]
263                 }
264         }
265 
266         # create an audio panel if required
267         if [$self get_local_option have_audio] {
268                 set audioAgent [$self get_local_option audioAgent]
269                 frame $path.audiopanel -class AudioPanel
270                 set panel [$self make_audio_panel $path.audiopanel]
271                 $self set_local_option audioPanel $panel
272                 set acm [$cm add_audio_page]
273                 set observers(audio) [new Observer/Audio $sm_ $audioAgent \
274                                 $panel $acm]
275                 $self set_local_option observer,audio $observers(audio)
276                 if $useMega_ {
277                         $cm original_session_spec audio \
278                                         [$self get_option audioSessionSpec]
279                 }
280 
281                 set a [$panel set arbiter_]
282                 $a attach_observer $self
283                 $a indicator_update
284         }
285 
286         # create the various pane managers
287         set have {}
288         if [$self get_local_option have_mb   ] { append have m }
289         if [$self get_local_option have_mbv2 ] { append have m }
290         if [$self get_local_option have_video] { append have v }
291         if [$self get_local_option have_audio] { append have a }
292 
293         if [$self get_local_option have_mb] { set mbpanel $path.mbpanel } \
294                         else { set mbpanel $path.mbv2panel }
295         if { $have=="mva" || $have=="mv" } {
296                 frame $path.mv
297                 raise $path.mv $encloser
298                 set paneMgrs_(mv) [new PaneManager $mbpanel \
299                                 $path.videopanel -in $path.mv -orient vertical\
300                                 -percent 0.65]
301         }
302 
303         if { $have=="mva" || $have=="ma" || $have=="va" } {
304                 switch $have {
305                         mva { set left $path.mv; set per 0.82 }
306                         ma { set left $mbpanel; set per 0.8 }
307                         va { set left $path.videopanel; set per 0.65 }
308                 }
309 
310                 frame $path.mva
311                 raise $path.mva $encloser
312                 set paneMgrs_(audio) [new PaneManager $left $path.audiopanel \
313                                 -in $path.mva -orient horizontal -percent $per]
314         }
315 
316         switch $have {
317                 m   { set right $mbpanel; set per 0.3 }
318                 v   { set right $path.videopanel; set per 0.6 }
319                 a   { set right $path.audiopanel; set per 0.73 }
320                 mv  { set right $path.mv; set per 0.3 }
321                 ma  { set right $path.mva; set per 0.3 }
322                 va  { set right $path.mva; set per 0.4 }
323                 mva { set right $path.mva; set per 0.3 }
324         }
325 
326         set paneMgrs_(list) [new PaneManager $path.list $right -in $encloser\
327                         -orient horizontal -percent $per]
328 
329         if [$self get_local_option have_rover] {
330                 set paneMgrs_(rover) [new PaneManager $encloser \
331                                 $path.roverpanel -in $path.frame \
332                                 -orient vertical -percent 0.85]
333         }
334 
335         if { $useMega_ || [$self get_local_option have_rover] } {
336                 $path.label configure -text "Contacting service..." -anchor w
337         } else {
338                 global mash
339                 $path.label configure -text "Collaborator v$mash(version)"
340         }
341         button $path.control -text "Properties..." -command \
342                         "\[$self get_local_option controlmenu\] toggle" \
343                         -bd 1 -highlightthickness 0
344         button $path.quit -text "Quit" -command [$self set exitCmd_] -bd 1 \
345                         -highlightthickness 0
346         pack $path.label -in $path.bottom -fill both -expand 1 -side left
347         pack $path.control -in $path.bottom -side left
348         pack $path.quit -in $path.bottom -side left
349         pack $path.bottom -fill x -side bottom
350         pack $path.frame -fill both -expand 1
351 
352         # explicitly set the geometry of the toplevel window
353         set top [winfo toplevel $path]
354         global mash
355         if { $mash(environ) == "mplug" } { set top $path }
356         if ![pack propagate $top] {
357         # For some unknown reason, you have to force an update before you set
358         # the window geometry on Windows.
359         update idletasks
360                 switch $have {
361                         mva { $top configure -width 800 -height 600 }
362                         mv  { $top configure -width 800 -height 600 }
363                         ma  { $top configure -width 680 -height 480 }
364                         va  { $top configure -width 480 -height 410 }
365                         v   { $top configure -width 480 -height 410 }
366                         m   { $top configure -width 640 -height 480 }
367                         a   { $top configure -width 335 -height 320 }
368                 }
369         }
370 }
371 
372 
373 
374 
375 #
376 # Called by AudioArbiter through the observer mechanism.
377 #
378 CollaboratorUI public arbiter_snatch {} {
379         $self instvar path_
380         set cm [$self get_local_option controlmenu,audio]
381         if [$cm query autoRaise] {
382                 raise [winfo toplevel $path_]
383         }
384 }
385 
386 
387 CollaboratorUI public arbiter_have {flag} {
388         $self instvar path_
389         set titleBar $path_.label
390         if $flag {
391                 $titleBar configure -font [$self get_option helv10b]
392         } else {
393                 $titleBar configure -font [$self get_option noAudioFont]
394         }
395 }
396 
397 
398 
399 CollaboratorUI public build_menu {menu} {
400         $menu add cascade -label "File" -menu $menu.file
401         menu $menu.file
402         $menu.file add command -label "Properties..." -command \
403                         "\[$self get_local_option controlmenu\] toggle"
404 
405         $menu.file add separator
406         $menu.file add command -label "Quit" -command [$self set exitCmd_]
407 
408         $menu add cascade -label "Help" -menu $menu.help
409         menu $menu.help
410         $menu.help add command -label "Help..."
411         $menu.help add command -label "About Collaborator..." \
412                         -command "$self about"
413 }
414 
415 
416 CollaboratorUI public build_mbv2_menu { menu } {
417         set mbv2ui [$self get_local_option mbv2UI]
418         set tools_toolbar_ [$mbv2ui tools_toolbar]
419         set canvmgr_ [$mbv2ui canvmgr]
420         set select [$tools_toolbar_ tool MBv2SelectTool]
421 
422         $menu.file insert 1 command -label "Save whiteboard as PS..." \
423                         -command "$canvmgr_ save_as_postscript"
424 
425         $menu add cascade -label "Edit" -menu $menu.edit -state disabled
426         menu $menu.edit -postcommand "$mbv2ui configure_edit_menu $menu.edit"
427         $menu.edit add command -label "Undo"   -accelerator <Ctl-Z> \
428                         -command "$tools_toolbar_ undo" -state disabled
429         $menu.edit add command -label "Redo"   -accelerator <Shift-Ctl-Z> \
430                         -command "$tools_toolbar_ redo" -state disabled
431         $menu.edit add separator
432         $menu.edit add command -label "Cut"    -accelerator <Ctl-X> \
433                         -command "$select cut"   -state disabled
434         $menu.edit add command -label "Copy"   -accelerator <Ctl-C> \
435                         -command "$select copy"  -state disabled
436         $menu.edit add command -label "Paste"  -accelerator <Ctl-V> \
437                         -command "$select paste" -state disabled
438         $menu.edit add command -label "Delete" -accelerator <Del>   \
439                         -command "$select delete" -state disabled
440         $menu.edit add separator
441         $menu.edit add cascade -label "Ordering" -menu $menu.edit.order \
442                         -state disabled
443 
444         menu $menu.edit.order
445         $menu.edit.order add command -label "Bring to front"
446         $menu.edit.order add command -label "Send to back"
447         $menu.edit.order add command -label "Bring forward"
448         $menu.edit.order add command -label "Send backward"
449 
450 
451         $menu add cascade -label "Tools" -menu $menu.tools -state disabled
452         menu $menu.tools
453         $menu.tools add command -label "Freehand/Text" -command \
454                         "$tools_toolbar_ invoke MBv2DrawTextTool"
455         $menu.tools add command -label "Arrow" -command \
456                         "$tools_toolbar_ invoke MBv2ArrowTool"
457         $menu.tools add command -label "Rectangle" -command \
458                         "$tools_toolbar_ invoke MBv2RectTool"
459         $menu.tools add command -label "Oval" -command \
460                         "$tools_toolbar_ invoke MBv2OvalTool"
461         $menu.tools add command -label "Select" -command \
462                         "$tools_toolbar_ invoke MBv2SelectTool"
463         $menu.tools add cascade -label "Insert..." -menu $menu.tools.insert
464 
465         menu $menu.tools.insert
466         $menu.tools.insert add command -label "Image..." -command \
467                         "$mbv2ui import image"
468         $menu.tools.insert add command -label "Text..." -command \
469                         "$mbv2ui import text"
470 
471         $menu add cascade -label "Options" -menu $menu.options -state disabled
472         menu $menu.options -postcommand \
473                         "$self configure_options_menu $menu.options"
474         $self tkvar show_mbv2_page_list_
475         set show_mbv2_page_list_ 0
476         $menu.options add checkbutton -label "Show page list" \
477                         -variable [$self tkvarname show_mbv2_page_list_] \
478                         -command "$self show_mbv2_page_list \[set [$self \
479                         tkvarname show_mbv2_page_list_]\]"
480         $mbv2ui tkvar show_tips_dummy_
481         set show_tips_ 1
482         $menu.options add checkbutton -label "Show tips" \
483                         -variable [$mbv2ui tkvarname show_tips_] \
484                         -command "TipManager enable \[set [$mbv2ui tkvarname \
485                         show_tips_]\]"
486         $menu.options add cascade -label "Show owner of item..." \
487                         -menu $menu.options.tips
488         menu $menu.options.tips
489         $mbv2ui tkvar tips_when_drawn_ tips_under_cursor_
490         $menu.options.tips add checkbutton -label "when drawn" \
491                         -variable [$mbv2ui tkvarname tips_when_drawn_] \
492                         -command "$mbv2ui show_owner_when_drawn \
493                         \[set [$mbv2ui tkvarname tips_when_drawn_]\]"
494         $menu.options.tips add checkbutton -label "under cursor (Select mode)"\
495                         -variable [$mbv2ui tkvarname tips_under_cursor_] \
496                         -command "$mbv2ui show_owner_under_cursor \
497                         \[set [$mbv2ui tkvarname tips_under_cursor_]\]"
498         set tips_when_drawn_   1; $mbv2ui show_owner_when_drawn   1
499         set tips_under_cursor_ 1; $mbv2ui show_owner_under_cursor 1
500 
501         $menu.options add command -label "Simulate packet drop..." -command \
502                         "$mbv2ui simulate_packet_drop"
503 }
504 
505 
506 CollaboratorUI private configure_options_menu { menu } {
507         set mbv2ui [$self get_local_option mbv2UI]
508         $mbv2ui configure_options_menu $menu
509         $self tkvar show_mbv2_page_list_
510         $self instvar mbv2_list_pane_mgr_
511         set show_mbv2_page_list_ [info exists mbv2_list_pane_mgr_]
512 }
513 
514 
515 CollaboratorUI private show_mbv2_page_list { f } {
516         $self instvar mbv2_list_frame_ mbv2_member_list_ mbv2_page_list_ \
517                         mbv2_list_pane_mgr_
518         set mbv2ui [$self get_local_option mbv2UI]
519         set canvmgr [$mbv2ui canvmgr]
520         $canvmgr set_show_canvas_list $f
521         if $f {
522                 if ![info exists mbv2_page_list_] {
523                         set mbv2_page_list_ $mbv2_list_frame_.pagelist
524                         $canvmgr create_canvas_list $mbv2_page_list_
525                 }
526                 pack forget $mbv2_member_list_
527                 set mbv2_list_pane_mgr_ [new PaneManager $mbv2_member_list_ \
528                                 $mbv2_page_list_ -in $mbv2_list_frame_ \
529                                 -orient vertical -percent 0.7]
530         } else {
531                 delete $mbv2_list_pane_mgr_
532                 unset mbv2_list_pane_mgr_
533                 pack $mbv2_member_list_ -in $mbv2_list_frame_ -fill both \
534                                 -expand 1 -side top
535         }
536 }
537 
538 
539 CollaboratorUI private mb_minimize { operation } {
540         $self instvar path_
541         if { $operation == "minimize" } {
542                 pack configure $path_.video_mb -fill none -expand 0
543         } else {
544                 pack configure $path_.video_mb -fill both -expand 1
545         }
546 }
547 
548 
549 CollaboratorUI public set_local_option { option value } {
550         $self instvar local_options_
551         set local_options_($option) $value
552 }
553 
554 
555 CollaboratorUI public get_local_option { option } {
556         $self instvar local_options_
557         if [info exists local_options_($option)] {
558                 return $local_options_($option)
559         }
560 }
561 
562 
563 
564 #
565 CollaboratorUI private make_audio_panel { w } {
566         set audioAgent [$self get_local_option audioAgent]
567         set panel [new AudioPanel $w $audioAgent]
568         $self set_local_option audioPanel $panel
569 
570 
571         #FIXME: copied from tcl/vat/ui-main.tcl
572         global inputPortButton outputPortButton inputScale outputScale
573         set ports [$audioAgent get_input_ports]
574         if { [llength $ports] <= 1 } {
575                 $inputPortButton configure -state disabled \
576                         -disabledforeground [$self get_option buttonforeground]
577         }
578         set plist [$self get_option inputPort]
579         set pname ""
580         foreach elt $plist {
581                 if {[lsearch [string tolower $ports] $elt] >= 0} {
582                         set pname $elt
583                 }
584         }
585         if { $pname == "" } {
586                 set pname [lindex $ports 0]
587         }
588         $panel setPort input $inputPortButton $inputScale $pname
589 
590         set ports [$audioAgent get_output_ports]
591         if { [llength $ports] <= 1 } {
592                 $outputPortButton configure -state disabled \
593                         -disabledforeground [$self get_option buttonforeground]
594         }
595         set plist [$self get_option outputPort]
596         set pname ""
597         foreach elt $plist {
598                 if {[lsearch [string tolower $ports] $elt] >= 0} {
599                         set pname $elt
600                 }
601         }
602         if { $pname == "" } {
603                 set pname [lindex $ports 0]
604         }
605         $panel setPort output $outputPortButton $outputScale $pname
606 
607 
608         #global outputScale inputScale
609         #$outputScale set [$audioAgent get_output_gain]
610         #$inputScale set [$audioAgent get_input_gain]
611         set meterEnable [$self yesno meterEnable]
612         $panel enable_meters $meterEnable
613         return $panel
614 }
615 
616 
617 #
618 CollaboratorUI private make_video_panel { w } {
619         if { [$self get_local_option have_mb] || \
620                         [$self get_local_option have_mbv2] } \
621                         { set orient horizontal } else { set orient vertical }
622         return [new VideoContainer $w 2 qcif $orient]
623 }
624 
625 
626 #
627 CollaboratorUI public make_mb_panel { w } {
628         set mbMgr  [$self get_local_option mbMgr]
629         set mbSndr [$self get_local_option mbSender]
630         set mbui [new MBUI $w $mbMgr $mbSndr [$self get_option showUI] ""]
631         $mbui proc window_title { args } { }
632         $self set_local_option mbUI $mbui
633 }
634 
635 
636 CollaboratorUI public make_mbv2_panel { w } {
637         $self instvar path_
638         set mbv2ui [new MBv2UI $w]
639         $self set_local_option mbv2UI $mbv2ui
640 
641         if { [$self get_local_option have_mbv2] == "1" } {
642                 $self build_mbv2_menu $path_.menu
643         }
644 }
645 
646 
647 CollaboratorUI public make_rover_panel { w } {
648         RoverPanel $w
649         $self set rover_panel_path_ $w
650         $w ssac_client [$self get_local_option ssacClient]
651 }
652 
653 
654 CollaboratorUI public set_rover_offset { offset } {
655         $self instvar rover_panel_path_
656         $rover_panel_path_ move_slider $offset
657 }
658 
659 
660 CollaboratorUI public activate_slider { start end } {
661         $self instvar rover_panel_path_
662         $rover_panel_path_ activate_slider $start $end
663 }
664 
665 
666 CollaboratorUI public update_title { info1 info2 duration } {
667         set cm [$self get_local_option controlmenu]
668         if { $cm!={} } {
669                 $cm update_session_info mars "Title: $info1\
670                                 \nInformation: $info2\nDuration: $duration\n"
671         }
672 }
673 
674 
675 CollaboratorUI public play_update { state } {
676         $self instvar rover_panel_path_
677         $rover_panel_path_ play_update $state
678 }
679 
680 
681 CollaboratorUI private create_minimize { tip frame minimize_frame \
682                 {minimize_cmd {}} {restore_cmd {}} } {
683         frame ${frame}_encloser
684         raise $frame ${frame}_encloser
685         button ${frame}_minimize -bd 1 -highlightthickness 0 \
686                         -image CollaboratorIcons(close) -command \
687                         [list $self minimize $frame $minimize_frame \
688                         $minimize_cmd $restore_cmd] -bg \#c0c0c0 \
689                         -activebackground \#c0c0c0
690         TipManager tip ${frame}_minimize -tip $tip
691         # 9898f8
692 
693         pack ${frame}_minimize -side top -in ${frame}_encloser -anchor w
694         pack $frame -side bottom -in ${frame}_encloser -fill both -expand 1
695         return ${frame}_encloser
696 }
697 
698 
699 CollaboratorUI private minimize { frame minimize_frame minimize_cmd \
700                 restore_cmd } {
701         pack forget $frame
702         ${frame}_minimize configure -image CollaboratorIcons(open) -command \
703                         [list $self restore $frame $minimize_frame \
704                         $minimize_cmd $restore_cmd]
705         pack ${frame}_minimize -side bottom -in ${frame}_encloser -anchor s
706         ${frame}_encloser configure -width 0 -height 0
707         if { $minimize_cmd != {} } { eval $minimize_cmd }
708 }
709 
710 
711 CollaboratorUI private restore { frame minimize_frame minimize_cmd \
712                 restore_cmd } {
713         ${frame}_minimize configure -image CollaboratorIcons(close) -command \
714                         [list $self minimize $frame $minimize_frame \
715                         $minimize_cmd $restore_cmd]
716         pack ${frame}_minimize -side top -in ${frame}_encloser -anchor w
717         pack $frame -side bottom -in ${frame}_encloser -fill both -expand 1
718         if { $restore_cmd != {} } { eval $restore_cmd }
719 }
720 
721 
722 CollaboratorUI public reset media {
723         if [catch {$self reset_ $media} m] {
724                 global errorInfo
725                 puts "$m: $errorInfo"
726         }
727 }
728 
729 
730 CollaboratorUI public reset_ media {
731         $self instvar useMega_ audioRecvOnly_
732 
733         if { $media == "audio" } {
734                 if { [$self get_option isAudioAgentReset]=={} } {
735                         $self add_option isAudioAgentReset 1
736                         set audioPanel [$self get_local_option audioPanel]
737                         if [info exists audioRecvOnly_] {
738                                 $self set_recv_only $audioRecvOnly_
739                         }
740                 }
741         }
742 
743         if { $media == "mbv2" } {
744                 $self instvar path_
745                 [$self get_local_option mbv2UI] enable_menu $path_.menu
746         }
747 
748         set cm [$self get_local_option controlmenu,$media]
749         if { $cm != {} } { $cm new_hostspec }
750 
751         if $useMega_ { $self heard_from $media }
752 }
753 
754 
755 CollaboratorUI public heard_from media {
756         $self instvar as_ path_ useMega_
757         set as_($media) 1
758 
759         set target [$self get_local_option have_rover]
760         if $useMega_ {
761                 set target [expr $target + \
762                                 [$self get_local_option have_video] + \
763                                 [$self get_local_option have_audio] + \
764                                 [$self get_local_option have_mb]]
765         }
766         if { [expr $as_(video) + $as_(audio) + $as_(mb) + $as_(mars)] >= \
767                         $target } {
768                 # we've got everything!
769                 global mash
770                 $path_.label configure -text "Collaborator v$mash(version)" \
771                                 -anchor c
772                 return
773         }
774 
775         set text "Contacting service... Heard from: "
776         foreach media [array names as_] {
777                 if $as_($media) { append text "$media " }
778         }
779         $path_.label configure -text $text
780 }
781 
782 
783 #
784 # If <i>v</i> is true, mute user's input and undo the AudioPanel's
785 # 3rd-mouse-button binding for speaking.
786 #
787 CollaboratorUI public set_recv_only v {
788         $self instvar audioRecvOnly_
789         if { [$self get_option isAudioAgentReset]=={} } {
790                 set audioRecvOnly_ $v
791                 set v 1
792         }
793 
794         set audioPanel [$self get_local_option audioPanel]
795         $audioPanel set_recv_only $v
796         if !$v {
797                 bind all <ButtonPress-3> \
798                                 "if { !\[string match *mbpanel* %W \] && \
799                                 !\[string match *mbv2panel* %W \] } \
800                                 \{ $audioPanel ptt-press \}"
801                 bind all <ButtonRelease-3> \
802                                 "if { !\[string match *mbpanel* %W \] && \
803                                 !\[string match *mbv2panel* %W \] } \
804                                 \{ $audioPanel ptt-release \}"
805         } else {
806                 bind all <ButtonPress-3> ""
807                 bind all <ButtonRelease-3> ""
808         }
809 }
810 
811 
812 CollaboratorUI private enable_mb_hack { } {
813         $self instvar sm_
814         $self tkvar mb_hack_
815         $sm_ enable_mb_cname_hack $mb_hack_
816 }
817 
818 
819 CollaboratorUI public about { } {
820         global mash
821         if [info exists mash(version)] {
822                 set v $mash(version)
823         } else {
824                 set v ?
825         }
826         set text "The Mash Collaborator\
827                         \nMash Version $v\
828                         \nOpen Mash Consortium\
829                         \n\n<http://www.openmash.org/>"
830         set cnt 0
831         while [winfo exists .about$cnt] { incr cnt }
832         set about .about$cnt
833 
834         option add *${about}*background #d9d9d9
835         MessageBox $about -image MashLogoIcon -text $text \
836                         -options { {text.wraplength 0 } } \
837                         -title "About Collaborator..."
838         pack configure [$about subwidget image] -padx 10 -pady 10
839         pack configure [$about subwidget text ] -padx 10 -pady 10
840         pack configure [$about subwidget ok   ] -pady 10
841         $about invoke
842         destroy $about
843 }
844 
845 

~ [ 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.