1 # ui-Redirector.tcl --
2 #
3 # Code for creating the UI for the Redirector.
4 #
5 # This file has the main ui component of the tgw application. Also, it contains
6 # many of the slightly modified superclasses to make things work... This is the
7 # main file with all the code in it.
8 #
9 # Copyright (c) 2000-2002 The Regents of the University of California.
10 # All rights reserved.
11 #
12 # Redistribution and use in source and binary forms, with or without
13 # modification, are permitted provided that the following conditions are met:
14 #
15 # A. Redistributions of source code must retain the above copyright notice,
16 # this list of conditions and the following disclaimer.
17 # B. Redistributions in binary form must reproduce the above copyright notice,
18 # this list of conditions and the following disclaimer in the documentation
19 # and/or other materials provided with the distribution.
20 # C. Neither the names of the copyright holders nor the names of its
21 # contributors may be used to endorse or promote products derived from this
22 # software without specific prior written permission.
23 #
24 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
25 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
28 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35 import TopLevelWindow OutgoingSession
36
37 Class RedirUI -superclass TopLevelWindow -configuration { }
38
39 RedirUI instproc init { mainUI } {
40 $self next .redirUI
41 $self instvar ui_
42 set ui_ $mainUI
43 }
44
45 RedirUI instproc build w {
46 $self instvar ui_
47 $self create-window $w "Redirection Info"
48 wm withdraw $w
49
50 global forwardVideo forwardAudio inputtedVideoDestAddr inputtedAudioSourceAddr inputtedAudioDestAddr
51
52 frame $w.top
53 checkbutton $w.top.sendVideo -text "Redirect Video" -variable forwardVideo
54 grid $w.top.sendVideo
55 label $w.top.videoDestLabel -anchor c -text "Destination Addr:"
56 entry $w.top.videoDest -textvariable inputtedVideoDestAddr -relief sunken
57 grid $w.top.videoDestLabel $w.top.videoDest -stick news
58 # frame $w.middle
59 # checkbutton $w.middle.sendAudio -text "Redirect Audio" -variable forwardAudio
60 # grid $w.middle.sendAudio
61 # label $w.middle.audioSourceLabel -anchor c -text "Source Addr:"
62 # entry $w.middle.audioSource -textvariable inputtedAudioSourceAddr -relief sunken
63 # grid $w.middle.audioSourceLabel $w.middle.audioSource -stick news
64 # label $w.middle.audioDestLabel -anchor c -text "Destination Addr:"
65 # entry $w.middle.audioDest -textvariable inputtedAudioDestAddr -relief sunken
66 # grid $w.middle.audioDestLabel $w.middle.audioDest -stick news
67 frame $w.bottom
68 button $w.bottom.ok -text "OK" -relief raised \
69 -font [$self get_option smallfont] -highlightthickness 1 \
70 -command "$self callNewRedirector"
71 button $w.bottom.cancel -text "Cancel" -relief raised \
72 -font [$self get_option smallfont] -highlightthickness 1 \
73 -command "$self toggle"
74 grid $w.bottom.ok $w.bottom.cancel -stick news
75 # pack $w.top $w.middle $w.bottom
76 pack $w.top $w.bottom
77 }
78
79 RedirUI instproc toggle { } {
80 global forwardVideo forwardAudio inputtedVideoDestAddr inputtedAudioSourceAddr inputtedAudioDestAddr
81 set forwardVideo 0
82 set forwardAudio 0
83 set inputtedVideoDestAddr ""
84 set inputtedAudioSourceAddr ""
85 set inputtedAudioDestAddr ""
86 $self next
87 }
88
89 RedirUI instproc callNewRedirector { } {
90 $self instvar ui_
91 global forwardVideo forwardAudio inputtedVideoDestAddr inputtedAudioSourceAddr inputtedAudioDestAddr
92 $ui_ newRedirSession $forwardVideo $forwardAudio $inputtedVideoDestAddr $inputtedAudioSourceAddr $inputtedAudioDestAddr
93 $self toggle
94 }
95
96 Class OutgoingRedir -superclass OutgoingSession
97
98 OutgoingRedir instproc init { fwVid fwAud vidRedir vidDest audRedir audDest } {
99 $self instvar fwVid_ fwAud_ vidRedir_ vidDest_ audRedir_ audDest_
100 $self setFormat "Redirection"
101 set fwVid_ $fwVid
102 set fwAud_ $fwAud
103 set vidRedir_ $vidRedir
104 set vidDest_ $vidDest
105 set audRedir_ $audRedir
106 set audDest_ $audDest
107 }
108
109 OutgoingRedir instproc makeUI { w ui src rownum } {
110 $self instvar fwVid_ fwAud_ vidDest_ audDest_ vidRedir_ audRedir_
111 new OutgoingRedirTransmitBox $w $src $fwVid_ $fwAud_ $vidDest_ $audDest_ $vidRedir_ $audRedir_
112 }
113
114 Class OutgoingRedirTransmitBox
115
116 OutgoingRedirTransmitBox instproc init { w src fwVid fwAud vidDest audDest vidRedir audRedir } {
117 $self instvar w_ src_ fwVid_ fwAud_ vidDest_ audDest_ vidRedir_ audRedir_
118 set w_ $w
119 set src_ $src
120 set fwVid_ $fwVid
121 set fwAud_ $fwAud
122 set vidDest_ $vidDest
123 set audDest_ $audDest
124 set vidRedir_ $vidRedir
125 set audRedir_ $audRedir
126
127 label $w.first -anchor c -text Redirect -font [$self get_option smallfont] -pady 0 -borderwidth 0 -width 25
128 grid $w.first
129 if { $fwVid_ == 1 } {
130 # if { $rownum == 1 } {
131 # set temp "Video to: $vidDest_"
132 # label $w.second -anchor w -text $temp -font [$self get_option smallfont] -pady 0 -borderwidth 0
133 # grid $w.second
134 # }
135
136 frame $w.third
137 button $w.third.start -text Start -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self startRedir"
138 button $w.third.stop -text Stop -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self stopRedir" -state disabled
139 pack $w.third.start $w.third.stop -side left
140 grid $w.third
141 }
142
143 # if { $fwAud_ == $rownum == 1 } {
144 # set temp "Audio to: $audDest_"
145 # label $w.forth -anchor w -text $temp -font [$self get_option smallfont] -pady 0 -borderwidth 0
146 # grid $w.forth
147
148 # frame $w.fifth
149 # button $w.fifth.start -text Start -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self startAudioRedir"
150 # button $w.fifth.stop -text Stop -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self stopAudioRedir" -state disabled
151 # pack $w.fifth.start $w.fifth.stop -side left
152 # grid $w.fifth
153 # }
154 # pack $w -side left
155 }
156
157 OutgoingRedirTransmitBox instproc startRedir { } {
158 $self instvar w_ vidRedir_ src_
159 $w_.third.start configure -state disabled
160 $w_.third.stop configure -state normal
161 $vidRedir_ add-source [$src_ srcid]
162 }
163
164 OutgoingRedirTransmitBox instproc stopRedir { } {
165 $self instvar w_ vidRedir_ src_
166 $w_.third.stop configure -state disabled
167 $w_.third.start configure -state normal
168 $vidRedir_ remove-source [$src_ srcid]
169 }
170
171 OutgoingRedirTransmitBox instproc startAudioRedir { } {
172 $self instvar w_ audRedir_
173 $w_.fifth.start configure -state disabled
174 $w_.fifth.stop configure -state normal
175 $audRedir_ add-all-sources
176 }
177
178 OutgoingRedirTransmitBox instproc stopAudioRedir { } {
179 $self instvar w_ audRedir_
180 $w_.fifth.stop configure -state disabled
181 $w_.fifth.start configure -state normal
182 $audRedir_ remove-all-sources
183 }
184
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.