From: marko Date: Mon, 31 Oct 2005 21:37:59 +0000 (+0000) Subject: Pointers to cross-canvas links now do not need a blank image to be X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=41f7bdcdf182540b0a9cd796f4c70b9f057adfbb;p=imunes.git Pointers to cross-canvas links now do not need a blank image to be selected. Bug found by: Submitted by: Requested by: Reviewed by: Approved by: Obtained from: --- diff --git a/editor.tcl b/editor.tcl index 15d5351..1bfb8aa 100755 --- a/editor.tcl +++ b/editor.tcl @@ -446,17 +446,19 @@ proc redrawLink { link } { proc selectNode { c obj } { set node [lindex [$c gettags $obj] 1] $c addtag selected withtag "node && $node" - set ox [lindex [$c coords $obj] 0] - set oy [lindex [$c coords $obj] 1] - set image [$c itemcget $obj -image] - set h [image height $image] - set w [image width $image] - set bx1 [expr $ox - $w / 2 - 4] - set bx2 [expr $ox + $w / 2 + 4] - set by1 [expr $oy - $h / 2 - 4] - set by2 [expr $oy + $h / 2 + 4] + if { [nodeType $node] == "pseudo" } { + set bbox [$c bbox "nodelabel && $node"] + } else { + set bbox [$c bbox "node && $node"] + } + set bx1 [expr [lindex $bbox 0] - 2] + set by1 [expr [lindex $bbox 1] - 2] + set bx2 [expr [lindex $bbox 2] + 2] + set by2 [expr [lindex $bbox 3] + 2] + $c delete -withtags "selectmark && $node" $c create line $bx1 $by1 $bx2 $by1 $bx2 $by2 $bx1 $by2 $bx1 $by1 \ -dash {6 4} -fill black -width 1 -tags "selectmark $node" + return } @@ -643,10 +645,12 @@ proc button1 { c x y button } { set curobj [$c find withtag current] set curtype [lindex [$c gettags current] 0] - if { $curtype == "node" } { - set node [lindex [$c gettags {node && current}] 1] + if { $curtype == "node" || ( $curtype == "nodelabel" && + [nodeType [lindex [$c gettags $curobj] 1]] == "pseudo") } { + set node [lindex [$c gettags current] 1] set wasselected \ - [expr [lsearch [$c find withtag "selected"] $curobj] > -1] + [expr [lsearch [$c find withtag "selected"] \ + [$c find withtag "node && $node"]] > -1] if { $button == "ctrl" } { if {$wasselected} { $c dtag $node selected @@ -657,7 +661,7 @@ proc button1 { c x y button } { $c delete -withtags selectmark } if { $activetool == "select" && !$wasselected } { - $c delete -withtags "selectmark && $node" + $c delete -withtags "selectmark" selectNode $c $curobj } } elseif { $button != "ctrl" || $activetool != "select" } { @@ -721,7 +725,7 @@ proc button1-motion { c x y } { set curtype [lindex [$c gettags current] 0] if {$activetool == "link" && $newlink != ""} { $c coords $newlink $lastX $lastY $x $y - } elseif {($activetool == "select" ) && \ + } elseif { $activetool == "select" && \ ( $curobj == $selectbox || $curobj == $background )} { if {$selectbox == ""} { set selectbox [$c create line \ @@ -732,14 +736,16 @@ proc button1-motion { c x y } { $c coords $selectbox \ $lastX $lastY $x $lastY $x $y $lastX $y $lastX $lastY } - } elseif {$activetool == "select" && $curtype == "nodelabel"} { + } elseif { $activetool == "select" && $curtype == "nodelabel" \ + && [nodeType [lindex [$c gettags $curobj] 1]] != "pseudo" } { $c move $curobj [expr $x-$lastX] [expr $y-$lastY] set changed 1 set lastX $x set lastY $y } else { - foreach img [$c find withtag "selectmark"] { + foreach img [$c find withtag "selected"] { set node [lindex [$c gettags $img] 1] + set img [$c find withtag "selectmark && $node"] $c move $img [expr $x-$lastX] [expr $y-$lastY] set img [$c find withtag "node && $node"] $c move $img [expr $x-$lastX] [expr $y-$lastY] diff --git a/icons/normal/blank.gif b/icons/normal/blank.gif deleted file mode 100755 index a6657c0..0000000 Binary files a/icons/normal/blank.gif and /dev/null differ diff --git a/initgui.tcl b/initgui.tcl index 7b81405..9ae02db 100755 --- a/initgui.tcl +++ b/initgui.tcl @@ -268,7 +268,7 @@ foreach b {select link hub lanswitch router host pc rj45} { foreach b {router host pc hub lanswitch frswitch rj45} { set $b [image create photo -file $ROOTDIR/$LIBDIR/icons/normal/$b.gif] } -set pseudo [image create photo -file $ROOTDIR/$LIBDIR/icons/normal/blank.gif] +set pseudo [image create photo] frame .grid diff --git a/install.sh b/install.sh index a2a52b7..a883daf 100755 --- a/install.sh +++ b/install.sh @@ -33,7 +33,7 @@ tiny_icons="delete.gif hub.gif frswitch.gif host.gif \ lanswitch.gif link.gif pc.gif rj45.gif router.gif select.gif" normal_icons="hub.gif frswitch.gif host.gif lanswitch.gif pc.gif \ - rj45.gif router.gif blank.gif" + rj45.gif router.gif" for file in ${lib_files}; do