1 # application-desc.tcl --
2 #
3 # Creates a BroadcastDescription object and gives it a frame to display
4 # in
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 enable
33
34 import Application BroadcastDescription
35
36 Class BroadcastDescriptionApplication -superclass Application
37
38 BroadcastDescriptionApplication instproc init {argv} {
39 $self instvar bd_
40 $self next "desc"
41
42 $self initArgs
43 set options [$self options]
44 # parse command line args
45 $options parse_args $argv
46
47 $self initUI
48
49 set spec [list]
50 # Broadcast Description Info
51 # description file
52 lappend spec [$options get_option descriptionFile]
53 # DC host/port
54 lappend spec [$options get_option dcHost] [$options get_option dcPort]
55 # recorder host/port
56 lappend spec [$options get_option recorderHost] [$options get_option recorderPort]
57 lappend spec ""
58
59 set bd_ [new BroadcastDescription .bdFrame $spec]
60 }
61
62 BroadcastDescriptionApplication instproc initArgs {} {
63 set options [$self options]
64
65 # register valid options
66 $options register_option -df descriptionFile
67 $options register_option -dh dcHost
68 $options register_option -dp dcPort
69 $options register_option -rh recorderHost
70 $options register_option -rp recorderPort
71
72 # set up defaults
73 $options add_default descriptionFile "migs.desc.tcl"
74 $options add_default dcHost "garfield.cs.berkeley.edu"
75 $options add_default dcPort "6907"
76 $options add_default recorderHost "garfield.cs.berkeley.edu"
77 $options add_default recorderPort "6909"
78 }
79
80 BroadcastDescriptionApplication instproc initUI {} {
81 wm title . "BroadcastDescription"
82 wm minsize . 200 100
83
84 # make broadcast description frame
85 frame .bdFrame
86 pack .bdFrame -side top
87
88 # make exit button
89 button .exit -text "Exit" -command "$self exitApp"
90 pack .exit -side bottom
91 }
92
93 BroadcastDescriptionApplication instproc exitApp {} {
94 $self instvar bd_
95
96 $bd_ destroy
97
98 exit
99 }
100
101 BroadcastDescriptionApplication instproc enableBroadcastDescription {} {
102 $self instvar bd_
103
104 $bd_ enable
105 }
106
107 BroadcastDescriptionApplication instproc disableBroadcastDescription {} {
108 $self instvar bd_
109
110 $bd_ disable
111 }
112
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.