⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ui-display.tcl

📁 rtpmon-1.0a7.tar.gz for UNIX like
💻 TCL
📖 第 1 页 / 共 2 页
字号:
    grid $b -row 0 -column $col -sticky we    # Create a canvas for this column    set c "$t.column$col"    set w 200    set h 100    canvas $c -width $w -height $h -bg grey30 -bd 0 -relief flat \	-highlightthickness 0 -scrollregion "0 0 $w $h" \	-yscrollcommand "update-scrollbar"    grid $c -row 1 -column $col -sticky wens    grid columnconfigure $t $col -weight 1 -minsize 100    set f [frame $c.frame]    $c create window 0 0 -anchor nw -window $f    set Widgets(column$col) $f    # need to re-set State(listeners) since the presence of a new    # sender may add some listeners (or this may be the first sender)    set State(listeners) [getlisteners]    # create data elements for each listener    set i 0    foreach l $State(listeners) {	CreateDataElement $f $s $l $n $i	incr i    }    # Create median watching label    set lab "$t.median$col"    label $lab -height 1 -relief ridge -bd 1 -highlightthickness 0 \	-textvariable median($s) -font [resource smallfont]    grid $lab -row 2 -column $col -sticky we    set scol [expr $col + 1]    # put the scrollbar back    grid $t.scrolly -row 1 -column $scol -sticky ns    grid columnconfigure $t $scol -weight 0 -minsize [winfo reqwidth $t.scrolly]    # make sure geometry is set up right    update-scrollregion        # add this sender to the sorting choices in the menu    refreshSenderMenu    trace variable names($s) w sender-namechange}proc sender-namechange {name1 name2 op} {    refreshSenderMenu}proc ignore-sender s {    global State Widgets mon    $mon ignore $s    set State(senders) [getsenders]    # remove one sender column    set t $Widgets(topdisplay)    set idx [expr [llength $State(senders)] +1]    destroy $t.sender$idx    destroy $t.column$idx    destroy $t.median$idx    # move the scrollbar    grid columnconfigure $t [expr $idx +1] -minsize 0 -weight 0    grid configure $t.scrolly -row 1 -column $idx -sticky ns    grid columnconfigure $t $idx -weight 0 \	-minsize [winfo reqwidth $t.scrolly]    set i 1    foreach s $State(senders) {	# fix senders' labels	set b $t.sender$i	$b configure -textvariable names($s)	bind $b <Button-1> "CreateInfoWindow $s"	$b.menu entryconfigure 0 -command "CreateInfoWindow $s"	$b.menu entryconfigure 1 -command "ignore-sender $s"	# fix medians	$t.median$i configure -textvariable medians($s)	incr i    }    # fix data elements    reset-labels    # fix geometry    update-scrollregion}proc new-listener {l} {    global mon Widgets State names    set State(listeners) [getlisteners]    set n $State(listenerCount)    incr State(listenerCount)    set w $Widgets(column0)    # Create the button with the listener's name    set b $w.recv$n    label $b -anchor w -highlightthickness 0 -bd 1 -relief raised \	-textvariable names($l) -anchor w -font [resource smallfont]    bind $b <Enter> "$b conf -bg [option get . activeBackground Rtpmon]"    bind $b <Leave> "$b conf -bg [option get . background Rtpmon]"    bind $b <Button-1> "CreateInfoWindow $l"    grid $b -row $n -column 0 -sticky we    $Widgets(topdisplay).column0 config \	-height [winfo reqheight $Widgets(column0)]    set i 1    foreach s $State(senders) {	set c $Widgets(column$i)	# create new data element	CreateDataElement $c $s $l [expr $i - 1] $n	incr i    }    # make sure geometry is set up right    update-scrollregion}## create the data element for a listener-sender pair in the data table# proc CreateDataElement {w sender listener sidx lidx} {    global mon stats    set b "$w.data:${sidx}:${lidx}"    if {![winfo exists $b]} { 	# Create the button (data element)	label $b -height 1 -relief ridge -bd 1 -highlightthickness 0 \	    -font [resource smallfont]	# make this label pretend to be a buton	bind $b <Enter> "$b conf -bg [option get . activeBackground Rtpmon]"	bind $b <Leave> "$b conf -bg [option get . background Rtpmon]"		set row $lidx	set col [expr $sidx+1]#	grid $b -row $row -column $col -sticky nsew -padx 0 -pady 0	pack $b -padx 0 -pady 0 -fill x -expand 0    }    bind $b <Button-1> "toggleStripWindow $sender $listener"    $b conf -textvariable stats(${listener}:${sender})    return $b}proc clean-inactive {} {    global mon State Widgets    set disabled [option get . disabledForeground Rtpmon]    set enabled [option get . foreground Rtpmon]    set inactives [$mon inactive]    # dim inactive senders    set i 1    foreach s $State(senders) {	if {[lsearch $inactives $s] == -1} {	    $Widgets(topdisplay).sender$i config -fg $enabled	    # XXX undim the column?	} else {	    $Widgets(topdisplay).sender$i config -fg $disabled	    # XXX dim the whole column?	}	incr i    }        # dim inactive listeners    set i 0    foreach l $State(listeners) {	if {[lsearch $inactives $l] == -1} {	    $Widgets(column0).recv$i config -fg $enabled	    # XXX undim the row?	} else {	    $Widgets(column0).recv$i config -fg $disabled	    # XXX dim the row?	}	incr i    }}proc periodic-clean-inactive {interval} {    clean-inactive    after $interval periodic-clean-inactive $interval}proc reset-labels {} {    global State Widgets    set w $Widgets(column0)    set i 0    foreach l $State(listeners) {	set b $w.recv$i	$b config -textvariable names($l)	bind $b <Button-1> "CreateInfoWindow $l"	set j 0	foreach s $State(senders) {	    set b $Widgets(topdisplay).column[expr $j + 1].frame.data:$j:$i	    $b config -textvariable stats($l:$s)	    bind $b <Button-1> "toggleStripWindow $s $l"	    incr j	}	incr i    }    # fix the inactive dimming    clean-inactive}proc sort-display {} {    global mon State    $mon sort    set State(senders) [getsenders]    set State(listeners) [getlisteners]    reset-labels}proc periodic-sort {} {    global Prefs    if {$Prefs(autosort)} {	sort-display	after [expr 1000 * $Prefs(autosortInterval)] periodic-sort    }}proc clean-display {} {    global mon State Widgets    set w $Widgets(column0)    set t $Widgets(topdisplay)    set oldlcount $State(listenerCount)    set oldscount [expr [llength $State(senders)] + 1]    $mon clean    set State(senders) [getsenders]    set State(listeners) [getlisteners]    set State(listenerCount) [llength $State(listeners)]    # kill old senders    set newcount [expr [llength $State(senders)] + 1]    for {set i $newcount} {$i < $oldscount} {incr i} {	destroy $t.sender$i	destroy $t.column$i	destroy $t.median$i	grid columnconfigure $t $i -minsize 0 -weight 0    }    grid columnconfigure $t $oldscount -minsize 0 -weight 0    # fix labels on remaining senders    set i 1    foreach s $State(senders) {	set b $Widgets(topdisplay).sender$i	$b config -textvariable names($s)	bind $b <Button-1> "CreateInfoWindow $s"	$b.menu entryconfigure 0 -command "CreateInfoWindow $s"	$b.menu entryconfigure 1 -command "ignore-sender $s"	incr i    }    # move the scrollbar back    grid configure $t.scrolly -row 1 -column $newcount -sticky ns    grid columnconfigure $t $newcount -weight 0 \	-minsize [winfo reqwidth $t.scrolly]    # kill old listeners    for {set i $State(listenerCount)} {$i < $oldlcount} {incr i} {	grid forget $w.recv$i	destroy $w.recv$i		set j 0	foreach s $State(senders) {	    destroy $t.column[expr $j + 1].frame.data:$j:$i	    incr j	}    }    # fix those that are left    reset-labels    update-scrollregion}proc periodic-clean {} {    global Prefs    if {$Prefs(autoclean)} {	clean-display	after [expr 1000 * $Prefs(autocleanInterval)] periodic-clean    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -