Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4996
Modified Files: Tag: desiredata desire.tk Log Message: simplified io_bbox
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.104 retrieving revision 1.1.2.600.2.105 diff -C2 -d -r1.1.2.600.2.104 -r1.1.2.600.2.105 *** desire.tk 19 Dec 2006 01:07:53 -0000 1.1.2.600.2.104 --- desire.tk 19 Dec 2006 01:34:51 -0000 1.1.2.600.2.105 *************** *** 3994,4002 **** }
! 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}] ! # method calls aren't as fast as we'd want them to. #set iowidth [$self look iowidth] #set fy [$self look iopos] --- 3994,4001 ---- }
! def Box io_bbox {type port} { mset {x1 y1 x2 y2} [$self bbox] set xs [expr {$x2-$x1}] ! # method calls aren't as fast as we'd want them to be. #set iowidth [$self look iowidth] #set fy [$self look iopos] *************** *** 4007,4010 **** --- 4006,4010 ---- i {set n $@ninlets; set y [expr {$y1-$fy-1}]} } + set nplus [expr {$n==1 ? 1 : $n-1}] set onset [expr {$x1+($xs-$iowidth)*$port/$nplus}] set points [list $onset $y [expr {$onset+$iowidth}] $y] *************** *** 4074,4081 **** }
! 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 [[$self get_canvas] widget] raise $self$which$i --- 4074,4080 ---- }
! def Box draw_io2 {which n color} { for {set i 0} {$i<$n} {incr i} { ! set points [$self io_bbox $which $i] $self item [list $which$i $which] rectangle $points -outline $color -fill $color -width 1 [[$self get_canvas] widget] raise $self$which$i *************** *** 4084,4089 ****
def Box draw_io {} { ! $self draw_io2 i $@ninlets ! $self draw_io2 o $@noutlets }
--- 4083,4088 ----
def Box draw_io {} { ! $self draw_io2 i $@ninlets [$self look inletfg] ! $self draw_io2 o $@noutlets [$self look outletfg] }
*************** *** 4123,4128 **** if {$ports==0 | $port==-1} return if {$port >= $ports} {set port [expr $ports-1]} ! switch $type {i {set ns $@ninlets} o {set ns $@noutlets}} ! $self hilite_io_2 $type $port $ns if {[$self look tooltip]} {$@canvas show_tooltip $x $y [$self tip $type $port] $type} return $port --- 4122,4126 ---- if {$ports==0 | $port==-1} return if {$port >= $ports} {set port [expr $ports-1]} ! $self hilite_io_2 $type $port if {[$self look tooltip]} {$@canvas show_tooltip $x $y [$self tip $type $port] $type} return $port *************** *** 4135,4148 **** set port [lindex $@ioselect 0] set p $type$port ! switch $type { ! i {set ns $@ninlets} ! o {set ns $@noutlets} ! } ! $self hilite_io_2 $type $port $ns }
! def Box hilite_io_2 {type port ns} { set outline [switch $type {i {concat [$self look outletfg]} o {concat [$self look inletfg]}}] ! set box [l+ [$self io_bbox $type $port $ns] [list -3 -3 +3 +3]] $self item $type${port}b rectangle $box -outline $outline -width 1 } --- 4133,4142 ---- set port [lindex $@ioselect 0] set p $type$port ! $self hilite_io_2 $type $port }
! def Box hilite_io_2 {type port} { set outline [switch $type {i {concat [$self look outletfg]} o {concat [$self look inletfg]}}] ! set box [l+ [$self io_bbox $type $port] [list -3 -3 +3 +3]] $self item $type${port}b rectangle $box -outline $outline -width 1 } *************** *** 4153,4160 **** def Box show_error {text} { regsub "\n" $text "" text - mset {x1 y1 x2 y2} [$self bbox] - [$self get_canvas] show_tooltip [expr $x2+4] [expr ($y1+$y2)/2] $text object 1 #mset {x1 y1 x2 y2} [$self bbox] ! #[$self get_canvas] show_tooltip ... [expr ($y1+$y2)/2] $text object 1 }
--- 4147,4155 ---- def Box show_error {text} { regsub "\n" $text "" text #mset {x1 y1 x2 y2} [$self bbox] ! #[$self get_canvas] show_tooltip [expr $x2+4] [expr ($y1+$y2)/2] $text object 1 ! mset {x1 y1 x2 y2} [$self bbox] ! mset {x y} [rect_centre [$self io_bbox i 0]] ! [$self get_canvas] show_tooltip $x $y $text i 1 }
*************** *** 4237,4242 **** set c [$@canvas widget] 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 --- 4232,4237 ---- set c [$@canvas widget] set iowidth [$@obj1 look iowidth] ! mset {ox1 oy1 ox2 oy2} [$@obj1 io_bbox o $@port1] ! mset {ix1 iy1 iy2 iy2} [$@obj2 io_bbox i $@port2] set x1 [expr $ox1 + $iowidth/2]; set y1 $oy2 set x2 [expr $ix1 + $iowidth/2]; set y2 $iy1