[PD-cvs] pd/src desire.tk,1.1.2.508,1.1.2.509
chunlee
chunlee at users.sourceforge.net
Sun Oct 15 23:41:06 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29836
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
more on auto insert
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.508
retrieving revision 1.1.2.509
diff -C2 -d -r1.1.2.508 -r1.1.2.509
*** desire.tk 15 Oct 2006 11:57:51 -0000 1.1.2.508
--- desire.tk 15 Oct 2006 21:41:02 -0000 1.1.2.509
***************
*** 2551,2555 ****
$self populate_menu $p {popup_properties popup_help}
} {
! $id populate_menu $p {popup_properties popup_open popup_help}
}
tk_popup $p [expr $x-5] [expr $y-5]
--- 2551,2560 ----
$self populate_menu $p {popup_properties popup_help}
} {
! if {[$id class] == "Wire"} {
! $id populate_menu $p {popup_insert}
! } else {
! $id populate_menu $p {popup_properties popup_open popup_help}
! }
!
}
tk_popup $p [expr $x-5] [expr $y-5]
***************
*** 3307,3310 ****
--- 3312,3336 ----
}
+ def Box io_bbox {type port n} {
+ set nplus [expr $n==1 ? 1 : $n-1]
+ mset {x1 y1 x2 y2} [$self bbox]
+ set xs [expr $x2 - $x1]
+ set iowidth [$self look iowidth]
+ set fy [$self look iopos]
+ switch $type {
+ o {
+ set n $@noutlets
+ set y $y2+$fy
+ }
+ i {
+ set n $@ninlets
+ set y $y1-$fy-1
+ }
+ }
+ set onset [expr $x1 + ($xs-$iowidth) * $port / $nplus]
+ set points [list [expr $onset] [expr $y-0] [expr $onset+$iowidth] [expr $y+0]]
+ return $points
+ }
+
def Box changed_wires {} {foreach wire $@wires {$wire changed}}
***************
*** 3361,3382 ****
}
! def Box draw_io2 {which n y} {
! set nplus [expr $n==1 ? 1 : $n-1]
! mset {x1 y1 x2 y2} [$self bbox]
! set xs [expr $x2-$x1]
! set iowidth [$self look iowidth]
! switch $which { i {set color [$self look inletfg]} o {set color [$self look outletfg]}}
! for {set i 0} {$i<$n} {incr i} {
! set onset [expr $x1 + ($xs-$iowidth) * $i / $nplus]
! set points [list [expr $onset] [expr $y-0] [expr $onset+$iowidth] [expr $y+0]]
! $self item [list $which$i $which] rectangle $points -outline $color -fill $color -width 1
! }
}
def Box draw_io {} {
! set fy [$self look iopos]
! mset {x1 y1 x2 y2} [$self bbox]
! $self draw_io2 i $@ninlets [expr $y1-$fy-1]
! $self draw_io2 o $@noutlets [expr $y2+$fy]
}
--- 3387,3401 ----
}
! def Box draw_io2 {which n} {
! switch $which { i {set color [$self look inletfg]} o {set color [$self look outletfg]}}
! for {set i 0} {$i<$n} {incr i} {
! set points [$self io_bbox $which $i $n]
! $self item [list $which$i $which] rectangle $points -outline $color -fill $color -width 1
! }
}
def Box draw_io {} {
! $self draw_io2 i $@ninlets
! $self draw_io2 o $@noutlets
}
***************
*** 3473,3492 ****
set zoom [$@canvas zoom]
set c [$@canvas widget]
! #set bbox1 [list ]
! set bbox1 [lmap / [$c bbox [join [list $@obj1 o $@port1] ""]] $zoom]
! set bbox2 [lmap / [$c bbox [join [list $@obj2 i $@port2] ""]] $zoom]
! set bbox1 [$@obj1 bbox]
! if {[llength $bbox1] < 4} {puts stderr "wire_draw: crap outlet $@obj1 [$@obj1 deconstruct]"; return}
! if {[llength $bbox2] < 4} {puts stderr "wire_draw: crap inlet $@obj2 [$@obj2 deconstruct]"; return}
set iowidth [$@obj1 look iowidth]
! mset {ox1 oy1 ox2 oy2} [$@obj1 bbox]
! set height1 [expr $oy2 - $oy1]
! set x1 [expr ($iowidth / 2) + ($iowidth * $@port1) + $ox1]
! set y1 [expr $oy1 + $height1]
! mset {ix1 iy1 ix2 iy2} [$@obj2 bbox]
! set x2 [expr ($iowidth / 2) + ($iowidth * $@port2) + $ix1]
set y2 $iy1
- #mset {x1 y1} [l/2 [l+ [lrange $bbox1 0 1] [lrange $bbox1 2 3]]]
- #mset {x2 y2} [l/2 [l+ [lrange $bbox2 0 1] [lrange $bbox2 2 3]]]
set xys [list $x1 $y1 $x2 $y2]
set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))]
--- 3492,3504 ----
set zoom [$@canvas zoom]
set c [$@canvas widget]
! #if {[llength $bbox1] < 4} {puts stderr "wire_draw: crap outlet $@obj1 [$@obj1 deconstruct]"; return}
! #if {[llength $bbox2] < 4} {puts stderr "wire_draw: crap inlet $@obj2 [$@obj2 deconstruct]"; return}
set iowidth [$@obj1 look iowidth]
! mset {ox1 oy1 ox2 oy2} [$@obj1 io_bbox o $@port1 [$@obj1 noutlets]]
! mset {ix1 iy1 iy2 iy2} [$@obj2 io_bbox i $@port2 [$@obj2 ninlets]]
! set x1 [expr $ox1 + ($iowidth/2)]
! set y1 $oy2
! set x2 [expr $ix1 + ($iowidth/2)]
set y2 $iy1
set xys [list $x1 $y1 $x2 $y2]
set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))]
***************
*** 3522,3525 ****
--- 3534,3542 ----
}
+
+ def Wire popup_insert {} {
+ $@canvas insert_object
+ }
+
#-----------------------------------------------------------------------------------#
############ colouring
More information about the Pd-cvs
mailing list