📄 ui-strip.tcl
字号:
## Copyright (c) 1996 The Regents of the University of California.# All rights reserved.## Permission to use, copy, modify, and distribute this software and its# documentation for any purpose, without fee, and without written agreement# is hereby granted, provided that the above copyright notice and the# following two paragraphs appear in all copies of this software.## IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING# OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE# UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.## THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.### $Id: ui-strip.tcl,v 1.7 1997/01/11 01:31:45 aswan Exp $# ToDo:# display all data parameters# loss percentage should always have 0% to 100% range# proc toggleStripWindow {sender listener} { set w ".strip:$sender:$listener" if {![winfo exists $w]} { CreateStripInfo $w $sender $listener } if [winfo ismapped $w] { wm withdraw $w } else { wm deiconify $w }}proc updateStripLabels {w min max tick_interval} { $w.lbl.max configure -text [format %0.1f $max] $w.lbl.min configure -text [format %0.1f $min]}proc updateStrip {w s l} { global mon Prefs State # LATER: update the IP address, last packet and data labels for {set i 0} {$i < [llength $State(displayParams)]} {incr i} { $w.data$i.strip set [getdata $i $s $l] } after 5000 updateStrip $w $s $l}proc CreateStripInfo {w sender recv} { global mon Prefs State set recvname [$recv name] set sendname [$sender name] toplevel $w wm title $w "stripchart: $recvname" # wm geometry $w 175x200 wm minsize $w 200 350 frame $w.info label $w.sess -text "Session: $State(title)" -anchor w -padx 2 \ -font [resource smallfont] label $w.send -text "Sender: $sendname" -anchor w -padx 2 \ -font [resource smallfont] label $w.title -text "Receiver: $recvname" -anchor w -padx 2 \ -font [resource smallfont] # label $w.ip -text "IP address: unknown" -anchor w -padx 2 -pady 2 # foreach i [$recv info] # if {[lindex $i 0] == "address"} # $w.ip configure -text "IP address: [lindex $i 1]" pack configure $w.sess $w.send $w.title -side top -anchor w -in $w.info pack $w.info -pady 1m set datacount 0 foreach p $State(displayParams) { set f [frame $w.data$datacount -width 150 -relief ridge -bd 2] # LATER: display the stat's average value over the displayed interval label $f.title -text [lindex $p 1] -font [resource smallfont] stripchart $f.strip -width 5 -height 75 -relief raised -bd 1 \ -max 20.0 -min 0.0 -autoscale 1 \ -rescale_command "updateStripLabels $f" pack $f.title -side top -fill x pack $f.strip -side right -anchor w -fill both -expand 1 if {[string first "Loss" [lindex $p 0]] != -1} { $f.strip configure -autoscale 0 -min 0.0 -max 100.0 } frame $f.lbl label $f.lbl.max -text [lindex [$f.strip configure -max] 4] \ -anchor e -padx 0 -pady 0 -font [resource smallfont] label $f.lbl.min -text [lindex [$f.strip configure -min] 4] \ -anchor e -padx 0 -pady 0 -font [resource smallfont] pack $f.lbl.max -side top -anchor se pack $f.lbl.min -side bottom -anchor ne pack $f.lbl -side left -anchor e -fill both pack $f -side top -fill both -expand 1 -padx 1m -pady 2 incr datacount } frame $w.buttons pack $w.buttons -side bottom -pady 1m set src [$sender address] set dest [$recv address] if {$State(mtrace) == 1} { button $w.buttons.mtrace -text Mtrace -font [resource smallfont] \ -command "CreateMtraceWindow $w.tracewin $src $dest" pack $w.buttons.mtrace -side left -expand 1 } button $w.buttons.dismiss -text Dismiss -font [resource smallfont] \ -command "toggleWindow $w" pack $w.buttons.dismiss -side left -expand 1 # Setup an update command for the stripcharts updateStrip $w $sender $recv}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -