[PD-cvs] pd/src desire.tk,1.1.2.600.2.199,1.1.2.600.2.200
chunlee
chunlee at users.sourceforge.net
Sun Jul 1 02:09:03 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5624
Modified Files:
Tag: desiredata
desire.tk
Log Message:
better cursor io approximation
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.199
retrieving revision 1.1.2.600.2.200
diff -C2 -d -r1.1.2.600.2.199 -r1.1.2.600.2.200
*** desire.tk 30 Jun 2007 19:20:08 -0000 1.1.2.600.2.199
--- desire.tk 1 Jul 2007 00:08:58 -0000 1.1.2.600.2.200
***************
*** 1564,1568 ****
set @motion_watch 0
set @iohilite {-1 0 0 0 0}
! set @pointer_sense 2
set @keyprefix 0
}
--- 1564,1568 ----
set @motion_watch 0
set @iohilite {-1 0 0 0 0}
! set @pointer_sense 30
set @keyprefix 0
}
***************
*** 2693,2698 ****
set c [$self widget]
$self motion_checkhairtip $target $x $y
! #eval $@dehighlight
! #set @dehighlight {}
set oldpos $@curpos
set @curpos [list $x $y]
--- 2693,2698 ----
set c [$self widget]
$self motion_checkhairtip $target $x $y
! eval $@dehighlight
! set @dehighlight {}
set oldpos $@curpos
set @curpos [list $x $y]
***************
*** 2833,2875 ****
def Canvas motion_iohilite2 {x y f} {
set c [$self widget]
! set obj [$self identify_closestobj $x $y $f]
! if {$obj < 0} {if {$@dehighlight != ""} {
! set @iohilite [list -1 0 0 0 0]
! eval $@dehighlight}
! return
! }
! mset {x1 y1 x2 y2} [$obj bbox]
! if {$x > $x1 && $x < $x2 && $y > $y1 && $y < $y2} {
! set @iohilite [list -1 0 0 0 0]
! if {$@dehighlight != ""} {eval $@dehighlight}
! set @dehighlight ""
! return
! }
! mset {cx cy} [rect_centre [$obj bbox]]
! if {$y < $cy} {set io i} else {set io o}
! switch $io {
! i {set ports [$obj ninlets]}
! o {set ports [$obj noutlets]}
! }
! if {!$ports} {set io i; set ports [$obj ninlets]}
! set mindist 66666
! set idx 0
! if {!$ports} {return}
! for {set i 0} {$i < $ports} {incr i} {
! set point2 [lmap / [rect_centre [$c bbox ${obj}$io${i}]] $@zoom]
! set point1 [list $x $y]
! set dist [distance $point1 $point2]
! if {$dist < $mindist} {set mindist $dist; set idx $i; mset {iox ioy} $point2}
! }
! $obj hilite_io $io [expr floor($iox)] [expr floor($ioy)]
! set hilite ${obj}$io${idx}b
! set @iohilite [list $obj [expr floor($iox)] [expr floor($ioy)] $io $idx]
! if {$hilite != [lindex $@dehighlight 2]} {
! eval $@dehighlight
! set @dehighlight [list $c delete $hilite]
}
! #set @dehighlight [list $c delete ${obj}$io${idx}b]
! #puts "dehilite is :: $@dehighlight"
! #puts "obj:: $obj :: [$obj text] :: hilite $io :: $idx"
}
--- 2833,2850 ----
def Canvas motion_iohilite2 {x y f} {
set c [$self widget]
! set io [$self identify_closestio $x $y $f]
! if {$io<0} {set @iohilite [list -1 0 0 0 0]; return}
! foreach item {i o} {
! set type_idx [string first $item $io]
! set type [string index $io $type_idx]
! set port [string range $io $type_idx+1 end]
! set object [string range $io 0 $type_idx-1]
! if {$type_idx >= 0} {break}
}
!
! mset {iox ioy} [lmap / [rect_centre [$c bbox $io]] $@zoom]
! set @iohilite [list $object $iox $ioy $type $port]
! $object hilite_io $type $iox $ioy
! set @dehighlight [list $c delete ${io}b]
}
***************
*** 2967,2995 ****
}
! def Canvas identify_closestobj {x y f} {
set c [$self widget]
set cx [expr $x*$@zoom]
set cy [expr $y*$@zoom]
- #set offset 50
set stack [$c find overlapping [expr $cx-$@pointer_sense] [expr $cy-$@pointer_sense] \
[expr $cx+$@pointer_sense] [expr $cy+$@pointer_sense]]
set stack [lreverse $stack]
set objs {}
foreach tag $stack {
set tags [$c gettags $tag]
! if {[regexp {^[xo][0-9a-f]{6,8}} $tags id]} {
! set class [$id class]
! switch $class {
! Wire {} Crosshair {} Tooltip {} Comment {} SelRect {} FutureWire {} Sense {}
! default {lappend objs $id}
! }
! }
}
! set objs [lsort -unique $objs]
! if {![llength $objs]} {return -1}
set mindist 66666
set idx 0; set i 0
! foreach obj $objs {
! set point2 [rect_centre [$obj bbox]]
set point1 [list $x $y]
set dist [distance $point2 $point1]
--- 2942,2965 ----
}
! def Canvas identify_closestio {x y f} {
set c [$self widget]
set cx [expr $x*$@zoom]
set cy [expr $y*$@zoom]
set stack [$c find overlapping [expr $cx-$@pointer_sense] [expr $cy-$@pointer_sense] \
[expr $cx+$@pointer_sense] [expr $cy+$@pointer_sense]]
set stack [lreverse $stack]
+ set ios {}
set objs {}
foreach tag $stack {
set tags [$c gettags $tag]
! if {[regexp {^[x][0-9a-f]{6,8}[oi][0-9]{1,3}} $tags io]} {
! lappend ios $io
! }
}
! if {![llength $ios]} {return -1}
set mindist 66666
set idx 0; set i 0
! foreach io $ios {
! set point2 [rect_centre [$c bbox $io]]
set point1 [list $x $y]
set dist [distance $point2 $point1]
***************
*** 2997,3002 ****
incr i;
}
! return [lindex $objs $idx]
! #puts " mindist:: $mindist || idx:: $idx || [[lindex $objs $idx] text]"
}
--- 2967,2971 ----
incr i;
}
! return [lindex $ios $idx]
}
More information about the Pd-cvs
mailing list