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
}
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
$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" } {
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 \
$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]