1 # ui-mbv2.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-mbv2.tcl,v 1.5 2002/02/03 04:21:46 lim Exp $
32
33
34 #
35 UISource/Mbv2 public build_widget { path } {
36 $self instvar observer_
37 $path configure -command "tk_popup $path.menu \[winfo pointerx $path\]\
38 \[winfo pointery $path\]"
39
40 menu $path.menu
41 $path.menu add radiobutton -label "Track this source" \
42 -variable [$observer_ tkvarname track_] \
43 -value [[$self src] source_id]
44 $path.menu add radiobutton -label "Track any active source" \
45 -variable [$observer_ tkvarname track_] -value any
46 $path.menu add radiobutton -label "Don't track any source" \
47 -variable [$observer_ tkvarname track_] -value {}
48 }
49
50
51 #
52 Observer/Mbv2 public init { sm mbv2ui } {
53 $self next
54 $self set sm_ $sm
55 $self set ui_ $mbv2ui
56
57 $self tkvar track_
58 trace variable track_ w "$self modify_track"
59 set track_ any
60 }
61
62 Observer/Mbv2 public session { s } {
63 $self set mbv2_session_ $s
64 $s attach_observer $self
65 }
66
67
68 Observer/Mbv2 public modify_track { args } {
69 $self tkvar track_
70 $self instvar ui_
71 [$ui_ canvmgr] source_to_follow $track_
72 }
73
74
75 #
76 Observer/Mbv2 private create_multi_source { src name cname } {
77 $self instvar sm_ msrcs_ srcid2src_
78 set srcid2src_([$src source_id]) $src
79 set msrcs_($src) [$sm_ register mbv2 $src $cname $self]
80 set uisrc [$msrcs_($src) get_uisource mbv2 $src]
81 $msrcs_($src) change_name $uisrc $name
82 }
83
84
85 #
86 # Register a src in the src display. This happens for all the
87 # srcs participating in the conferencing (e.g., including
88 # those not actually sending data).
89 #
90 Observer/Mbv2 public source_update { src name cname } {
91 $self instvar srcnames_ msrcs_
92
93 if { $name=={} } {
94 if { $cname=={} } { set name unknown } else { set name $cname }
95 }
96
97 $self instvar msrcs_
98 if ![info exists msrcs_($src)] {
99 $self create_multi_source $src $name $cname
100 } elseif { [$msrcs_($src) name] != $name } {
101 set uisrc [$msrcs_($src) get_uisource mbv2 $src]
102 $msrcs_($src) change_name $uisrc $name
103 }
104 }
105
106
107 #
108 # Remove a src from the src display. This happens when
109 # a party quits or has been dead for a sufficiently long time.
110 # We assume the src has already been deactivated.
111 #
112 Observer/Mbv2 public unregister { src } {
113 }
114
115
116 Observer/Mbv2 public activity { srcid pageid cmdid canvid islocal } {
117 $self instvar activity_ msrcs_ srcid2src_ id_
118
119 if ![info exists srcid2src_($srcid)] return
120 set src $srcid2src_($srcid)
121
122 if [info exists id_($src)] {
123 after cancel $id_($src)
124 } else {
125 set uisrc [$msrcs_($src) get_uisource mbv2 $src]
126 $uisrc highlight 1
127 }
128
129 set id_($src) [after 500 "$self unhilit $src"]
130 }
131
132
133 Observer/Mbv2 public unhilit {src} {
134 $self instvar msrcs_ id_
135 if [info exists msrcs_($src)] {
136 set uisrc [$msrcs_($src) get_uisource mbv2 $src]
137 $uisrc highlight 0
138 }
139 unset id_($src)
140 }
141
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.