Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19111
Modified Files: Tag: devel_0_39 desire.tk Log Message: wire fixes
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.364 retrieving revision 1.1.2.365 diff -C2 -d -r1.1.2.364 -r1.1.2.365 *** desire.tk 18 Aug 2006 02:51:19 -0000 1.1.2.364 --- desire.tk 18 Aug 2006 03:50:42 -0000 1.1.2.365 *************** *** 1031,1035 **** set scale [$@canvas scale] set coords [lmap * $coords $scale] ! set find [lsearch $args "-width"] if {$find >= 0} { --- 1031,1035 ---- set scale [$@canvas scale] set coords [lmap * $coords $scale] ! puts " coords::$coords" set find [lsearch $args "-width"] if {$find >= 0} { *************** *** 1290,1294 **** set @keynav_current 0 set @keynav_last 0 ! set @shift_wires {} set @keynav_tab_sel "wire" } --- 1290,1294 ---- set @keynav_current 0 set @keynav_last 0 ! #set @shift_wires {} set @keynav_tab_sel "wire" } *************** *** 1408,1412 **** def* Canvas unmap {} {}
! def Canvas scroll {axis diff} {.$self.c [list $axis]view scroll $diff units} def Canvas reload {} {pd ".$self map 0; .$self map 1"}
--- 1408,1425 ---- def* Canvas unmap {} {}
! def Canvas scroll {axis diff} { ! global crosshair ! set c .$self.c ! $c [list $axis]view scroll $diff units ! if {$crosshair(hairstate) && $@editmode} { ! set c .$self.c ! set x [expr [$c canvasx [expr [winfo pointerx $c] - [winfo rootx $c]]]/$@scale] ! set y [expr [$c canvasy [expr [winfo pointery $c] - [winfo rooty $c]]]/$@scale] ! set target [$self identify_target $x $y 0] ! $self show_crosshair $x $y $target ! } else { ! $self hide_crosshair ! } ! } def Canvas reload {} {pd ".$self map 0; .$self map 1"}
*************** *** 1873,1878 **** def Canvas motion_wrap {x y f} { set c .$self.c - #if {$@crosshair} {$self show_crosshair [expr [$c canvasx $x]/$@scale] [expr [$c canvasy $y]/$@scale]} - #if {$@crosshair} {$self show_crosshair $x $y} set x [expr [$c canvasx $x]/$@scale] set y [expr [$c canvasy $y]/$@scale] --- 1886,1889 ---- *************** *** 2185,2191 **** }
! def Canvas disconnect {wire} { mset {from outlet to inlet} $wire; pd .$self disconnect $from $outlet $to $inlet $@history add [list $self connect $wire] } def Canvas connect {wire} { --- 2196,2203 ---- }
! def* Canvas disconnect {wire} { mset {from outlet to inlet} $wire; pd .$self disconnect $from $outlet $to $inlet $@history add [list $self connect $wire] + set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $wire] [lsearch $@wires_pair $wire]] } def Canvas connect {wire} { *************** *** 2231,2235 **** $self draw } ! def FutureWire unclick {x y f target} { $self motion $x $y $f $target if {$@to != ""} { --- 2243,2247 ---- $self draw } ! def* FutureWire unclick {x y f target} { $self motion $x $y $f $target if {$@to != ""} { *************** *** 2310,2349 **** switch $type { outlet {set @action [FutureWire new $self $x $y $f $target]; return} object {$self selection+= $id; set @action edit} wire { ! $self deselect_all set @keynav_tab_sel "object" switch [expr $f&255] { 0 {$self selection_wire= $id} ! 1 {#click on a wire with shift ! #if click on the one already selected wire, reconnect it ! if {[llength $@selection_wire] == 1 && $@selection_wire == $id} { ! set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]] ! $id delete ! $self disconnect $wire ! set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $id] [lsearch $@wires_pair $id]] ! set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $wire] [lsearch $@wires_pair $wire]] ! set obj1 [lindex $@children [lindex $wire 0]] ! set outlet [lindex $wire 1] ! mset {x1 y1 x2 y2} [$c bbox ${obj1}o${outlet}] ! set @action [FutureWire new $x $y $obj1 $outlet] ! } else { ! #else selecting mltiple wires ! if {[lsearch $@selection_wire $id] < 0} {lappend @selection_wire $id;$id selected?= 1} ! } ! } 2 {# ctrl-click on wire? set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]] - $id delete $self disconnect $wire - set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $id] [lsearch $@wires_pair $id]] - set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $wire] [lsearch $@wires_pair $wire]] set obj1 [lindex $@children [lindex $wire 0]] set outlet [lindex $wire 1] ! mset {x1 y1 x2 y2} [$obj1 bbox] ! mset {x1 y1 x2 y2} [$c bbox ${obj1}o${outlet}] ! $c create line [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] $x $y -dash {4 4 4 4} -tags lnew -fill [look wiredash] ! #set @wire_from [list $obj1 $outlet] ! set @action wire } } --- 2322,2344 ---- switch $type { outlet {set @action [FutureWire new $self $x $y $f $target]; return} + inlet {} object {$self selection+= $id; set @action edit} wire { ! #$self deselect_all ! set obj_selection [$self selection] ! if {[llength $obj_selection]} {$self selection-= $obj_selection} set @keynav_tab_sel "object" switch [expr $f&255] { 0 {$self selection_wire= $id} ! 1 {$self selection_wire+= $id} 2 {# ctrl-click on wire? set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]] $self disconnect $wire set obj1 [lindex $@children [lindex $wire 0]] set outlet [lindex $wire 1] ! #mset {x1 y1 x2 y2} [$c bbox ${obj1}o${outlet}] ! mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${outlet}] [$@canvas scale]] ! set target [$self identify_target $x1 $y1 $f] ! set @action [FutureWire new $self $x1 $y1 $f $target] } } *************** *** 2352,2355 **** --- 2347,2356 ---- $self deselect_all $self dehilite_io + switch $@action { + edit {} + move {} + none {} + default {$@action unclick $x $y $f $target} + } set @action [SelRect new $@canvas $x $y $f $target] return *************** *** 2479,2482 **** --- 2480,2485 ---- #puts " selection_wire::: $@selection_wire" #puts " selection::: $@selection" + puts " keynav::: $@keynav" + if {!$@keynav} {return} switch $@keynav_tab_sel { object { *************** *** 2511,2514 **** --- 2514,2530 ---- }
+ def Canvas victim {} { + if {[llength $@selection]} { + return $@selection + } elseif {[string compare $@keynav_current 0]} { + return {} + } else { + return $@keynav_current + } + + + } + + def Canvas find_neighbor_obj {object direction} { set group "" *************** *** 2701,2709 **** #-----------------------------------------------------------------------------------#
! def Canvas keyup {x y key iso shift} { set canvas .$self.c - if {$shift} { - if {[llength $@shift_wires]} {set @shift_wires {}; $canvas delete lnew} - } if {$iso != ""} {scan $iso %c key} # if {[string length $@focus] > 0} { --- 2717,2722 ---- #-----------------------------------------------------------------------------------#
! def* Canvas keyup {x y key iso shift} { set canvas .$self.c if {$iso != ""} {scan $iso %c key} # if {[string length $@focus] > 0} { *************** *** 4307,4318 **** ############ crosshair
! def Canvas show_crosshair {x y target} { global crosshair ! set width [expr [winfo width .$self.c] * (1/$@scale)] ! set height [expr [winfo height .$self.c] * (1/$@scale)] ! set off [expr 7 * (1/$@scale)] mset {type id detail} $target - #puts " type::: $type id:::$id" - #puts " action::: $@action" if {$crosshair(hairsnap)} { --- 4320,4332 ---- ############ crosshair
! def* Canvas show_crosshair {x y target} { global crosshair ! set width [expr [winfo width .$self.c] / $@scale] ! set height [expr [winfo height .$self.c] / $@scale] ! #set width [winfo width .$self.c] ! #set height [winfo height .$self.c] ! #set width [expr [winfo width .$self.c] * (1/$@scale)] ! #set height [expr [winfo height .$self.c] * (1/$@scale)] mset {type id detail} $target if {$crosshair(hairsnap)} { *************** *** 4337,4358 **** } - #set v1 [list $X 0 $X [expr $Y - $off]] - #set h1 [list 0 $Y [expr $X - $off] $Y] set v1 [list $X 0 $X $height] set h1 [list 0 $Y $width $Y] - #set v2 [list $X [expr $Y + $off] $X $height] - #set h2 [list [expr $X + $off] $Y $width $Y] - #set eye [list [expr $X - $off] [expr $Y - $off] [expr $X + $off] [expr $Y + $off]] $self item VHAIR1 line $v1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} $self item HHAIR1 line $h1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} - #$self item VHAIR2 line $v2 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} - #$self item HHAIR2 line $h2 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} - #$self item EYE oval $eye -dash {4 4 4 4} -outline [look selrect] }
def Canvas hide_crosshair {} { - #.$self.c delete ${self}VHAIR1 ${self}HHAIR1 ${self}VHAIR2 ${self}HHAIR2 ${self}EYE .$self.c delete ${self}VHAIR1 ${self}HHAIR1 } --- 4351,4363 ----