1 # application-specialfxproxy.tcl --
2 #
3 # Created by specialFX app when director activates special FX. Talks
4 # to special FX system and provides UI to the DC video window
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 import Application
33 import SSAC_Client
34 import CServiceManager
35 import CService
36 source [glob ~kpatel/mash-code/mash/tcl/psvp/fx_service/fx_client.tcl]
37
38 Class CSpecialFxProxyApplication -superclass Application
39
40 ##############################################################################
41 #
42 # CSpecialFxProxyApplication instproc InitArgs { options } {
43 #
44 # Input:
45 # options - the options object
46 #
47 # Output:
48 # none
49 #
50 # Description:
51 # Registers all options before the command line argument is parsed
52 #
53 ##############################################################################
54 CSpecialFxProxyApplication instproc InitArgs { options } {
55 $options register_option -ComPort optComPort
56 }
57
58 ##############################################################################
59 #
60 # CSpecialFxProxyApplication instproc InitResources { options } {
61 #
62 # Input:
63 # options - the options object
64 #
65 # Output:
66 # none
67 #
68 # Description:
69 # Gives defaults for options
70 #
71 ##############################################################################
72 CSpecialFxProxyApplication instproc InitResources { options } {
73 $options add_default optComPort 0
74 }
75
76
77 ##############################################################################
78 #
79 # CSpecialFxProxyApplication instproc init { argv } {
80 #
81 # Input:
82 # argv - command line input
83 #
84 # Output:
85 # none
86 #
87 # Description:
88 # Constructor for the object.
89 #
90 ##############################################################################
91 CSpecialFxProxyApplication instproc init { argv } {
92 $self next SpecialFxProxy
93
94 # initialize some variables
95 $self instvar m_inetMStudioAddr
96 $self instvar m_iMStudioPort
97 $self instvar m_inetClientAddr
98 $self instvar m_iClientPort
99
100 $self instvar m_specialFx_name
101 $self instvar m_specialFx_source1
102 $self instvar m_specialFx_source2
103 $self instvar m_specialFx_liSourceId
104 $self instvar m_i1
105 $self instvar m_i2
106 $self instvar m_o1
107 $self instvar m_latency
108 $self instvar m_text
109 $self instvar m_font
110 $self instvar m_point_size
111 $self instvar m_xpos
112 $self instvar m_ypos
113 $self instvar m_text_color
114 $self instvar m_back_color
115 $self instvar m_master_alpha
116 $self instvar m_back_alpha
117 $self instvar m_factor
118 $self instvar m_specialfx_cntrl
119
120
121 puts "got here"
122
123 # Initiailization of options
124 set options [$self options]
125 $self InitArgs $options
126 $self InitResources $options
127 $options load_preferences "SpecialFxProxy"
128 set argv [$options parse_args $argv]
129
130 # parse out the arguments
131 set m_inetMStudioAddr [lindex $argv 0]
132 set m_iMStudioPort [lindex $argv 1]
133
134 set m_inetClientAddr [lindex $argv 2]
135 set m_iClientPort [lindex $argv 3]
136
137 set m_specialFx_name [lindex $argv 4]
138 puts "name is $m_specialFx_name \n"
139
140 set m_specialFx_source1 [lindex $argv 5]
141 puts "source1 is $m_specialFx_source1"
142 set m_specialFx_source2 [lindex $argv 6]
143 puts "source2 is $m_specialFx_source2"
144 set m_specialFx_liSourceId [lindex $argv 7]
145 puts "liSourceId is $m_specialFx_liSourceId"
146
147
148 # setup the service manager stuff
149 $self instvar m_serviceManager
150 $self instvar m_lService
151
152 set iPort [$options get_option optComPort]
153 set m_serviceManager [new CServiceManager "ServiceApp" "SpecialFxProxy" \
154 $iPort]
155 $m_serviceManager Attach $self
156
157 set m_service ""
158
159 flush stdout
160
161 $self StartFx $argv
162 }
163
164
165 ##############################################################################
166 #
167 # CSpecialFxProxyApplication instproc destroy { }
168 #
169 # Input:
170 # none
171 #
172 # Output:
173 # none
174 #
175 # Description:
176 # destructor
177 #
178 ##############################################################################
179 CSpecialFxProxyApplication instproc destroy { } {
180 $self instvar m_timer
181
182 if { m_timer != "" } {
183 after cancel $m_timer
184 }
185 }
186
187
188
189 ##############################################################################
190 #
191 # CSpecialFxProxyApplication instproc NewConnection { service }
192 #
193 # Input:
194 # service - the new service that got connected
195 #
196 # Output:
197 # 1 - if handling this service
198 # 0 - otherwise
199 #
200 # Description:
201 # A call back function for the service manager. This function will be called
202 # when a new connection has just been noticed by the service manager
203 #
204 ##############################################################################
205 CSpecialFxProxyApplication instproc NewConnection { service } {
206 # this member should never be called.
207 puts "Replay Proxy got a new connection: exiting"
208 exit
209
210 return 0
211 }
212
213
214 ##############################################################################
215 #
216 # CSpecialFxProxyApplication public StartFx { arguments } {
217 #
218 # Input:
219 # arguments - the arguments that are sent by the client. It should hold
220 # the address and port of the remote client as well as all the information
221 # to start a new replay
222 #
223 # Output:
224 # none
225 #
226 # Description:
227 #
228 ##############################################################################
229 CSpecialFxProxyApplication public StartFx { arguments } {
230 $self instvar m_specialFx_name
231 $self instvar m_specialFx_source1
232 $self instvar m_specialFx_source2
233 $self instvar m_specialFx_liSourceId
234 $self instvar m_i1
235 $self instvar m_i2
236 $self instvar m_o1
237 $self instvar m_latency
238 $self instvar m_text
239 $self instvar m_font
240 $self instvar m_point_size
241 $self instvar m_xpos
242 $self instvar m_ypos
243 $self instvar m_text_color
244 $self instvar m_back_color
245 $self instvar m_master_alpha
246 $self instvar m_back_alpha
247 $self instvar m_factor
248
249
250
251
252 puts "start replay - $arguments"
253
254 ################################
255 # irene - talk to ketan at this point. set up args
256 ################################
257 $self instvar m_specialfx_cntrl
258 set m_specialfx_cntrl [fx_create $m_specialFx_name]
259 puts "handler is $m_specialfx_cntrl"
260
261 set m_i1 0
262 set m_i2 0
263 set m_o1 0
264 set m_latency 0
265 set m_text 0
266 set m_font 0
267 set m_point_size 0
268 set m_xpos 0
269 set m_ypos 0
270 set m_text_color 0
271 set m_back_color 0
272 set m_master_alpha 0
273 set m_back_alpha 0
274 set m_factor 0
275
276
277 fx_set_input_callback $m_specialfx_cntrl "$self ActivateUI "
278 fx_set_output_callback $m_specialfx_cntrl "$self ActivateUI "
279 fx_set_parameter_callback $m_specialfx_cntrl "$self ActivateUI "
280
281 puts "at the end of startfx "
282
283 }
284
285
286
287 ##############################################################################
288 #
289 # CSpecialFxProxyApplication private GetUIControl { service arguments }
290 #
291 # Input:
292 # service - the service that called this function
293 # arguments - the ui commands that will be evaluated to update the ui
294 #
295 # Output:
296 # none
297 #
298 # Description:
299 # send the control ui commands back to the client
300 #
301 ##############################################################################
302 CSpecialFxProxyApplication private GetUIControl { service arguments } {
303 $self instvar m_szPlayPauseState
304 $self instvar m_iOffset
305 $self instvar m_tmStart
306 $self instvar m_tmEnd
307 $self instvar m_specialFx_name
308 $self instvar m_specialFx_source1
309 $self instvar m_specialFx_source2
310 $self instvar m_specialFx_liSourceId
311 $self instvar m_specialfx_cntrl
312
313 set cmd ""
314
315 # for unique variable names
316 append cmd "regsub -all -- {\\\.} \$winFrame {_} __name \n"
317
318 if {$m_specialFx_name == "H261TitleSubprogram"} {
319 # Tab Buttons
320 append cmd "frame \$winFrame.tab \n"
321
322 # Inputs Button
323 append cmd "button \$winFrame.tab.inputs -text \"Inputs\" \
324 -command \"pack forget \$winFrame.inputs; \
325 pack forget \$winFrame.text; pack forget \$winFrame.color; \
326 pack forget \$winFrame.transperancy; \$winFrame.tab.inputs configure -fg black;\
327 \$winFrame.tab.text configure -fg grey; \
328 \$winFrame.tab.color configure -fg grey; \
329 \$winFrame.tab.transperancy configure -fg grey; \
330 pack \$winFrame.inputs -side top -expand 1 -fill both\" \n"
331 append cmd "pack \$winFrame.tab.inputs -side left \n"
332
333 # Text Button
334 append cmd "button \$winFrame.tab.text -text \"Text\" \
335 -command \"pack forget \$winFrame.inputs; \
336 pack forget \$winFrame.text; pack forget \$winFrame.color; \
337 pack forget \$winFrame.transperancy; \$winFrame.tab.inputs configure -fg grey;\
338 \$winFrame.tab.text configure -fg black; \
339 \$winFrame.tab.color configure -fg grey; \
340 \$winFrame.tab.transperancy configure -fg grey; \
341 pack \$winFrame.text -side top -expand 1 -fill both\" \n"
342 append cmd "pack \$winFrame.tab.text -side left \n"
343
344 # Color Button
345 append cmd "button \$winFrame.tab.color -text \"Color\" \
346 -command \"pack forget \$winFrame.inputs; \
347 pack forget \$winFrame.text; pack forget \$winFrame.color; \
348 pack forget \$winFrame.transperancy; \$winFrame.tab.inputs configure -fg grey;\
349 \$winFrame.tab.text configure -fg grey; \
350 \$winFrame.tab.color configure -fg black; \
351 \$winFrame.tab.transperancy configure -fg grey; \
352 pack \$winFrame.color -side top -expand 1 -fill both\" \n"
353 append cmd "pack \$winFrame.tab.color -side left \n"
354
355 # Transperancy Button
356 append cmd "button \$winFrame.tab.transperancy -text \"Transperancy\" \
357 -command \"pack forget \$winFrame.inputs; \
358 pack forget \$winFrame.text; pack forget \$winFrame.color; \
359 pack forget \$winFrame.transperancy; \$winFrame.tab.inputs configure -fg grey;\
360 \$winFrame.tab.text configure -fg grey; \
361 \$winFrame.tab.color configure -fg grey; \
362 \$winFrame.tab.transperancy configure -fg black; \
363 pack \$winFrame.transperancy -side top -expand 1 -fill both\" \n"
364 append cmd "pack \$winFrame.tab.transperancy -side left \n"
365
366 # Inputs Frame
367 append cmd "frame \$winFrame.inputs \n"
368
369 # i1
370 append cmd "frame \$winFrame.inputs.1 \n"
371 append cmd "global __i1 \n"
372 # append cmd "set i1\$__name \[lindex \$liSourceId 0\] \n"
373 append cmd "if {!\[info exist __i1\]} {set __i1 $m_specialFx_source1} \n"
374 append cmd "frame \$winFrame.inputs.1.i1 \n"
375 append cmd "label \$winFrame.inputs.1.i1.label -text \"i1\" \n"
376 append cmd "menubutton \$winFrame.inputs.1.i1.entry -textvariable __i1 \
377 -menu \$winFrame.inputs.1.i1.entry.menu -relief raised \n"
378 append cmd "menu \$winFrame.inputs.1.i1.entry.menu \n"
379 append cmd "pack \$winFrame.inputs.1.i1.label -side left \n"
380 append cmd "pack \$winFrame.inputs.1.i1.entry -side right -expand 1 -fill x \n"
381 append cmd "pack \$winFrame.inputs.1.i1 -side top -expand 1 -fill both \n"
382 append cmd "pack \$winFrame.inputs.1 -side left -expand 1 -fill both \n"
383
384 append cmd "foreach item \" $m_specialFx_liSourceId \" { \
385 \$winFrame.inputs.1.i1.entry.menu add radio \
386 -label \$item -variable __i1 \
387 -command \"global __i1; \
388 \$service Send UPDATE_I1_CONTROL \\\$__i1 \" \
389 } \n"
390
391 # latency
392 append cmd "frame \$winFrame.inputs.2 \n"
393 append cmd "frame \$winFrame.inputs.2.latency \n"
394 append cmd "label \$winFrame.inputs.2.latency.label -text \"latency\" \n"
395 append cmd "scale \$winFrame.inputs.2.latency.entry -orient horizontal \
396 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] \
397 -command \" \
398 \$service Send UPDATE_LATENCY_CONTROL \" \n"
399 append cmd "pack \$winFrame.inputs.2.latency.label -side left \n"
400 append cmd "pack \$winFrame.inputs.2.latency.entry -side right \
401 -expand 1 -fill both \n"
402 append cmd "pack \$winFrame.inputs.2.latency -side top -expand 1 \n"
403 append cmd "pack \$winFrame.inputs.2 -side right -expand 1 -fill both \n"
404
405 # Text Frame
406 append cmd "frame \$winFrame.text \n"
407
408 # text
409 append cmd "global __text \n"
410 append cmd "if {!\[info exist __text\]} {set __text Test} \n"
411
412 append cmd "global value \n"
413 append cmd "frame \$winFrame.text.text \n"
414 append cmd "label \$winFrame.text.text.label -text \"text\" \n"
415 append cmd "entry \$winFrame.text.text.entry -relief sunken \
416 -textvariable __text \n"
417 append cmd "button \$winFrame.text.text.button -text \"Set\" \
418 -command \"global __text;
419 \$service Send UPDATE_TEXT_CONTROL \\\" \\\$__text \\\" \" \n"
420 append cmd "pack \$winFrame.text.text.label -side left \n"
421 append cmd "pack \$winFrame.text.text.button -side right \n"
422 append cmd "pack \$winFrame.text.text.entry -side right -fill both -expand 1 \n"
423 append cmd "pack \$winFrame.text.text -side top -expand 1 -fill both \n"
424
425 # font
426 append cmd "frame \$winFrame.text.1 \n"
427 append cmd "global __font \n"
428 append cmd "global __fonts \n"
429 append cmd "set __fonts {Times-Roman Times-Bold Times-Italic \
430 Hevetica Hevetica-Narrow Hevetica-Bold} \n"
431 append cmd "set __font \[lindex \$__fonts 0\] \n"
432 append cmd "frame \$winFrame.text.1.font \n"
433 append cmd "label \$winFrame.text.1.font.label -text \"font\" \n"
434 append cmd "menubutton \$winFrame.text.1.font.entry \
435 -textvariable __font -menu \$winFrame.text.1.font.entry.menu \
436 -relief raised \n"
437 append cmd "menu \$winFrame.text.1.font.entry.menu \n"
438 append cmd "pack \$winFrame.text.1.font.label -side left \n"
439 append cmd "pack \$winFrame.text.1.font.entry -side right -expand 1 -fill both \n"
440 append cmd "pack \$winFrame.text.1.font -side left -expand 1 -fill x \n"
441
442 append cmd "foreach item \$__fonts { \
443 \$winFrame.text.1.font.entry.menu add radio -label \$item \
444 -variable __font \
445 -command \"global __font; puts \\\"font is \\\$__font \n\\\"; \
446 \$service Send UPDATE_FONT_CONTROL \\\$__font\" \
447 } \n"
448
449 # point_size
450 append cmd "frame \$winFrame.text.1.point_size \n"
451 append cmd "label \$winFrame.text.1.point_size.label -text \"point_size\" \n"
452
453 append cmd "global __pointsize \n"
454 append cmd "if {!\[info exist __pointsize\]} {set __pointsize 20} \n"
455
456 append cmd "scale \$winFrame.text.1.point_size.entry -orient horizontal \
457 -variable __pointsize \
458 -from 5 -to 40 -command \" \
459 \$service Send UPDATE_POINT_SIZE_CONTROL \" \n"
460 append cmd "pack \$winFrame.text.1.point_size.label -side left \n"
461 append cmd "pack \$winFrame.text.1.point_size.entry -side right \
462 -expand 1 -fill both \n"
463 append cmd "pack \$winFrame.text.1.point_size -side right -expand 1 \n"
464 append cmd "pack \$winFrame.text.1 -side top -expand 1 -fill both \n"
465
466 # xpos
467 append cmd "global __xpos \n"
468 append cmd "if {!\[info exist __xpos\]} {set __xpos 0.2} \n"
469
470 append cmd "frame \$winFrame.text.2 \n"
471 append cmd "frame \$winFrame.text.2.xpos \n"
472 append cmd "label \$winFrame.text.2.xpos.label -text \"xpos\" \n"
473 append cmd "scale \$winFrame.text.2.xpos.entry -orient horizontal \
474 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] \
475 -variable __xpos \
476 -command \" \
477 \$service Send UPDATE_XPOS_CONTROL \" \n"
478 append cmd "pack \$winFrame.text.2 -side top -expand 1 -fill both \n"
479 append cmd "pack \$winFrame.text.2.xpos -side right -expand 1 \n"
480 append cmd "pack \$winFrame.text.2.xpos.label -side left \n"
481 append cmd "pack \$winFrame.text.2.xpos.entry -side right -expand 1 -fill both \n"
482 append cmd "pack \$winFrame.text.2.xpos -side left -expand 1 \n"
483
484 # ypos
485 append cmd "global __ypos \n"
486 append cmd "if {!\[info exist __ypos\]} {set __ypos 0.2} \n"
487
488 append cmd "frame \$winFrame.text.2.ypos \n"
489 append cmd "label \$winFrame.text.2.ypos.label -text \"ypos\" \n"
490 append cmd "scale \$winFrame.text.2.ypos.entry -orient horizontal \
491 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] \
492 -variable __ypos \
493 -command \" \
494 \$service Send UPDATE_YPOS_CONTROL \" \n"
495 append cmd "pack \$winFrame.text.2.ypos.label -side left \n"
496 append cmd "pack \$winFrame.text.2.ypos.entry -side right -expand 1 -fill both \n"
497 append cmd "pack \$winFrame.text.2.ypos -side left -expand 1 \n"
498
499 # Color
500 append cmd "frame \$winFrame.color \n"
501
502 # text_color
503 append cmd "frame \$winFrame.color.text_color \n"
504 append cmd "label \$winFrame.color.text_color.label -text \"text_color\" \n"
505 append cmd "frame \$winFrame.color.text_color.entry \n"
506 append cmd "frame \$winFrame.color.text_color.entry.r \n"
507 append cmd "label \$winFrame.color.text_color.entry.r.label -text \"r\" \n"
508 append cmd "scale \$winFrame.color.text_color.entry.r.entry \
509 -orient horizontal -from 0 -to 255 \
510 -command \" \
511 global __valuer; global __valueg; global __valueb; global __value; \
512 set __valuer \\\[\$winFrame.color.text_color.entry.r.entry get\\\]; \
513 set __valueg \\\[\$winFrame.color.text_color.entry.g.entry get\\\]; \
514 set __valueb \\\[\$winFrame.color.text_color.entry.b.entry get\\\]; \
515 set __value \\\"\\\$__valuer \\\$__valueg \\\$__valueb\\\"; \
516 \$service Send UPDATE_TEXT_COLOR_CONTROL \\\$__value ;# \" \n"
517 append cmd "pack \$winFrame.color.text_color.entry.r.label -side left \n"
518 append cmd "pack \$winFrame.color.text_color.entry.r.entry -side right \
519 -expand 1 -fill both \n"
520
521 append cmd "frame \$winFrame.color.text_color.entry.g \n"
522 append cmd "label \$winFrame.color.text_color.entry.g.label -text \"g\" \n"
523 append cmd "scale \$winFrame.color.text_color.entry.g.entry \
524 -orient horizontal -from 0 -to 255 \
525 -command \" \
526 global __valuer; global __valueg; global __valueb; global __value; \
527 set __valuer \\\[\$winFrame.color.text_color.entry.r.entry get\\\]; \
528 set __valueg \\\[\$winFrame.color.text_color.entry.g.entry get\\\]; \
529 set __valueb \\\[\$winFrame.color.text_color.entry.b.entry get\\\]; \
530 set __value \\\"\\\$__valuer \\\$__valueg \\\$__valueb\\\"; \
531 \$service Send UPDATE_TEXT_COLOR_CONTROL \\\$__value ;# \" \n"
532 append cmd "pack \$winFrame.color.text_color.entry.g.label -side left \n"
533 append cmd "pack \$winFrame.color.text_color.entry.g.entry -side right \
534 -expand 1 -fill both \n"
535 append cmd "frame \$winFrame.color.text_color.entry.b \n"
536 append cmd "label \$winFrame.color.text_color.entry.b.label -text \"b\" \n"
537 append cmd "scale \$winFrame.color.text_color.entry.b.entry \
538 -orient horizontal -from 0 -to 255 \
539 -command \" \
540 global __valuer; global __valueg; global __valueb; global __value; \
541 set __valuer \\\[\$winFrame.color.text_color.entry.r.entry get\\\]; \
542 set __valueg \\\[\$winFrame.color.text_color.entry.g.entry get\\\]; \
543 set __valueb \\\[\$winFrame.color.text_color.entry.b.entry get\\\]; \
544 set __value \\\"\\\$__valuer \\\$__valueg \\\$__valueb\\\"; \
545 \$service Send UPDATE_TEXT_COLOR_CONTROL \\\$__value ;# \" \n"
546 append cmd "pack \$winFrame.color.text_color.entry.b.label -side left \n"
547 append cmd "pack \$winFrame.color.text_color.entry.b.entry -side right \
548 -expand 1 -fill both \n"
549
550 append cmd "pack \$winFrame.color.text_color.entry.r -side left \n"
551 append cmd "pack \$winFrame.color.text_color.entry.g -side left \n"
552 append cmd "pack \$winFrame.color.text_color.entry.b -side left \n"
553 append cmd "pack \$winFrame.color.text_color.label -side top \n"
554 append cmd "pack \$winFrame.color.text_color.entry -side top \
555 -expand 1 -fill both \n"
556 append cmd "pack \$winFrame.color.text_color -side top -expand 1 -fill both \n"
557
558 # back_color
559 append cmd "frame \$winFrame.color.back_color \n"
560 append cmd "label \$winFrame.color.back_color.label -text \"back_color\" \n"
561 append cmd "frame \$winFrame.color.back_color.entry \n"
562 append cmd "frame \$winFrame.color.back_color.entry.r \n"
563 append cmd "label \$winFrame.color.back_color.entry.r.label -text \"r\" \n"
564 append cmd "scale \$winFrame.color.back_color.entry.r.entry \
565 -orient horizontal -from 0 -to 255 \
566 -command \" \
567 global __valuer; global __valueg; global __valueb; global __value; \
568 set __valuer \\\[\$winFrame.color.back_color.entry.r.entry get\\\]; \
569 set __valueb \\\[\$winFrame.color.back_color.entry.b.entry get\\\]; \
570 set __valueg \\\[\$winFrame.color.back_color.entry.g.entry get\\\]; \
571 set __value \\\"\\\$__valuer \\\$__valueg \\\$__valueb\\\"; \
572 \$service Send UPDATE_BACK_COLOR_CONTROL \\\$__value ;# \" \n"
573 append cmd "pack \$winFrame.color.back_color.entry.r.label -side left \n"
574 append cmd "pack \$winFrame.color.back_color.entry.r.entry -side right \
575 -expand 1 -fill both \n"
576
577 append cmd "frame \$winFrame.color.back_color.entry.g \n"
578 append cmd "label \$winFrame.color.back_color.entry.g.label -text \"g\" \n"
579 append cmd "scale \$winFrame.color.back_color.entry.g.entry \
580 -orient horizontal -from 0 -to 255 \
581 -command \" \
582 global __valuer; global __valueg; global __valueb; global __value; \
583 set __valuer \\\[\$winFrame.color.back_color.entry.r.entry get\\\]; \
584 set __valueb \\\[\$winFrame.color.back_color.entry.b.entry get\\\]; \
585 set __valueg \\\[\$winFrame.color.back_color.entry.g.entry get\\\]; \
586 set __value \\\"\\\$__valuer \\\$__valueg \\\$__valueb\\\"; \
587 \$service Send UPDATE_BACK_COLOR_CONTROL \\\$__value ;# \" \n"
588 append cmd "pack \$winFrame.color.back_color.entry.g.label -side left \n"
589 append cmd "pack \$winFrame.color.back_color.entry.g.entry -side right \
590 -expand 1 -fill both \n"
591 append cmd "frame \$winFrame.color.back_color.entry.b \n"
592 append cmd "label \$winFrame.color.back_color.entry.b.label -text \"b\" \n"
593 append cmd "scale \$winFrame.color.back_color.entry.b.entry \
594 -orient horizontal -from 0 -to 255 \
595 -command \" \
596 global __valuer; global __valueg; global __valueb; global __value; \
597 set __valuer \\\[\$winFrame.color.back_color.entry.r.entry get\\\]; \
598 set __valueb \\\[\$winFrame.color.back_color.entry.b.entry get\\\]; \
599 set __valueg \\\[\$winFrame.color.back_color.entry.g.entry get\\\]; \
600 set __value \\\"\\\$__valuer \\\$__valueg \\\$__valueb\\\"; \
601 \$service Send UPDATE_BACK_COLOR_CONTROL \\\$__value ;# \" \n"
602 append cmd "pack \$winFrame.color.back_color.entry.b.label -side left \n"
603 append cmd "pack \$winFrame.color.back_color.entry.b.entry -side right \
604 -expand 1 -fill both \n"
605
606 append cmd "pack \$winFrame.color.back_color.entry.r -side left \n"
607 append cmd "pack \$winFrame.color.back_color.entry.g -side left \n"
608 append cmd "pack \$winFrame.color.back_color.entry.b -side left \n"
609 append cmd "pack \$winFrame.color.back_color.label -side top \n"
610 append cmd "pack \$winFrame.color.back_color.entry -side top \
611 -expand 1 -fill both \n"
612 append cmd "pack \$winFrame.color.back_color -side top -expand 1 -fill both \n"
613
614 # Trancperancy
615 append cmd "frame \$winFrame.transperancy \n"
616
617 # master_alpha
618 append cmd "global __master_alpha \n"
619 append cmd "if {!\[info exist __master_alpha\]} {set __master_alpha 1.0} \n"
620
621 append cmd "frame \$winFrame.transperancy.master_alpha \n"
622 append cmd "label \$winFrame.transperancy.master_alpha.label \
623 -text \"master_alpha\" \n"
624 append cmd "scale \$winFrame.transperancy.master_alpha.entry -orient horizontal \
625 -variable __master_alpha \
626 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] -command \" \
627 \$service Send UPDATE_MASTER_ALPHA_CONTROL \" \n"
628 append cmd "pack \$winFrame.transperancy.master_alpha.label \
629 -side left -anchor n \n"
630 append cmd "pack \$winFrame.transperancy.master_alpha.entry -side right \
631 -expand 1 -fill both \n"
632 append cmd "pack \$winFrame.transperancy.master_alpha -side top \
633 -expand 1 -fill both \n"
634
635 # back_alpha
636 append cmd "global __back_alpha \n"
637 append cmd "if {!\[info exist __back_alpha\]} {set __back_alpha 0.0} \n"
638
639 append cmd "frame \$winFrame.transperancy.back_alpha \n"
640 append cmd "label \$winFrame.transperancy.back_alpha.label \
641 -text \"back_alpha\" \n"
642 append cmd "scale \$winFrame.transperancy.back_alpha.entry -orient horizontal \
643 -variable __back_alpha \
644 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] -command \"\
645 \$service Send UPDATE_BACK_ALPHA_CONTROL \" \n"
646 append cmd "pack \$winFrame.transperancy.back_alpha.label \
647 -side left -anchor n \n"
648 append cmd "pack \$winFrame.transperancy.back_alpha.entry -side right \
649 -expand 1 -fill both \n"
650 append cmd "pack \$winFrame.transperancy.back_alpha -side top \
651 -expand 1 -fill both \n"
652
653 append cmd "pack \$winFrame.tab -side top -expand 1 -fill both \n"
654 append cmd "pack \$winFrame.inputs -side top -expand 1 -fill both \n"
655
656
657
658 } elseif {$m_specialFx_name == "H261FadeSubprogram"} {
659 # Tab Buttons
660 append cmd "frame \$winFrame.tab \n"
661
662 # Inputs Button
663 append cmd "button \$winFrame.tab.inputs -text \"Inputs\" \
664 -command \"pack forget \$winFrame.inputs; pack forget \$winFrame.factor; \
665 \$winFrame.tab.inputs configure -fg black; \
666 \$winFrame.tab.factor configure -fg grey; \
667 pack \$winFrame.inputs -side top -expand 1 -fill both\" \n"
668 append cmd "pack \$winFrame.tab.inputs -side left \n"
669
670 # Factor Button
671 append cmd "button \$winFrame.tab.factor -text \"Factor\" \
672 -command \"pack forget \$winFrame.inputs; pack forget \$winFrame.factor; \
673 \$winFrame.tab.inputs configure -fg grey; \
674 \$winFrame.tab.factor configure -fg black; \
675 pack \$winFrame.factor -side top -expand 1 -fill both\" \n"
676 append cmd "pack \$winFrame.tab.factor -side left \n"
677
678 # Inputs
679 append cmd "frame \$winFrame.inputs \n"
680
681 # i1
682 append cmd "frame \$winFrame.inputs.1 \n"
683 append cmd "global __i1 \n"
684 # append cmd "set __i1 \[lindex \$liSourceId 0\] \n"
685 append cmd "global __i1 \n"
686 append cmd "set __i1 $m_specialFx_source1 \n"
687 append cmd "frame \$winFrame.inputs.1.i1 \n"
688 append cmd "label \$winFrame.inputs.1.i1.label -text \"i1\" \n"
689 append cmd "menubutton \$winFrame.inputs.1.i1.entry -textvariable __i1 \
690 -menu \$winFrame.inputs.1.i1.entry.menu -relief raised \n"
691 append cmd "menu \$winFrame.inputs.1.i1.entry.menu \n"
692 append cmd "pack \$winFrame.inputs.1.i1.label -side left \n"
693 append cmd "pack \$winFrame.inputs.1.i1.entry -side right \
694 -expand 1 -fill both \n"
695 append cmd "pack \$winFrame.inputs.1.i1 -side left -expand 1 -fill both \n"
696
697 append cmd "foreach item \" $m_specialFx_liSourceId \" { \
698 \$winFrame.inputs.1.i1.entry.menu add radio -label \$item \
699 -variable __i1 -command \"global __i1; puts \\\"i1 is \\\$__i1 \n\\\"; \
700 \$service Send UPDATE_I1_CONTROL \\\$__i1 \" \
701 } \n"
702
703 # i2
704 append cmd "global __i2 \n"
705 # append cmd "set __i2 \[lindex \$liSourceId 0\] \n"
706 append cmd "global __i2 \n"
707 append cmd "set __i2 $m_specialFx_source2 \n"
708 append cmd "frame \$winFrame.inputs.1.i2 \n"
709 append cmd "label \$winFrame.inputs.1.i2.label -text \"i2\" \n"
710 append cmd "menubutton \$winFrame.inputs.1.i2.entry -textvariable __i2 \
711 -menu \$winFrame.inputs.1.i2.entry.menu -relief raised \n"
712 append cmd "menu \$winFrame.inputs.1.i2.entry.menu \n"
713 append cmd "pack \$winFrame.inputs.1.i2.label -side left \n"
714 append cmd "pack \$winFrame.inputs.1.i2.entry -side right \
715 -expand 1 -fill both \n"
716 append cmd "pack \$winFrame.inputs.1.i2 -side left -expand 1 -fill both \n"
717 append cmd "pack \$winFrame.inputs.1 -side top -expand 1 -fill both \n"
718
719 append cmd "foreach item \" $m_specialFx_liSourceId \" { \
720 \$winFrame.inputs.1.i2.entry.menu add radio -label \$item \
721 -variable __i2 -command \"global __i2; puts \\\"i2 is \\\$__i2\n\\\"; \
722 \$service Send UPDATE_I2_CONTROL \\\$__i2 \" \
723 } \n"
724
725
726 # latency
727 append cmd "frame \$winFrame.inputs.2 \n"
728 append cmd "frame \$winFrame.inputs.2.latency \n"
729 append cmd "label \$winFrame.inputs.2.latency.label -text \"latency\" \n"
730 append cmd "scale \$winFrame.inputs.2.latency.entry -orient horizontal \
731 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] \
732 -command \"\$service Send UPDATE_LATENCY_CONTROL \" \n"
733 append cmd "pack \$winFrame.inputs.2.latency.label -side left \n"
734 append cmd "pack \$winFrame.inputs.2.latency.entry -side right \
735 -expand 1 -fill both \n"
736 append cmd "pack \$winFrame.inputs.2.latency -side left -expand 1 -fill both \n"
737 append cmd "pack \$winFrame.inputs.2 -side top -expand 1 -fill both \n"
738
739 # Factor
740 append cmd "frame \$winFrame.factor \n"
741
742 # factor
743 append cmd "frame \$winFrame.factor.factor \n"
744 append cmd "scale \$winFrame.factor.factor.entry -orient horizontal \
745 -from 0.0 -to 1.0 -resolution \[expr (0.0-1.0) / 100.0\] \
746 -command \"\$service Send UPDATE_FACTOR_CONTROL \" \n"
747 append cmd "label \$winFrame.factor.factor.label -text \"factor\" \n"
748 append cmd "pack \$winFrame.factor.factor.label -side left \n"
749 append cmd "pack \$winFrame.factor.factor.entry -side right \
750 -expand 1 -fill both \n"
751 append cmd "pack \$winFrame.factor.factor -side top -expand 1 -fill both \n"
752
753
754 append cmd "pack \$winFrame.tab -side top -expand 1 -fill both \n"
755 append cmd "pack \$winFrame.inputs -side top -expand 1 -fill both \n"
756 }
757
758
759 # the play/pause button
760 # append cmd "global playPause\$__name \n"
761 # append cmd "set playPause\$__name $m_szPlayPauseState \n"
762 # append cmd "button \$winFrame.playPauseButton \
763 # -textvariable playPause\$__name \
764 # -command \"\$service Send PLAY_PAUSE \\\"\\\" \" \n"
765 #
766 # append cmd "pack \$winFrame.playPauseButton -fill y -side right \n"
767 #
768 # # the progress slider
769 # append cmd "global slider\$__name \n"
770 # append cmd "set slider\$__name [expr int($m_iOffset)] \n"
771 # append cmd "scale \$winFrame.slider -orient horizontal \
772 # -from 0 -to [expr int($m_tmEnd - $m_tmStart)] \
773 # -tickinterval [expr int(0.49 * ($m_tmEnd - $m_tmStart))] \
774 # -showvalue true \
775 # -variable slider\$__name \
776 # -command \"\$service Send MOVE_SLIDER\" \n"
777 # append cmd "pack \$winFrame.slider -side left -fill y -expand 1 \n"
778
779 #DEBUG
780 # return $cmd
781
782 $service Send CONTROL_UI $cmd
783 }
784
785 ##############################################################################
786 #
787 # CSpecialFxProxyApplication private ActivateUI { arguments }
788 #
789 # Input:
790 # service - the service that called this function
791 # arguments - the ui commands that will be evaluated to update the ui
792 #
793 # Output:
794 # none
795 #
796 # Description:
797 #
798 ##############################################################################
799 CSpecialFxProxyApplication public ActivateUI { arguments } {
800 $self instvar m_szPlayPauseState
801 $self instvar m_iOffset
802 $self instvar m_specialfx_cntrl
803 $self instvar m_i1
804 $self instvar m_i2
805 $self instvar m_o1
806 $self instvar m_latency
807 $self instvar m_text
808 $self instvar m_font
809 $self instvar m_point_size
810 $self instvar m_xpos
811 $self instvar m_ypos
812 $self instvar m_text_color
813 $self instvar m_back_color
814 $self instvar m_master_alpha
815 $self instvar m_back_alpha
816 $self instvar m_factor
817 $self instvar m_specialFx_source1
818 $self instvar m_specialFx_source2
819 $self instvar m_specialFx_name
820 $self instvar m_inetMStudioAddr
821 $self instvar m_iMStudioPort
822
823
824 set varname [lindex $arguments 0]
825 puts "in Activate UI"
826 puts "varname is $varname"
827 flush stdout
828
829 if {$varname == "i1"} {
830 if {$m_i1 == 0} {
831 puts "i1 now activated with value $m_inetMStudioAddr/$m_iMStudioPort/$m_specialFx_source1 \n"
832 fx_set_input_spec $m_specialfx_cntrl i1 $m_inetMStudioAddr/$m_iMStudioPort/$m_specialFx_source1
833 set m_i1 1
834 }
835 } elseif {$varname == "i2"} {
836 if {$m_i2 == 0} {
837 puts "i2 now activated with value $m_inetMStudioAddr/$m_iMStudioPort/$m_specialFx_source2 \n"
838 fx_set_input_spec $m_specialfx_cntrl i2 $m_inetMStudioAddr/$m_iMStudioPort/$m_specialFx_source2
839 set m_i2 1
840 }
841 } elseif {$varname == "o1"} {
842 if {$m_o1 == 0} {
843 puts "output is $m_inetMStudioAddr/$m_iMStudioPort \n"
844 fx_set_output_spec $m_specialfx_cntrl o1 $m_inetMStudioAddr/$m_iMStudioPort
845 set m_o1 1
846 }
847 } elseif {$varname == "latency"} {
848 if {$m_latency == 0} {
849 puts "latency now activated with value 0.0 \n"
850 fx_set_parameter_value $m_specialfx_cntrl latency 0.0
851 set m_latency 1
852 }
853 } elseif {$varname == "text"} {
854 if {$m_text == 0} {
855 puts "text now activated with value \"\" \n"
856 fx_set_parameter_value $m_specialfx_cntrl text "Test"
857 set m_text 1
858 }
859 } elseif {$varname == "font"} {
860 if {$m_font == 0} {
861 puts "font now activated with value Times-Roman \n"
862 fx_set_parameter_value $m_specialfx_cntrl font Times-Roman
863 set m_font 1
864 }
865 } elseif {$varname == "point_size"} {
866 if {$m_point_size == 0} {
867 puts "point_size now activated with value 5 \n"
868 fx_set_parameter_value $m_specialfx_cntrl point_size 20
869 set m_point_size 1