#***********************************************************
# rtvstats.tcl --
#
#     Summary statistics for RTV tool.
#
#************************************************************

##################################
#
# ShowStatistics --
#
#     Show summary statistics.
#     This window should not be drawn if it
#     is already extant; the variable which
#     records this is called param(StatisticsShown).
#
proc ShowStatistics { } {
    global param
    
    if { $param(StatisticsShown) } return
    
    set bopts [list -bg $param(color-buttonbg) -fg $param(color-buttonfg) \
	    -activebackground $param(color-buttonabg) \
	    -highlightbackground $param(color-ctlbg) -font $param(bigfont) \
	    -padx 20 -pady 2]
    
    set w [toplevel .statswin]
    set f [frame .statswin.f1 -width 200 -height 50 -bg $param(color-winbg)]
#
    text $f.t -wrap none
    $f.t insert @0,0 [GetStatistics]
    $f.t insert @0,0 "*** For testing purposes only! *** \
	            \n*** Do NOT trust these numbers ***\n"
    $f.t configure -state disabled
    pack $f.t -side top
#
    eval {button $f.close -text "Close" \
	    -command [list StatClosePressed $w]} $bopts
    pack $f.close -side left -anchor w
#
    pack $f
    wm title $w "Statistics"
    wm geometry $w +10+10
    set param(StatisticsShown) 1
}

##################################

proc StatClosePressed { w } {
    global param
    destroy $w
    set param(StatisticsShown) 0
    return
}
