1 # ui-activesource.tcl --
2 #
3 # An ActiveSource window is created to encapsulate a slow-update
4 # postage-stamp-sized VideoWidget for displaying the video of a source
5 # and some of its statistics once the source is "activated".
6 #
7 # Copyright (c) 1998-2002 The Regents of the University of California.
8 # All rights reserved.
9 #
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions are met:
12 #
13 # A. Redistributions of source code must retain the above copyright notice,
14 # this list of conditions and the following disclaimer.
15 # B. Redistributions in binary form must reproduce the above copyright notice,
16 # this list of conditions and the following disclaimer in the documentation
17 # and/or other materials provided with the distribution.
18 # C. Neither the names of the copyright holders nor the names of its
19 # contributors may be used to endorse or promote products derived from this
20 # software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
23 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
26 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #
33 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/vic/ui-activesource.tcl,v 1.21 2002/08/27 23:27:22 agu Exp $
34
35
36 import InfoWindow RtpStatWindow ErrorWindow ScubaInfoWindow VideoWidget MtraceWindow Configuration VideoBox
37
38 # to get update_rate proc
39 import VicUI
40
41 #
42 # An ActiveSource window is created to encapsulate a slow-update
43 # postage-stamp-sized VideoWidget for displaying the video of a source
44 # and some of its statistics once the source is "activated". The VicUI
45 # lays out these thumbnail-sized windows in grid. Selecting an
46 # ActiveSource's VideoWidget will toggle the mapping of a UserWindow for the
47 # represented source.
48 #
49 Class ActiveSource -superclass TkWindow
50
51 #
52 # Every second, update the elements of the global rate and source
53 # description arrays indexed by the source (instvar src_) of this
54 # ActiveSource.
55 #
56 ActiveSource instproc update {} {
57 $self instvar src_ ui_ id_
58 global ftext
59 if ![info exists ftext($src_)] {
60 return
61 }
62 #FIXME
63 update_rate $src_
64 #FIXME
65 $ui_ trigger_sdes $src_
66
67 set id_ [after 1000 "$self update"]
68 }
69
70
71 ActiveSource instproc name {} {
72 global src_nickname
73 $self instvar src_
74 return $src_nickname($src_)
75 }
76
77 #
78 # For the represented source, delete the VideoWidget and any of the following windows if they exist: <br>
79 # <dd> InfoWindow
80 # <dd> RtpStatWindow displaying rtp statistics
81 # <dd> RtpStatWindow displaying decoder statistics
82 # <dd> ScubaInfoWindow
83 #
84 ActiveSource instproc destroy {} {
85 $self instvar vw_ info_win_ rtp_win_ decoder_win_ scuba_win_
86 $self instvar thumbnail_ id_ muteid_ remove_
87 if [info exists vw_] {
88 $vw_ destroy
89 }
90 if [info exists thumbnail_] {
91 $thumbnail_ destroy
92 }
93 if [info exists info_win_] {
94 delete $info_win_
95 }
96 if [info exists rtp_win_] {
97 delete $rtp_win_
98 }
99 if [info exists decoder_win_] {
100 delete $decoder_win_
101 }
102 if [info exists scuba_win_] {
103 delete $scuba_win_
104 }
105 after cancel $id_
106 if [info exists muteid_] {
107 after cancel $muteid_
108 }
109 if [info exists remove_] {
110 after cancel $remove_
111 }
112 $self next
113 }
114
115 #
116 # If an InfoWindow exists for this source, delete it. Else, create one.
117 #
118 ActiveSource instproc create-info-window {} {
119 $self instvar src_ info_win_
120 if [info exists info_win_] {
121 $self delete-info-window
122 } else {
123 set info_win_ [new InfoWindow .info$src_ $src_ $self]
124 }
125 }
126
127 #
128 # Delete the InfoWindow for this source.
129 #
130 ActiveSource instproc delete-info-window {} {
131 $self instvar info_win_
132 delete $info_win_
133 unset info_win_
134 }
135
136 #
137 # For the represented source, return a string
138 # describing its network statistics.
139 #
140 ActiveSource instproc stats {} {
141 $self instvar src_
142 return "Kilobits [expr [$src_ layer-stat nb_] >> (10-3)] \
143 Frames [$src_ layer-stat nf_] \
144 Packets [$src_ layer-stat np_] \
145 Missing [$src_ missing] \
146 Misordered [$src_ layer-stat nm_] \
147 Runts [$src_ layer-stat nrunt_] \
148 Dups [$src_ layer-stat ndup_] \
149 Bad-S-Len [$src_ set badsesslen_] \
150 Bad-S-Ver [$src_ set badsessver_] \
151 Bad-S-Opt [$src_ set badsessopt_] \
152 Bad-Sdes [$src_ set badsdes_] \
153 Bad-Bye [$src_ set badbye_]"
154 }
155
156 #
157 # For the represented source, return the decoder statistics.
158 #
159 ActiveSource instproc decoder-stats {} {
160 $self instvar src_
161 set d [$src_ handler]
162 #FIXME
163 return [$d stats]
164 }
165
166 #
167 # If a window exists for displaying the RTP Statistics of this source, delete it. Else, create one.
168 #
169 ActiveSource instproc create-rtp-window {} {
170 $self instvar src_ rtp_win_
171 if [info exists rtp_win_] {
172 $self delete-rtp-window
173 } else {
174 set rtp_win_ [new RtpStatWindow .rtp$src_ $src_ \
175 "RTP Statistics" \
176 "$self stats" \
177 "$self delete-rtp-window"]
178 }
179 }
180
181 #
182 # Delete the RTP Statisctics window for this source.
183 #
184 ActiveSource instproc delete-rtp-window {} {
185 $self instvar rtp_win_
186 delete $rtp_win_
187 unset rtp_win_
188 }
189
190 #
191 # If a window exists for displaying the Decoder Statistics of this source, delete it. Else, create one.
192 #
193 ActiveSource instproc create-decoder-window {} {
194 $self instvar src_ decoder_win_
195 if [info exists decoder_win_] {
196 $self delete-decoder-window
197 } else {
198 if { "[$src_ handler]" == "" } {
199 new ErrorWindow "no decoder stats yet"
200 return
201 }
202 set decoder_win_ [new RtpStatWindow .decoder$src_ $src_ \
203 "Decoder Statistics" \
204 "$self decoder-stats" \
205 "$self delete-decoder-window"]
206 }
207 }
208
209 #
210 # Delete the Decoder Statisctics window for this source.
211 #
212 ActiveSource instproc delete-decoder-window {} {
213 $self instvar decoder_win_
214 if [info exists decoder_win_] {
215 delete $decoder_win_
216 unset decoder_win_
217 }
218 }
219
220 #
221 # Create a menu for accessing information and data associated with the represented source: <br>
222 # <dd> "Site Info"
223 # <dd> "RTP Stats"
224 # <dd> "Decoder Stats"
225 # <dd> "Mtrace from"
226 # <dd> "Mtrace to"
227 # <dd> and possibly "Scuba Info"
228 #
229 ActiveSource instproc build_info_menu {src m} {
230 menu $m
231 set f [$self get_option smallfont]
232 $m add command -label "Site Info" \
233 -command "$self create-info-window" -font $f
234 $m add command -label "RTP Stats"\
235 -command "$self create-rtp-window" -font $f
236 $m add command -label "Decoder Stats" \
237 -command "$self create-decoder-window" -font $f
238 $self instvar ui_
239 if [in_multicast [[$ui_ set videoAgent_] session-addr]] {
240 $m add command -label "Mtrace from" \
241 -command "$self create-mtrace-window from" -font $f
242 $m add command -label "Mtrace to" \
243 -command "$self create-mtrace-window to" -font $f
244 }
245 $ui_ instvar scuba_sess_
246 if [info exists scuba_sess_] {
247 $m add command -label "Scuba Info" -font $f \
248 -command "$self create-scuba-window"
249 }
250 }
251
252 #
253 # If a window exists for displaying the Scuba Votes for this source, delete it. Else, create one.
254 #
255 ActiveSource instproc create-scuba-window {} {
256 $self instvar scuba_win_ ui_ src_
257 $ui_ instvar scuba_sess_
258 if [info exists scuba_win_] {
259 $self delete-scuba-window
260 } else {
261 set scuba_win_ [new ScubaInfoWindow .scubainfo$self \
262 $src_ $self $scuba_sess_]
263 [$scuba_sess_ source-manager] attach $scuba_win_
264 $scuba_win_ timeout
265 }
266 }
267
268 #
269 # Delete the Scuba Votes window for this source.
270 #
271 ActiveSource instproc delete-scuba-window {} {
272 $self instvar scuba_win_ ui_
273 $ui_ instvar scuba_sess_
274 [$scuba_sess_ source-manager] detach $scuba_win_
275 delete $scuba_win_
276 unset scuba_win_
277 }
278
279 #
280 # Create a UserWindow for this ActiveSource. Returns the UserWindow.
281 #
282 ActiveSource private create_user_window {{x false} {y false} {showMenus true} {scale 1}} {
283 $self instvar asm_ localChannel_
284
285 # If scale is 0, don't create this window.
286 if {!$scale} {
287 return ""
288 }
289
290 set uw [new UserWindow $asm_ $self [$self yesno useCues] $localChannel_ {} $showMenus]
291 if {$x != "false" && $y != "false"} {
292 wm geometry [$uw path] "+$x+$y"
293 }
294 $uw resize-zoom $scale
295 return $uw
296 }
297
298 #
299 # For implementing drag-and-drop feature so that thumbnail can be
300 # dragged onto a VideoBox and cause the Source displayed to switch to
301 # that displayed by the thumbnail.
302 #
303 ActiveSource private select-thumbnail-to-drag {} {
304 $self instvar draggableToplevel_
305 raise $draggableToplevel_
306 puts stderr "selecting ActiveSource = $self"
307 }
308
309 #
310 # For implementing drag-and-drop feature so that thumbnail can be
311 # dragged onto a VideoBox and cause the Source displayed to switch to
312 # that displayed by the thumbnail.
313 #
314 ActiveSource private move-thumbnail {} {
315 $self instvar draggableToplevel_
316 set x [winfo pointerx $draggableToplevel_]
317 set y [winfo pointery $draggableToplevel_]
318 puts "moving +$x+$y"
319 raise $draggableToplevel_
320 wm geometry $draggableToplevel_ +$x+$y
321 wm deiconify $draggableToplevel_
322 update idletasks
323 }
324
325 #
326 # For implementing drag-and-drop feature so that thumbnail can be
327 # dragged onto a VideoBox and cause the Source displayed to switch to
328 # that displayed by the thumbnail.
329 #
330 ActiveSource private release-thumbnail {} {
331 $self instvar draggableToplevel_
332 set x [expr [expr [winfo width $draggableToplevel_] / 2] + [winfo rootx $draggableToplevel_]]
333 set y [expr [expr [winfo height $draggableToplevel_] / 2] + [winfo rooty $draggableToplevel_]]
334 wm withdraw $draggableToplevel_
335 puts "dropped off at [winfo containing $x $y]"
336 puts "Have vbm go thru vb's and find the one w/ the matching widgetpath & put the selected ActiveSource in there"
337 # once find vb
338 # $vidbox unset_manager_switched
339 # $vidbox switch $src
340 }
341
342 #
343 # Given widget, <i>w</i>, a frame ($w.stamp) is created and packed.
344 # Within this frame, an "is_slow" postage-stamp sized (80x60)
345 # VideoWidget (instvar vw_) is created. A decoder is attached to this
346 # VideoWidget for the specified <i>src</i>.
347 # This ActiveSource is added to the provided ActiveSourceManager, <i>asm</i>.
348 # <p>
349 # The <i>ui</i> must implement the <i>trigger_sdes</i> method
350 # and must have instvars <i>videoAgent_</i> and <i>vframe_</i> and optionally
351 # <i>scuba_sess_</i>.
352 #
353 ActiveSource instproc init { asm ui w src localChannel } {
354 $self next $w
355 # must add src to active_ list before actually making the new ActiveSource
356 # because the videobox created in the ActiveSource init method needs the
357 # src/as mapping.
358 $asm add_active $self $src
359 frame $w -relief groove -borderwidth 0 \
360 -visual [Application set visual_] \
361 -colormap [Application set colormap_]
362 $self instvar src_ ui_ thumbnail_ userwindows_ videoboxes_ asm_ localChannel_
363 $self instvar id_ hidden_
364 set hidden_ 0
365 set src_ $src
366 set ui_ $ui
367 set userwindows_ ""
368 set videoboxes_ ""
369 set asm_ $asm
370 set localChannel_ $localChannel
371 #FIXME: set this activesource as a instvar in handler so we can call \
372 #methods in activesource.
373 [$src_ handler] set as_ $self
374
375 #FIXME: this calls a function in decoder.cc. Find a better way to do this
376 [$src_ handler] suppress [$self get_option suppress]
377 set id_ [after 1000 "$self update"]
378 set stamp $w.stamp
379 frame $stamp -relief ridge -borderwidth 2
380 bind $stamp <Enter> "%W configure -background gray90"
381 bind $stamp <Leave> "%W configure -background \
382 [$self get_option background]"
383
384 # FIXME this is a temporary hack while cindy works on the VideoBox class... trying it out in mui
385 # before using in vic
386 if {[$ui_ info class] != "MuiUI"} {
387 set video_widget_path $stamp.video
388 set thumbnail_ [new VideoWidget $video_widget_path 80 60]
389 $thumbnail_ set is_slow_ 1
390 $self attach-thumbnail
391 pack $stamp.video -side left -anchor c -padx 2
392 pack $stamp -side left -fill y
393 bind $video_widget_path <ButtonPress-1> "$self select-thumbnail"
394
395 frame $w.r
396 $self display_cw $w.r
397 $self display_ctrl $w.r
398 pack $w.r -side left -expand 1 -fill x
399 } else {
400 set vb [VideoBox $stamp.video -size thumbnail -border false -nametag true -ui $ui_ -updateSpeed slow -src $src_]
401 pack $stamp.video -side left -anchor c -padx 0
402 pack $stamp -side top -fill y
403 set thumbnail_ [$vb get_video_widget]
404 set video_widget_path [$vb get_video_widget_path]
405 bind $video_widget_path <ButtonPress-2> "$self select-thumbnail"
406
407 # Setting up drag-and-drop feature for selecting which Source is displayed in the large VideoBoxes
408 $self instvar draggableToplevel_
409 set draggableToplevel_ .$self
410 toplevel $draggableToplevel_
411 # prevent title bar and border from being drawn around this window
412 wm overrideredirect $draggableToplevel_ 1
413 VideoBox $draggableToplevel_.vb -size thumbnail -border false -nametag true -ui $ui_ -updateSpeed slow -src $src_
414 pack $draggableToplevel_.vb
415 wm withdraw $draggableToplevel_
416
417 bind $video_widget_path <ButtonPress-1> "$self select-thumbnail-to-drag"
418 bind $video_widget_path <B1-Motion> "$self move-thumbnail"
419 bind $video_widget_path <ButtonRelease-1> "$self release-thumbnail"
420 }
421
422 bind $video_widget_path <Enter> { focus %W }
423 bind $video_widget_path <d> "$src deactivate"
424
425 update idletasks
426 }
427
428 #
429 # Display a small panel of network statistics for this ActiveSource
430 # within the widget <i>w</i>.
431 #
432 ActiveSource public display_cw { w } {
433 $self instvar src_
434
435 set f [$self get_option smallfont]
436
437 frame $w.cw -relief groove -borderwidth 2
438
439 pack $w.cw -side left -expand 1 -fill both -anchor w -padx 0
440
441 label $w.cw.name -textvariable src_nickname($src_) -font $f \
442 -pady 1 -borderwidth 0 -anchor w
443 label $w.cw.addr -textvariable src_info($src_) -font $f \
444 -pady 1 -borderwidth 0 -anchor w
445
446 global ftext btext ltext
447 set ftext($src_) "0.0 f/s"
448 set btext($src_) "0.0 kb/s"
449 set ltext($src_) "(0%)"
450 frame $w.cw.rateinfo
451 label $w.cw.rateinfo.fps -textvariable ftext($src_) -width 6 \
452 -font $f -pady 0 -borderwidth 0
453 label $w.cw.rateinfo.bps -textvariable btext($src_) -width 8 \
454 -font $f -pady 0 -borderwidth 0
455 label $w.cw.rateinfo.loss -textvariable ltext($src_) -width 6 \
456 -font $f -pady 0 -borderwidth 0
457
458
459 pack $w.cw.rateinfo.fps $w.cw.rateinfo.bps $w.cw.rateinfo.loss \
460 -side left -anchor w
461 pack $w.cw.name $w.cw.addr $w.cw.rateinfo -anchor w -fill x
462
463 pack $w.cw -fill x -side top
464 }
465
466 #
467 # Display a mute button, a color button, and an info menu for this
468 # ActiveSource within the widget <i>w</i>.
469 #
470 ActiveSource public display_ctrl { w } {
471 $self instvar src_ ui_
472 set f [$self get_option smallfont]
473
474 frame $w.ctrl -borderwidth 0
475
476 global mutebutton
477 set mutebutton($src_) [$ui_ mute_new_sources]
478 $src_ mute $mutebutton($src_)
479 checkbutton $w.ctrl.mute -text mute -borderwidth 2 \
480 -highlightthickness 1 \
481 -relief groove -font $f -width 4 \
482 -command "$src_ mute \$mutebutton($src_)" \
483 -variable mutebutton($src_)
484
485 checkbutton $w.ctrl.color -text color -borderwidth 2 \
486 -highlightthickness 1 \
487 -relief groove -font $f -width 4 \
488 -command "\[$src_ handler\] color \$colorbutton($src_)" \
489 -variable colorbutton($src_)
490
491 set m $w.ctrl.info.menu$src_
492 menubutton $w.ctrl.info -text info... -borderwidth 2 \
493 -highlightthickness 1 \
494 -relief groove -font $f -width 5 \
495 -menu $m
496 $self build_info_menu $src_ $m
497
498 pack $w.ctrl.mute -side left -fill x -expand 1
499 pack $w.ctrl.color -side left -fill x -expand 1
500 pack $w.ctrl.info -side left -fill both -expand 1
501 # pack $w.ctrl.options -side left -fill x -expand 1
502
503 global colorbutton
504 set colorbutton($src_) 1
505
506 pack $w.ctrl -fill x -side top
507 }
508
509 #
510 # Returns true if the represented source is h261 format.
511 #
512 ActiveSource instproc isCIF {} {
513 $self instvar src_
514 return [expr [string compare [$src_ format_name] h261] == 0]
515 }
516
517 #
518 # Bind a source to a window so that the video stream from the
519 # represented source appears in UserWindow <i>uw</i>.
520 #
521 ActiveSource instproc attach-window uw {
522 $self instvar src_ ui_
523 [$uw video-widget] attach-decoder $src_ [[$ui_ set vframe_] set colorModel_] [$ui_ use_hw_decode] [$uw use_heuristics]
524 $self instvar userwindows_
525 lappend userwindows_ $uw
526 $uw set-name [$src_ getid]
527
528 $ui_ instvar scuba_sess_
529 if [info exists scuba_sess_] {
530 $scuba_sess_ scuba_focus $src_
531 }
532 }
533
534 #
535 # Bind a source to a window so that the video stream from the
536 # represented source appears in VideoBox <i>vb</i>.
537 #
538 ActiveSource instproc attach_videobox { vb } {
539 $self instvar src_ ui_ vb_
540 #vbx puts "$self attach_videobox $vb"
541 set vb_ $vb
542
543 [$vb get_video_widget] attach-decoder $src_ [[$ui_ set vframe_] set colorModel_] [$ui_ use_hw_decode]
544
545 $self instvar videoboxes_
546 lappend videoboxes_ $vb
547
548 #vbx $uw set-name [$src_ getid]
549
550 $ui_ instvar scuba_sess_
551 if [info exists scuba_sess_] {
552 $scuba_sess_ scuba_focus $src_
553 }
554 }
555
556 #
557 # Return a list of UserWindows to which this ActiveSource is attached.
558 #
559 ActiveSource instproc user-windows {} {
560 return [$self set userwindows_]
561 }
562
563 #
564 # Return a list of VideoBoxes to which this ActiveSource is attached.
565 #
566 ActiveSource instproc video_boxes {} {
567 return [$self set videoboxes_]
568 }
569
570 #
571 # Return the Source attached to this ActiveSource.
572 #
573 ActiveSource instproc source {} {
574 return [$self set src_]
575 }
576
577 #
578 # Discontinue the representation of this ActiveSource in UserWindow <i>uw</i>.
579 #
580 ActiveSource instproc detach-window uw {
581 $self instvar userwindows_ src_ ui_
582 $ui_ instvar scuba_sess_
583 if [info exists scuba_sess_] {
584 $scuba_sess_ scuba_unfocus $src_
585 }
586 [$uw video-widget] detach-decoder $src_
587 # there must be an easier way to do this
588 set k [lsearch -exact $userwindows_ $uw]
589 if { $k < 0 } {
590 puts "[$self get_option appname]: detach-window: FIXME"
591 exit 1
592 }
593 set userwindows_ [lreplace $userwindows_ $k $k]
594 }
595
596 #
597 # Discontinue the representation of this ActiveSource in VideoBox <i>vb</i>.
598 #
599 ActiveSource instproc detach_videobox vb {
600 $self instvar videoboxes_ src_ ui_
601 $ui_ instvar scuba_sess_
602 if [info exists scuba_sess_] {
603 $scuba_sess_ scuba_unfocus $src_
604 }
605 [$vb get_video_widget] detach-decoder $src_
606 # there must be an easier way to do this
607 set k [lsearch -exact $videoboxes_ $vb]
608 if { $k < 0 } {
609 puts "[$self get_option appname]: detach-window: FIXME"
610 exit 1
611 }
612 set videoboxes_ [lreplace $videoboxes_ $k $k]
613 }
614
615 #
616 # Discontinue the representation of this ActiveSource in all of the
617 # UserWindows to which it is currently attached.
618 #
619 ActiveSource instproc detach-windows {} {
620 $self instvar userwindows_
621 foreach uw $userwindows_ {
622 $self detach-window $uw
623 }
624 $self detach-thumbnail
625 }
626
627 #
628 # Discontinue the representation of this ActiveSource in all of the
629 # VideoBoxes to which it is currently attached.
630 #
631 ActiveSource instproc detach_videoboxes {} {
632 $self instvar videoboxes_
633 foreach vb $videoboxes_ {
634 $self detach_videobox $vb
635 }
636 }
637
638 #
639 ActiveSource instproc attach-thumbnail {} {
640 #mjh
641 $self instvar asm_ src_ ui_ thumbnail_
642 $thumbnail_ attach-decoder $src_ [[$ui_ set vframe_] set colorModel_] [$ui_ use_hw_decode]
643 }
644
645 #
646 ActiveSource instproc detach-thumbnail {} {
647 #mjh
648 $self instvar src_ thumbnail_
649 $thumbnail_ detach-decoder $src_
650 }
651
652 #
653 # If a window does not exist for displaying the MTrace info for this source, create one.
654 #
655 ActiveSource instproc create-mtrace-window {dir} {
656 $self instvar mtrace_win_ src_
657 set w .mtrace$src_
658 if ![winfo exists $w] {
659 set mtrace_win_ [new MtraceWindow $w $src_ $self]
660 }
661 $mtrace_win_ do_mtrace
662 }
663
664 #
665 # Called when user clicks on thumbnail video window.
666 # Create a new window only if the window already
667 # isn't being displayed (in locked mode). In this
668 # case, delete the existing window (i.e., clicking
669 # on the thumbnail gives a toggle action, but not
670 # for voice-switched or browse-mode windows).
671 # Return the new UserWindow.
672 #
673 ActiveSource public select-thumbnail {} {
674 foreach uw [$self user-windows] {
675 if { [$uw attached-source] == "$self" && ![$uw is-switched] } {
676 $uw destroy
677 return
678 }
679 }
680 #FIXME a little weird
681 $self instvar ui_
682 return [$self create_user_window]
683 }
684
685 #
686 # Called to place a new window only if the window
687 # isn't already being displayed. If it is, don't
688 # do anything. Return the new UserWindow.
689 #
690 ActiveSource public place {x y {scale 1}} {
691 foreach uw [$self user-windows] {
692 if {[$uw attached-source] == "$self"} {
693 return
694 }
695 }
696 #FIXME a little weird: apparently ui_ needs to exist otherwise
697 # you can't destroy the UserWindow by clicking on the thumbnail.
698 $self instvar ui_
699 return [$self create_user_window $x $y false $scale]
700 }
701
702 ActiveSource instproc mute-hide { } {
703 $self instvar src_ asm_ hidden_ muteid_ remove_
704 $src_ mute 1
705 if !$hidden_ {
706 set hidden_ 1
707 set remove_ [after 2000 "$self remove"]
708 }
709 set muteid_ [after 5000 "$self unmute"]
710 }
711
712 ActiveSource instproc unhide { } {
713 $self instvar src_ asm_ hidden_
714 if $hidden_ {
715 set hidden_ 0
716 $asm_ redecorate
717 }
718 }
719
720
721 # FIX ME. Doing this so that we can remove multiple thumbnails
722 # It is a problem in windows when redecorate removes the thumbnails
723 ActiveSource instproc remove { } {
724 $self instvar asm_
725 $asm_ redecorate
726 }
727
728 ActiveSource instproc unmute { } {
729 $self instvar src_
730 $src_ mute 0
731 }
732
733
734
735
736
737
738
739
740
741
742
743
744
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.