]> git.entuzijast.net Git - imunes.git/commitdiff
Pointers to cross-canvas links now do not need a blank image to be
authormarko <marko>
Mon, 31 Oct 2005 21:37:59 +0000 (21:37 +0000)
committermarko <marko>
Mon, 31 Oct 2005 21:37:59 +0000 (21:37 +0000)
selected.

Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

editor.tcl
icons/normal/blank.gif [deleted file]
initgui.tcl
install.sh

index 15d53511641691a4c935f7bb82f4103932b720cf..1bfb8aad942221d2547b620db443a9f0d4cca48e 100755 (executable)
@@ -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 (executable)
index a6657c0..0000000
Binary files a/icons/normal/blank.gif and /dev/null differ
index 7b8140514f949fb5cebcabf19506913b6f95e85c..9ae02db4a941b84b314c88e9140523aed5040f45 100755 (executable)
@@ -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
index a2a52b7b9b08bf2d0e40387b2f319dbaf6b0e4c6..a883daf342ef7152df2199f5acc3d1748233e385 100755 (executable)
@@ -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