From 41f7bdcdf182540b0a9cd796f4c70b9f057adfbb Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 31 Oct 2005 21:37:59 +0000 Subject: [PATCH] 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: --- editor.tcl | 38 ++++++++++++++++++++++---------------- icons/normal/blank.gif | Bin 847 -> 0 bytes initgui.tcl | 2 +- install.sh | 2 +- 4 files changed, 24 insertions(+), 18 deletions(-) delete mode 100755 icons/normal/blank.gif 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 a6657c03bd02096efdfc6b24ba3771e43dc4d414..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 847 zcmchW&r6hH5XV37?z&C*3PH)+vw7Gy$S0BB1r>@S#HG@DBZ;7kZf>!~*0vj~{U8WR z!N7=aqT#`Qoz&2xLr^>$5$Ul@rzkH$LG0ThOi8kL`y-me49pBO-}%5C>^iV(cP2)R zUsTOv5ERIlniX$sUO6pVYtNgu?azrs8!RhjL=1E<;~Qm+nEg%H9{0UoDv0yLwy^+NbewkpkVK}TDyw!F)xs*^w2YTAqQ>j+^BJ2HX_-hCxvxEi zuyq#Va3(#L+gFp1ZpotKQ(mKMyXnNGln!uQU@(I!A?K$Si*ChDn_S9VVB``r1)QM2 zf2!Mctz4SZDT;&&&`+S8!f}dWzeLb%GW^Noxu{dQ5leSkllrJNbG@Ha7Ll&)$D?Ys0of6PY_WT7CSI5Nw 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 -- 2.39.5