1 # ui-dcthumbnailservice.tcl --
2 #
3 # Stuff for what to do when a service is activated from the thumbnail
4 # pane.
5 #
6 # Copyright (c) 2000-2002 The Regents of the University of California.
7 # All rights reserved.
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions are met:
11 #
12 # A. Redistributions of source code must retain the above copyright notice,
13 # this list of conditions and the following disclaimer.
14 # B. Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
17 # C. Neither the names of the copyright holders nor the names of its
18 # contributors may be used to endorse or promote products derived from this
19 # software without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
25 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 Class CDcUIThumbnail/Service -superclass CDcUIThumbnail
33
34 ##############################################################################
35 #
36 # CDcUIThumbnail/Service public init { appDc uiMain winFrame } {
37 #
38 # Input:
39 # appDc - the dc application
40 # uiMain - the main ui object; in this case CDcUI
41 # winFrame - the frame in which to put everything into
42 #
43 # Output:
44 # none
45 #
46 # Description:
47 # construstor
48 # this object represents to thumbnail which will reside on the bottom half
49 # of the list of thumbnail. I represents a none video Thumbnail and if
50 # clicked on will pop a window that will give controls to some service
51 #
52 ##############################################################################
53 CDcUIThumbnail/Service public init { appDc uiMain winFrame } {
54 $self next $appDc $uiMain $winFrame
55
56 $self instvar m_service
57
58 # intialize some variables
59 set m_service 0
60 }
61
62 ##############################################################################
63 #
64 # CDcUIThumbnail/Service public SynServiceImage { service } {
65 #
66 # Input:
67 # service - the service object to start
68 #
69 # Output:
70 # none
71 #
72 # Description:
73 # preliminarily called by CDcUIThumbnailFrame object, it will start the
74 # service. In other words, call the service to start what ever it needs
75 # to do.
76 #
77 ##############################################################################
78 CDcUIThumbnail/Service public StartService { service } {
79 $self instvar m_service
80
81 set m_service $service
82
83 # I need to figure out how to represent this service
84 # it can be as simple as a text that has the name of the service
85 # or I can envision an animated gif
86
87 # map the necessary messages
88 $m_service MapMessage "SYN_SERVICE_IMAGE" $self "SynServiceImage"
89 $m_service MapMessage "GET_UI_WINDOW" $self "BuildWindow"
90
91 # send the request to start
92 $m_service Send "SYN_SERVICE_IMAGE" ""
93 }
94
95
96 ##############################################################################
97 #
98 # CDcUIThumbnail/Service public SynServiceImage { service arguments } {
99 #
100 # Input:
101 # service - the service that called this function
102 # arguments - the arguments that go along with this function call
103 #
104 # Output:
105 # none
106 #
107 # Description:
108 # A callback function. It will essentially be called by the remote service.
109 # The main functionality is to set up the thumbnail image that represents
110 # this service object.
111 #
112 # The protocal will be as follow, the first word is the type of the image
113 # and if followed by other information depending on the type: ie. text Title
114 #
115 ##############################################################################
116 CDcUIThumbnail/Service public SynServiceImage { service arguments } {
117 $self instvar m_winFrame
118 $self instvar m_service
119
120 set type [lindex $arguments 0]
121 set font [[$self options] get_option smallfont]
122
123 switch -exact -- $type {
124 text {
125 set frameButton [button $m_winFrame.thumbnail \
126 -text [lindex $arguments 1] \
127 -font $font \
128 -command "$self BuildWindow $m_service 0"]
129 pack $frameButton -side top -fill x
130 }
131 }
132 }
133
134 ##############################################################################
135 #
136 # CDcUIThumbnail/Service public BuildWindow { service arguments}
137 #
138 # Input:
139 # service - the service object that called this function
140 # arguments - the arguments that come with the function call
141 #
142 # Output:
143 # none
144 #
145 # Description:
146 # Called by the remote service to build up the window for there service
147 #
148 ##############################################################################
149 CDcUIThumbnail/Service public BuildWindow { service arguments} {
150 $self instvar m_service
151 $self instvar m_winFrame
152
153
154 # first check arguments is 0
155 if { $arguments == 0 } {
156 $m_service Send "GET_UI_WINDOW" ""
157 return
158 }
159
160 # ok now have the instructions for the window
161 # delete the existing window if there is one
162
163 # replace all .'s with _'s to I can have a unique top window name
164 regsub -all -- {\.} $m_winFrame {_} winFrame
165
166 if { [winfo exists $winFrame]} {
167 destroy $winFrame
168 }
169
170 set winFrame [toplevel .$winFrame]
171 set service $m_service
172 eval $arguments
173 }
174
175
176
177 Class CDcUIThumbnail/Service/Replay -superclass CDcUIThumbnail/Service
178
179 CDcUIThumbnail/Service/Replay public init { appDc uiMain winFrame } {
180 $self next $appDc $uiMain $winFrame
181 }
182
183 CDcUIThumbnail/Service/Replay public StartService { service } {
184 $self next $service
185 }
186
187 ##############################################################################
188 #
189 # CDcUIThumbnail/Service/Replay public BuildWindow { service arguments}
190 #
191 # Input:
192 # service - the service object that called this function
193 # arguments - the arguments that come with the function call
194 #
195 # Output:
196 # none
197 #
198 # Description:
199 # Called by the remote service to build up the window for there service
200 #
201 ##############################################################################
202 CDcUIThumbnail/Service/Replay public BuildWindow { service arguments} {
203 $self instvar m_service
204 $self instvar m_winFrame
205
206 # first check arguments is 0
207 if { $arguments == 0 } {
208 $m_service Send "GET_UI_WINDOW" ""
209 return
210 }
211
212 # ok now have the instructions for the window
213 # delete the existing window if there is one
214
215 # replace all .'s with _'s to I can have a unique top window name
216 regsub -all -- {\.} $m_winFrame {_} winFrame
217
218 if { [winfo exists .$winFrame] } {
219 destroy .$winFrame
220 }
221
222 set winFrame [toplevel .$winFrame]
223 set service $m_service
224 eval $arguments
225 }
226
227
228
229 Class CDcUIThumbnail/Service/SpecialFx -superclass CDcUIThumbnail/Service
230
231 CDcUIThumbnail/Service/SpecialFx public init { appDc uiMain winFrame } {
232 $self next $appDc $uiMain $winFrame
233 }
234
235 CDcUIThumbnail/Service/SpecialFx public StartService { service } {
236 $self next $service
237 }
238
239 ##############################################################################
240 #
241 # CDcUIThumbnail/Service/SpecialFx public BuildWindow { service arguments}
242 #
243 # Input:
244 # service - the service object that called this function
245 # arguments - the arguments that come with the function call
246 #
247 # Output:
248 # none
249 #
250 # Description:
251 # Called by the remote service to build up the window for there service
252 #
253 ##############################################################################
254 CDcUIThumbnail/Service/SpecialFx public BuildWindow { service arguments} {
255 $self instvar m_uiMain
256 $self instvar m_service
257 $self instvar m_winFrame
258
259 # first check arguments is 0
260 if { $arguments == 0 } {
261 $m_service Send "GET_UI_WINDOW" ""
262 return
263 }
264
265 # get the list of source id's
266 set uiThumbnailFrame [$m_uiMain set m_uiThumbnailFrame]
267 set liSourceId [$uiThumbnailFrame GetSourceIDs]
268
269 # ok now have the instructions for the window
270 # delete the existing window if there is one
271
272 # replace all .'s with _'s to I can have a unique top window name
273 regsub -all -- {\.} $m_winFrame {_} winFrame
274
275 if { [winfo exists .$winFrame] } {
276 destroy .$winFrame
277 }
278
279 puts "length of liSourceID is [llength $liSourceId] \n"
280 set winFrame [toplevel .$winFrame]
281 set service $m_service
282 eval $arguments
283 }
284
285
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.