Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23677
Modified Files: Tag: devel_0_39 desire.tk Log Message: class_new Crosshair {View}
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.446 retrieving revision 1.1.2.447 diff -C2 -d -r1.1.2.446 -r1.1.2.447 *** desire.tk 1 Sep 2006 18:42:46 -0000 1.1.2.446 --- desire.tk 1 Sep 2006 19:32:32 -0000 1.1.2.447 *************** *** 1279,1283 **** $self subscribe $manager $self changed ! $self canvas= $self ;#!@#$ EEVIL #not sure if init should be calling pd, but it fixes the editmode bug for now -chun pd .$self editmode $@editmode --- 1279,1283 ---- $self subscribe $manager $self changed ! #$self canvas= $self ;#!@#$ EEVIL #not sure if init should be calling pd, but it fixes the editmode bug for now -chun pd .$self editmode $@editmode *************** *** 1292,1295 **** --- 1292,1296 ---- set @keynav_tab_sel "wire" set @copy_count 0 + set @crosshair [Crosshair new $self] }
*************** *** 1456,1462 **** set y [expr [$c canvasy [expr [winfo pointery $c] - [winfo rooty $c]]]/$@zoom] set target [$self identify_target $x $y 0] ! $self show_crosshair $x $y $target } else { ! $self hide_crosshair } } --- 1457,1464 ---- set y [expr [$c canvasy [expr [winfo pointery $c] - [winfo rooty $c]]]/$@zoom] set target [$self identify_target $x $y 0] ! $@crosshair data= $x $y $target ! $@crosshair draw } else { ! $@crosshair erase } } *************** *** 2023,2027 **** set canvas(current) $self set c [$self widget] ! if {[$self look hairstate] && $@editmode} {$self show_crosshair $x $y $target} else {$self hide_crosshair} if {$tooltip(visible)} { if {[expr [distance $tooltip(curpos) [list $x $y]] > 10]} { --- 2025,2034 ---- set canvas(current) $self set c [$self widget] ! if {[$self look hairstate] && $@editmode} { ! $@crosshair data= $x $y $target ! $@crosshair draw ! } else { ! $@crosshair erase ! } if {$tooltip(visible)} { if {[expr [distance $tooltip(curpos) [list $x $y]] > 10]} { *************** *** 4519,4598 **** ############ crosshair
! def Canvas show_crosshair {x y target} { ! global crosshair ! set c [$self widget] ! set width [expr [winfo width $c]/$@zoom] ! set height [expr [winfo height $c]/$@zoom] ! mset {x1 y1 x2 y2} [$c cget -scrollregion] ! set x1 [expr $x1/$@zoom] ! set y1 [expr $y1/$@zoom] ! mset {vx1 vx2} [$c xview] ! mset {vy1 vy2} [$c yview] ! set xoff [expr ([winfo width $c] * $vx1)/$@zoom] ! set yoff [expr ([winfo height $c] * $vy1)/$@zoom] ! set vx1 [expr ($x1+($x2-$x1)*$vx1)/$@zoom] ! set vy1 [expr ($y1+($y2-$y1)*$vy1)/$@zoom] ! set vx2 [expr ($x1+($x2-$x1)*$vx2)/$@zoom] ! set vy2 [expr ($y1+($y2-$y1)*$vy2)/$@zoom] ! mset {type id detail} $target ! if {[$self look hairsnap]} { ! switch -regexp -- $type { ! ^object|outlet|inlet$ { ! if {$id != $self} { ! mset {x y x3 y3} [$id bbox] ! set crosshair(follow) $id ! } ! } ! ^move|edit$ {mset {x y x3 y3} [$crosshair(follow) bbox]} ! } ! } ! ! set v1 [list $x $y1 $x [expr $y + ($height +$yoff)]] ! set h1 [list $x1 $y [expr $x + ($width +$xoff)] $y] ! #set v1 [list $x $y1 $x $vy2] ! #set h1 [list $x1 $y $vx2 $y] ! $self item VHAIR1 line $v1 -fill [$self look crosshair] -width 0.5 -dash {4 4 4 4} ! $self item HHAIR1 line $h1 -fill [$self look crosshair] -width 0.5 -dash {4 4 4 4} }
! def Canvas show_crosshair2 {x y target} { ! global crosshair ! set c [$self widget] ! set width [expr [winfo width $c]/$@zoom] ! set height [expr [winfo height $c]/$@zoom] mset {x1 y1 x2 y2} [$c cget -scrollregion] ! mset {vx1 vx2} [$c xview] mset {vy1 vy2} [$c yview] ! #set xoff [expr ([winfo width $c] * $vx1)/$@zoom] ! #set yoff [expr ([winfo height $c] * $vy1)/$@zoom] ! set vx1 [expr ($x1+($x2-$x1)*$vx1)/$@zoom] ! set vy1 [expr ($y1+($y2-$y1)*$vy1)/$@zoom] ! set vx2 [expr ($x1+($x2-$x1)*$vx2)/$@zoom] ! set vy2 [expr ($y1+($y2-$y1)*$vy2)/$@zoom] ! mset {type id detail} $target ! if {[$self look hairsnap])} { switch -regexp -- $type { ^object|outlet|inlet$ { if {$id != $self} { mset {x y x3 y3} [$id bbox] ! set crosshair(follow) $id } } ! ^move|edit$ {mset {x y x3 y3} [$crosshair(follow) bbox]} } } ! set v1 [list $x $vy1 $x $vy2] ! set h1 [list $vx1 $y $vx2 $y] ! #set v1 [list $x [expr $y - $y + $yoff] $x [expr $y + ($height +$yoff)]] ! #set h1 [list [expr $x - $x + $xoff] $y [expr $x + ($width +$xoff)] $y] ! #$self item BORDER rect [list $vx1 $vy1 $vx2 $vy2] -width 10 ! $self item VHAIR1 line $v1 -fill [$self look selectframe] -width 0.5 -dash {4 4 4 4} ! $self item HHAIR1 line $h1 -fill [$self look selectframe] -width 0.5 -dash {4 4 4 4} }
! ! def Canvas hide_crosshair {} {$self item_delete VHAIR1; $self item_delete HHAIR1}
############ tooltips --- 4526,4591 ---- ############ crosshair
! class_new Crosshair {View} ! ! def Crosshair init {canvas} { ! super ! set @canvas $canvas ! set @x 0 ! set @y 0 ! set @target {none} }
+ def Crosshair data= {x y target} { + set @x $x + set @y $y + set @target $target + }
! def Crosshair draw {} { ! set c [$@canvas widget] ! set z [$@canvas zoom] ! set width [expr [winfo width $c]/$z] ! set height [expr [winfo height $c]/$z] mset {x1 y1 x2 y2} [$c cget -scrollregion] ! set x1 [expr $x1/$z] ! set y1 [expr $y1/$z] mset {vx1 vx2} [$c xview] mset {vy1 vy2} [$c yview] ! set xoff [expr ([winfo width $c] * $vx1)/$z] ! set yoff [expr ([winfo height $c] * $vy1)/$z] ! set vx1 [expr ($x1+($x2-$x1)*$vx1)/$z] ! set vy1 [expr ($y1+($y2-$y1)*$vy1)/$z] ! set vx2 [expr ($x1+($x2-$x1)*$vx2)/$z] ! set vy2 [expr ($y1+($y2-$y1)*$vy2)/$z] ! mset {type id detail} $@target ! ! set x $@x ! set y $@y ! if {[$@canvas look hairsnap]} { switch -regexp -- $type { ^object|outlet|inlet$ { if {$id != $self} { mset {x y x3 y3} [$id bbox] ! set @follow $id } } ! ^move|edit$ {mset {x y x3 y3} [$@follow bbox]} } } ! ! set v1 [list $x $y1 $x [expr $y+$height+$yoff]] ! set h1 [list $x1 $y [expr $x+$width+$xoff] $y] ! #set v1 [list $x $y1 $x $vy2] ! #set h1 [list $x1 $y $vx2 $y] ! #set v1 [list $x $vy1 $x $vy2] ! #set h1 [list $vx1 $y $vx2 $y] ! #set v1 [list $x [expr $y - $y + $yoff] $x [expr $y + ($height +$yoff)]] ! #set h1 [list [expr $x - $x + $xoff] $y [expr $x + ($width +$xoff)] $y] ! $self item VHAIR1 line $v1 -fill [$@canvas look crosshair] -width 0.5 -dash {4 4 4 4} ! $self item HHAIR1 line $h1 -fill [$@canvas look crosshair] -width 0.5 -dash {4 4 4 4} ! #$self item BORDER rect [list $vx1 $vy1 $vx2 $vy2] -width 10 }
! #def Crosshair erase {} {$self item_delete VHAIR1; $self item_delete HHAIR1}
############ tooltips