📄 node.tk
字号:
-height [nodeDisplayHeightGet $nodeframe]}proc nodeReCreate { nodeframe } { global canvas sysview if {[string compare $nodeframe ""] == 0} { return } set nodename [nodeNameGet $nodeframe] set cframe [nodeClusterFrameGet $nodeframe] set viewType [nodeViewTypeGet $nodeframe] if {[string compare $cframe ""] != 0} { set sysframe [clusterSystemFrameGet $cframe] set sitename [systemNameGet $sysframe] nodeViewTypePut $nodeframe $sysview($sitename) systemNodeFramePut $sysframe $nodename $nodeframe $viewType } switch -exact -- $viewType { MIRROR { set label_font $canvas(bigLabelFont) set label_font_width $canvas(bigLabelFontWidth) set label_font_height $canvas(bigLabelFontHeight) set maxWidth $canvas(mirrorMaxWidth) set maxHeight $canvas(mirrorMaxHeight) set text_width $canvas(bigTextFontWidth) set text_height $canvas(bigTextFontHeight) } FULL { set label_font $canvas(smallLabelFont) set label_font_width $canvas(smallLabelFontWidth) set label_font_height $canvas(smallLabelFontHeight) set maxWidth $canvas(nodeMaxWidth) set maxHeight $canvas(nodeMaxHeight) set text_width $canvas(smallTextFontWidth) set text_height $canvas(smallTextFontHeight) } ICON { set label_font $canvas(smallLabelFont) set label_font_width $canvas(smallLabelFontWidth) set label_font_height $canvas(smallLabelFontHeight) set maxWidth $canvas(iconMaxWidth) set maxHeight $canvas(iconMaxHeight) set text_width $canvas(smallTextFontWidth) set text_height $canvas(smallTextFontHeight) } default { set label_font $canvas(smallLabelFont) set label_font_width $canvas(smallLabelFontWidth) set label_font_height $canvas(smallLabelFontHeight) set text_width $canvas(smallTextFontWidth) set text_height $canvas(smallTextFontHeight) set maxWidth 0 set maxHeight 0 } } set basicWidth $maxWidth set basicHeight $maxHeight set nodelabel [nodeLabelGet $nodeframe] if { [string compare $viewType "ICON"] == 0 } { set nodelabel [lindex [split $nodelabel .] 0] $nodeframe.lf.label configure -text $nodelabel -justify left \ -font $label_font -anchor nw } else { set nodelabel [lindex [split $nodelabel .] 0] $nodeframe.lf.label configure -text $nodelabel -justify center \ -font $label_font -anchor c } set clusterframe [nodeClusterFrameGet $nodeframe] bind_canvas $nodeframe.cf.c.canvas set labelWidth \ [expr 2*$canvas(smallBd) + 2*$canvas(smallLabelBd) + \ $label_font_width*[string length $nodelabel]] set labelHeight [expr $canvas(smallBd) + 2*$canvas(smallLabelBd) + \ + $label_font_height] $nodeframe.cf.c.canvas configure -width $basicWidth \ -height $basicHeight \ -xscrollcommand [list $nodeframe.cf.x.xscroll set] \ -yscrollcommand [list $nodeframe.cf.y.yscroll set] \ -confine 1 set nodestat [systemNodeStatusGet $sysframe $nodename] set nodetype [nodeTypeGet $nodeframe] if { [string compare $nodetype MOM] == 0 || \ [string compare $nodetype MOM_SNODE] == 0 } { if {[string compare $viewType MIRROR] != 0 } { nodeUpdateStat $sysframe $nodename $nodestat NOINFO } else { nodeNoInfo $nodeframe } } else { if {[string compare $viewType MIRROR] != 0} { nodeUpdateStat $sysframe $nodename $nodestat FREE } else { nodeUp $nodeframe } } set canvasFrameWidth [expr $canvas(smallBd) + \ 2*$canvas(smallCanvasBd)] set canvasFrameHeight [expr 2*$canvas(smallCanvasBd)] $nodeframe.cf.x.xscroll configure \ -width $text_height \ -command [list $nodeframe.cf.c.canvas xview] set xscroll $nodeframe.cf.x.xscroll set scrollHeight [expr $canvas(smallBd) + \ 2*[lindex [$nodeframe.cf.x.xscroll configure -borderwidth] end] \ + [lindex [$nodeframe.cf.x.xscroll configure -width] end]] $nodeframe.cf.x configure -height $scrollHeight $nodeframe.cf.y.yscroll configure \ -width $text_height \ -command [list $nodeframe.cf.c.canvas yview] set yscroll $nodeframe.cf.y.yscroll set scrollWidth [expr $canvas(smallBd) + \ 2*[lindex [$nodeframe.cf.y.yscroll configure -borderwidth] end] \ + [lindex [$nodeframe.cf.y.yscroll configure -width] end]] $nodeframe.cf.y configure -width $scrollWidth set width [expr $canvasFrameWidth + $basicWidth + $scrollWidth] if {$labelWidth > $width} { set width $labelWidth } nodeCanvasWidthPut $nodeframe $basicWidth nodeDisplayWidthPut $nodeframe $width if {$width > $maxWidth} { set canvWidth [expr $maxWidth - \ $canvasFrameWidth - $scrollWidth] if {$canvWidth > 0} { nodeCanvasWidthPut $nodeframe $canvWidth nodeDisplayWidthPut $nodeframe $maxWidth $nodeframe.cf.c.canvas configure -width $canvWidth set width $maxWidth } } set height [expr $labelHeight + $canvasFrameHeight + $basicHeight + \ $scrollHeight] nodeCanvasHeightPut $nodeframe $basicHeight nodeDisplayHeightPut $nodeframe $height if {$height > $maxHeight} { set canvHeight [expr $maxHeight - \ $labelHeight - $canvasFrameHeight - $scrollHeight] if {$canvHeight > 0} { nodeCanvasHeightPut $nodeframe $canvHeight nodeDisplayHeightPut $nodeframe $maxHeight $nodeframe.cf.c.canvas configure -height $canvHeight set height $maxHeight } } set scrollRegionWidth [nodeScrollRegionWidthGet $nodeframe] set scrollRegionHeight [nodeScrollRegionHeightGet $nodeframe] set canvWidth [nodeCanvasWidthGet $nodeframe] catch {pack forget $xscroll} if {[string compare $viewType ICON] != 0 && \ $scrollRegionWidth > $canvWidth} { catch {pack $xscroll -side bottom -fill x -padx 0 -pady 0 \ -ipadx 0 -ipady 0} } set canvHeight [nodeCanvasHeightGet $nodeframe] catch {pack forget $yscroll} if {[string compare $viewType ICON] != 0 && \ $scrollRegionHeight > $canvHeight} { catch {pack $yscroll -side right -fill y -padx 0 -pady 0 -ipadx 0 -ipady 0 -anchor nw} } if {[string compare $viewType ICON] == 0} { nodeCoverCanvas $nodeframe } else { nodeUnCoverCanvas $nodeframe } return [list $width $height]}proc nodeCoverCanvas {nodeframe} { if {[string compare $nodeframe ""] == 0} { return } set canv [nodeCanvasGet $nodeframe] set width [nodeScrollRegionWidthGet $nodeframe] set height [nodeScrollRegionHeightGet $nodeframe] if {[string compare $canv ""] == 0 || \ [string compare $width ""] == 0 || \ [string compare $height ""] == 0} { return } catch {$canv delete $nodeframe.cover} $canv create rect -1 -1 $width $height \ -fill [lindex [$canv configure -bg] end] \ -tag $nodeframe.cover}proc nodeUnCoverCanvas {nodeframe} { if {[string compare $nodeframe ""] == 0} { return } set canv [nodeCanvasGet $nodeframe] if {[string compare $canv ""] == 0} { return } catch {$canv delete $nodeframe.cover}}proc nodeReCoverCanvas {nodeframe} { if {[string compare $nodeframe ""] == 0} { return } set canv [nodeCanvasGet $nodeframe] if {[string compare $canv ""] == 0} { return } catch {$canv delete $nodeframe.cover} $canv itemconfigure $nodeframe.cover \ -fill [lindex [$canv configure -bg] end] \ -tag $nodeframe.cover}proc nodeRefreshGet nodeframe { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(refresh)]} { return 0 } return [set ${array}(refresh)]}proc nodeRefreshPut {nodeframe flag} { set array [string trimleft $nodeframe .] global $array set ${array}(refresh) $flag}proc nodeNameGet nodeframe { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(name)]} { return "" } return [set ${array}(name)]}proc nodeNamePut {nodeframe name} { set array [string trimleft $nodeframe .] global $array set ${array}(name) $name}proc nodeLabelFramePut {nodeframe frame} { set array [string trimleft $nodeframe .] global $array set ${array}(labelFrame) $frame}proc nodeLabelFrameGet {nodeframe} { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(labelFrame)]} { return "" } return [set ${array}(labelFrame)]}proc nodeLabelGet nodeframe { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(label)]} { return "" } return [set ${array}(label)]}proc nodeLabelPut {nodeframe label} { set array [string trimleft $nodeframe .] global $array set ${array}(label) $label}proc nodeTypeGet nodeframe { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(type)]} { return "" } return [set ${array}(type)]}proc nodeTypePut {nodeframe type} { set array [string trimleft $nodeframe .] global $array set ${array}(type) $type}proc nodeViewTypeGet nodeframe { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(viewType)]} { return "" } return [set ${array}(viewType)]}proc nodeViewTypePut {nodeframe type} { set array [string trimleft $nodeframe .] global $array set ${array}(viewType) $type}proc nodeCanvasFrameGet {nodeframe} { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(canvasFrame)]} { return "" } return [set ${array}(canvasFrame)]}proc nodeCanvasFramePut {nodeframe frame} { set array [string trimleft $nodeframe .] global $array set ${array}(canvasFrame) $frame}proc nodeCanvasGet nodeframe { set array [string trimleft $nodeframe .] global $array if {![info exists ${array}(canvas)]} { return "" } return [set ${array}(canvas)]}proc nodeCanvasPut {nodeframe canvas} { set array [string trimleft $nodeframe .] global $array set ${array}(canvas) $canvas}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -