1 # application-mgamon.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/mgamon/application-mgamon.tcl,v 1.21 2002/02/03 04:27:48 lim Exp $ (UCB)
32
33 import Application MGAMonUI
34
35 Class MGAMonApplication -superclass Application
36
37 MGAMonApplication instproc init argv {
38 $self next mgamon
39
40 $self instvar ui_
41
42 set o [$self options]
43 $self init_args $o
44 $self init_resources $o
45 $o parse_args $argv
46
47 # Source the user's hook file if it exists. The function
48 # user_hook, which may be defined in this file, will be
49 # called at the end of init.
50 if {[$o get_option userhookFile] != ""} {
51 if {[file isfile [$o get_option userhookFile]] && \
52 [file readable [$o get_option userhookFile]]} {
53 source [$o get_option userhookFile]
54 } else {
55 puts stderr "Unable to source \"[$o get_option userhookFile]\". Not a file or not readable."
56 }
57 }
58
59 $self init_network
60
61 frame .top
62 set ui_ [new MGAMonUI .top]
63 pack .top -fill both -expand 1
64
65 $self user_hook
66 }
67
68 MGAMonApplication instproc init_args o {
69 $o register_option -u userhookFile
70 $o register_option -log doLog
71 $o register_option -megactrl asCtrl
72 }
73
74 MGAMonApplication instproc init_resources o {
75 #FIXME
76 $o add_default foundry adobe
77 set foundry [$self get_option foundry]
78
79 set helv10 [$self search_font $foundry helvetica medium 10 r]
80 set helv10b [$self search_font $foundry helvetica bold 10 r]
81 set helv10o [$self search_font $foundry helvetica bold 10 o]
82 set helv12b [$self search_font $foundry helvetica bold 14 r]
83 set times14 [$self search_font $foundry times medium 16 r]
84
85 option add *Font $helv12b startupFile
86 $o add_default medfont $helv12b
87 $o add_default smallfont $helv10b
88 $o add_default helpFont $times14
89 $o add_default entryFont $helv10
90
91 $o add_default defaultTTL 1
92 $o add_option asCtrl 224.4.5.24/50000/31
93 $o add_default asCtrlBW 20000
94 }
95
96 MGAMonApplication instproc init_network {} {
97 set addr [$self get_option defaultCtrlAddr]
98 set port [$self get_option defaultCtrlPort]
99 set ttl [$self get_option defaultCtrlTTL]
100 set bw [$self get_option defaultCtrlBW]
101 }
102
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.