1 # application-atp.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 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/atobj/application-atp.tcl,v 1.6 2002/02/03 04:25:26 lim Exp $
32
33
34 Class ATP -superclass Application
35
36 ATP instproc createLocalNam {file sess_mgr} {
37 set namsrc [new DataSrc/Local/Nam $file]
38 set namview [new AnmView/Nam]
39
40 # get the config file
41 set layout [new NamNetwork]
42 $layout layout
43 $namsrc attach_layout $layout
44
45 # this is a temporary hack
46 $namview setFontByIdx 0 "lucidasans-10" blue
47 $namview setFontByIdx 1 \
48 "-adobe-helvetica-bold-r-normal--12-*-*-*-*-*-*-*" \
49 Brown
50 #
51 # set lAgent [new LocalAnimatorAgent]
52 # $lAgent connect $namview $namsrc
53
54 $namsrc attach_view $namview
55 $namview attach_datasrc $namsrc
56
57 set local_rcvr [new Atobj_rcvr $sess_mgr]
58 $namsrc attach_rcvr $local_rcvr
59 $local_rcvr add_animation $namsrc
60
61 # the local receiver is also the local source since it generates
62 # data
63 $sess_mgr set_local_src $local_rcvr
64
65 # initialize the layout and convert it into animation objects
66 $namsrc setup
67
68 set ui [new NamUI]
69 $ui attach_view $namview
70 $ui attach_datasrc $namsrc
71
72 set host [info hostname]
73 wm title [$namview path] "Nam@$host"
74 }
75
76 ATP instproc initNet {} {
77 $self instvar sess_mgr_ srm_sessn_ src_mgr_
78 set sess_mgr_ [new Atobj_sess_mgr]
79 set addr [$self resource sessionAddr]
80 set srm_sessn_ [Session/SRM create-session $sess_mgr_ $addr $sess_mgr_]
81 set src_mgr_ [$srm_sessn_ set sm_]
82
83 [$srm_sessn_ data-net] loopback 1
84 [$srm_sessn_ ctrl-net] loopback 1
85
86 $sess_mgr_ attach_session $srm_sessn_
87
88 # REVIEW: once the initial startup problem has been resolved,
89 # remove this line
90 [$srm_sessn_ sa-timer] reset
91 }
92
93 ATP private init_args o {
94 $self register_option $o -sa sessionAddr
95 $self register_option $o -tf traceFile
96 $self register_option $o -lf layoutFile
97 }
98
99 ATP instproc init_resources o {
100 $self instvar class_
101
102 $o add_option width 550
103 $o add_default height 450
104 $o add_default sessionAddr "225.4.5.5/8888"
105 # catch "option readfile ~/.RTPdefaults startupFile"
106 }
107
108 ATP instproc initUI {} {
109 set traceFile [$self resource traceFile]
110 set layoutFile [$self resource layoutFile]
111
112 if {$layoutFile!=""} {
113 source $layoutFile
114 }
115 if {$traceFile!=""} {
116 $self instvar sess_mgr_
117 $self createLocalNam $traceFile $sess_mgr_
118 }
119 wm iconify .
120 }
121
122
123 ATP instproc init {argv} {
124 set config [new Configuration]
125 $self set options_ $config
126
127 $self next atobj
128 $self init_args $config
129 $self init_resources $config
130 $self parse_args $argv
131
132 $self initNet
133 $self initUI
134 }
135
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.