1 # fca-uimgr.tcl --
2 #
3 # FIXME: This file needs a description here.
4 #
5 # Copyright (c) 1997-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
32 Class FCA_UIMgr
33
34
35 # the ui-manager should contain a mapping of floor-types to
36 # floor names: floor_types_
37 # also, a mapping of srcId's to cnames: cnames_
38 #
39 # objects:
40 # admittedList_
41 # pendingList_
42 # srcList_
43 #
44 # instvars:
45 # fullRequestInfo_
46
47
48
49 FCA_UIMgr instproc init { path appMgr } {
50 $self next
51 $self instvar ui_ cb_ appMgr_ admittedList_ pendingList_ admittedMenu_ \
52 pendingMenu_
53 if { [$appMgr localIsModerator] } {
54 set ui_ [new FCA_UI/Moderator]
55 } else {
56 set ui_ [new FCA_UI]
57 }
58
59 set cb_ [new FCA_CoordBus $self]
60 set appMgr_ $appMgr
61 $ui_ attach_appmgr $appMgr
62 $ui_ attach_uimgr $self
63 $ui_ build $path
64
65 set admittedList_ [$ui_ admittedList]
66 set pendingList_ [$ui_ pendingList]
67 $self set srcList_ [$ui_ srcList]
68 }
69
70
71 # floor is object of class FCAFloor
72 FCA_UIMgr instproc add_floor { floorType label {icon {}} } {
73 $self instvar ui_
74 $ui_ add_floor $floorType $label $icon
75 }
76
77
78
79 FCA_UIMgr instproc add_admit { request } {
80 $self instvar admittedList_
81 $admittedList_ insert $request {} end
82 }
83
84
85 FCA_UIMgr instproc remove_admit { request } {
86 $self instvar admittedList_
87 $admittedList_ remove $request
88 }
89
90
91 FCA_UIMgr instproc add_pending { request } {
92 $self instvar pendingList_
93 $pendingList_ insert $request {} end
94 }
95
96
97 FCA_UIMgr instproc remove_pending { request } {
98 $self instvar pendingList_
99 $pendingList_ remove $request
100 }
101
102
103
104 FCA_UIMgr instproc new_source { src } {
105 $self instvar srcList_ sources_
106 $srcList_ insert [$src srcid] [$src cname] end
107 set sources_([$src srcid]) $src
108 DbgOut "########### Setting [$src srcid]: sources_([$src srcid])=$sources_([$src srcid])"
109 }
110
111
112 FCA_UIMgr instproc cname_update { src newname } {
113 $self instvar srcList_
114 $srcList_ update [$src srcid] $newname
115 }
116
117
118 FCA_UIMgr instproc cname { srcId } {
119 $self instvar sources_
120 if { [info exists sources_($srcId)] } {
121 return [$sources_($srcId) cname]
122 } else {
123 return ""
124 }
125 }
126
127
128 FCA_UIMgr instproc grant_received { floorType floorInstanceObj } {
129 $self instvar ui_ cb_ appMgr_
130 $ui_ destroy_floorstatus_entry $floorType $floorInstanceObj
131 $ui_ create_floorstatus_entry $floorType $floorInstanceObj
132
133 set srcId [$floorInstanceObj srcId]
134 if { [[$appMgr_ localRcvr] srcId]==$srcId } {
135 set isMe 1
136 } else {
137 set isMe 0
138 }
139
140 DbgOut "Send floor status for '$floorType' '$srcId'"
141 $cb_ send_floor_status [$ui_ get_floor_label $floorType] 0 \
142 [$self cname $srcId] $isMe
143 }
144
145
146 FCA_UIMgr instproc release_received { floorType floorInstance } {
147 $self instvar ui_
148 $ui_ destroy_floorstatus_entry $floorType $floorInstance
149 }
150
151
152
153 FCA_UIMgr instproc make_floor_request { floors comment } {
154 DbgOut "Making floor request for *$floors* ($comment)"
155 $self instvar appMgr_
156 set localRcvr [$appMgr_ localRcvr]
157 $localRcvr sendFloorRequest $floors $comment
158 }
159
160
161 FCA_UIMgr instproc cancel_floor_request { request } {
162 $self instvar appMgr_
163 set localRcvr [$appMgr_ localRcvr]
164 $localRcvr sendFloorCancel $request
165 }
166
167
168 FCA_UIMgr instproc grant_floor { request } {
169 $self instvar appMgr_
170 set localRcvr [$appMgr_ localRcvr]
171 $localRcvr uiGrant $request
172 }
173
174
175 # invoked when the moderator
176 FCA_UIMgr instproc grant_floor_to_participant { floortypes srcId } {
177 $self instvar appMgr_
178 set localRcvr [$appMgr_ localRcvr]
179 $localRcvr uiGrantParticipant $floortypes $srcId
180 }
181
182
183 FCA_UIMgr instproc release_floor { floorType floorInstance } {
184 $self instvar appMgr_
185 set localRcvr [$appMgr_ localRcvr]
186 $localRcvr sendFloorRelease $floorType $floorInstance
187 }
188
189
190 FCA_UIMgr instproc auto_request_floor { floorTypeLabel } {
191 $self instvar ui_ appMgr_
192 set floorType [$ui_ floortype_from_label $floorTypeLabel]
193 if { $floorType=="" } {
194 DbgOut "Could not figure out floor type for '$floorTypeLabel'"
195 return
196 }
197
198 [$appMgr_ localRcvr] auto_request_floor $floorType
199 }
200
201
202
203
204
205
206
207
208
209
210 #FCA_UIMgr instproc build_admittedMenu { } {
211 # $self instvar admittedMenu_
212 # set admittedMenu_ [menu .admittedMenu_$self]
213 # $admittedMenu_ add command -label "Grant floor"
214 # $admittedMenu_ add command -label "Cancel request"
215 #}
216
217
218
219
220 #FCA_UIMgr instproc build_floorholder_frame { parent_path floorInstObj } {
221 # set path $parent_path.instance_$floorInstance
222 # label $path -bg [$parent_path cget -bg] -text \
223 # [$self cname [$floorInstance srcId]]
224 # pack $path -side top
225 #}
226
227
228
229
230
231 #FCA_UIMgr instproc build_request_item { path request } {
232 # frame $path -bd 1
233 # $path configure -bg [[winfo parent $path] cget -bg]
234 #
235 # foreach floorType [$request floorTypes] {
236 # $self build_floortype_label $path.floortype_$floorType $floorType
237 # pack $path.floortype_$floorType -padx 0 -pady 0 -side left
238 # }
239 #
240 # label $path.cname -text [$self cname [$request srcId]] -anchor w
241 # $path.cname configure -bg [[winfo parent $path.cname] cget -bg]
242 # pack $path.cname -side left -anchor w -fill x -expand 1
243 # #set comment [$request comment]
244 #}
245
246
247 #FCA_UIMgr instproc build_floortype_label { path floorType } {
248 # $self instvar floorTypes_
249 # label $path -image $floorTypes_($floorType,icon) -padx 0 -pady 0 -bd 0 \
250 # -highlightthickness 0 -relief flat
251 # $path configure -bg [[winfo parent $path] cget -bg]
252 #}
253
254
255 #set uimgr [new FCA_UIMgr .f]
256 #pack .f -fill both -expand 1
257 #$uimgr add_floor 1 Audio Audio_Icon
258 #$uimgr add_floor 2 Video Video_Icon
259 #$uimgr add_floor 3 Mediaboard Mediaboard_Icon
260
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.