1
2# JStrack:  copyright 1997/2010 by Jim Graham, N5IAL, all rights reserved.
3#
4
5# This file contains the Tk procedure to print out the Saffir-Simpson
6# scale in both chart format and in a detailed listing of damage expected
7# from each category of storm.
8
9proc tk_sschart {} {
10   global text_font pmw color
11   toplevel .ssct
12   set x [expr {[winfo rootx $pmw] + [winfo width $pmw]}]
13   set y [expr {[winfo rooty $pmw] + [winfo height $pmw] + 60}]
14   wm geometry .ssct +$x+$y
15   wm title .ssct "Saffir-Simpson Scale"
16   wm attributes .ssct -topmost true
17
18   set w .ssct.text
19   text $w -width 63 -height 18 -font $text_font \
20      -foreground $color(dwinfg) -background $color(dwinbg) -spacing3 1.2
21   pack $w -side top
22   $w insert end [saff_chart]
23   $w insert end "
24      Use the buttons below for a more detailed description
25      of the typical damage caused.
26"
27   $w configure -state disabled
28
29   set w .ssct.fr
30   frame $w
31   pack $w -side top
32
33   for {set i 1} {$i <= 5} {incr i} {
34      button $w.cat$i -text "Cat $i" -command "tk_show_damage_cat $i $x $y"
35      pack $w.cat$i -side left
36   }
37   button $w.refs -text "References" -command "tk_show_refs $x $y"
38   pack $w.refs -side left
39   button $w.done -text "Dismiss" -command { destroy .ssct }
40   pack $w.done -side left
41}
42
43
44proc tk_show_refs {x y} {
45   global text_font color
46
47   catch {destroy .ssctref}
48   toplevel .ssctref
49   set x [expr {$x + 35}]
50   set y [expr {$y + 35}]
51   wm geometry .ssctref +$x+$y
52   wm title .ssctref "Saffir-Simpson Scale (References)"
53   wm attributes .ssctref -topmost true
54
55   set w .ssctref.text
56   text $w -width 72 -height 10 -font $text_font \
57         -foreground $color(dwinfg) -background $color(dwinbg) -spacing3 1.2
58   pack $w -side top
59   $w insert end [ss_refs]
60   $w configure -state disabled
61
62   button .ssctref.done -text "Dismiss" -command { destroy .ssctref }
63   pack .ssctref.done -side top
64}
65
66
67proc tk_show_damage_cat {cat x y} {
68   global text_font color
69
70   if {$cat == 1} {       set lines 10
71   } elseif {$cat == 2} { set lines 15
72   } elseif {$cat == 3} { set lines 17
73   } elseif {$cat == 4} { set lines 16
74   } elseif {$cat == 5} { set lines 17
75   }
76
77   catch {destroy .ssctdamage}
78   toplevel .ssctdamage
79   set x [expr {$x + 35}]
80   set y [expr {$y + 35}]
81   wm geometry .ssctdamage +$x+$y
82   wm attributes .ssctdamage -topmost true
83   wm title .ssctdamage "Saffir-Simpson Scale (Typical Damage for Cat $cat)"
84
85   set w .ssctdamage.text
86   text $w -width 72 -height $lines -font $text_font \
87         -foreground $color(dwinfg) -background $color(dwinbg) -spacing3 1.2
88   pack $w -side top
89
90   $w insert end "Information in this description quoted from the ``Hurricanes,
91Typhoons, Tropical Cyclones FAQ'' by Dr. Chris Landsea
92"
93   $w insert end [ss_damage $cat]
94   $w configure -state disabled
95
96   button .ssctdamage.done -text "Dismiss" -command { destroy .ssctdamage }
97   pack .ssctdamage.done -side top
98}
99
100