Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23789
Modified Files: Tag: desiredata desire.tk Log Message: simplified def Canvas get_canvas
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.29 retrieving revision 1.1.2.600.2.30 diff -C2 -d -r1.1.2.600.2.29 -r1.1.2.600.2.30 *** desire.tk 6 Dec 2006 23:52:26 -0000 1.1.2.600.2.29 --- desire.tk 7 Dec 2006 01:03:43 -0000 1.1.2.600.2.30 *************** *** 67,72 **** # max finds the biggest of two values # [clip $v $min $max] does [max $min [min $max $v]] ! proc min {x y} {if {$x<$y} {return $x} {return $y}} ! proc max {x y} {if {$x>$y} {return $x} {return $y}} proc clip {x min max} { if {$x<$min} {return $min} --- 67,72 ---- # max finds the biggest of two values # [clip $v $min $max] does [max $min [min $max $v]] ! proc min {x y} {expr {$x<$y?$x:$y}} ! proc max {x y} {expr {$x>$y?$x:$y}} proc clip {x min max} { if {$x<$min} {return $min} *************** *** 82,86 **** proc l- { al bl} {set r {}; foreach a $al b $bl {lappend r [expr {$a-$b}]}; return $r} # halve a list ! proc l/2 { al } {set r {}; foreach a $al {lappend r [expr {$a/2}]}; return $r}
# like l+ or l- but for any infix supported by expr --- 82,86 ---- proc l- { al bl} {set r {}; foreach a $al b $bl {lappend r [expr {$a-$b}]}; return $r} # halve a list ! proc l/2 { al } {set r {}; foreach a $al {lappend r [expr {$a/2 }]}; return $r}
# like l+ or l- but for any infix supported by expr *************** *** 1115,1119 **** global font set canvas [$self get_canvas] ! if {$canvas == "none"} {return} set c [$canvas widget] set zoom [$canvas zoom] --- 1115,1119 ---- global font set canvas [$self get_canvas] ! if {$canvas == ""} {return} set c [$canvas widget] set zoom [$canvas zoom] *************** *** 1158,1166 ****
def View item_delete {{suffix all}} { ! set c [$@canvas widget] ! ! if {![winfo exists $c]} { set canvas [$@canvas get_canvas] ! if {$canvas == "none" || $canvas == ""} {return} set c [[$canvas get_canvas] widget] if {![winfo exists $c]} {return} --- 1158,1166 ----
def View item_delete {{suffix all}} { ! if {[winfo exists $c]} { ! set c [$@canvas widget] ! } else { set canvas [$@canvas get_canvas] ! if {$canvas == ""} {return} set c [[$canvas get_canvas] widget] if {![winfo exists $c]} {return} *************** *** 1198,1203 **** set ymargin [lindex $mess 7] mset {x y} [$@canvas xy] ! set cx [expr ($@x1 - $xmargin) + $x] ! set cy [expr ($@y1 - $ymargin) + $y] } else { set cx $@x1 --- 1198,1203 ---- set ymargin [lindex $mess 7] mset {x y} [$@canvas xy] ! set cx [expr {($@x1-$xmargin)+$x}] ! set cy [expr {($@y1-$ymargin)+$y}] } else { set cx $@x1 *************** *** 1213,1262 ****
# this returns the canvas actually exists/drawn def View get_canvas {} { - if {[info exists @gop]} { - if {$@gop} { - set canvas $@canvas - while {![winfo exists [$canvas widget]]} { - set canvas [$canvas canvas] - } - return $canvas - } - } - - if {[info exists @subpatch]} { - if {$@subpatch} {return [$self canvas]} - } - if {[info exists @abs]} {if {$@abs} {return [$self canvas]}} - if {[winfo exists .$self.c]} {return $self} set canvas $@canvas ! while {![winfo exists [$canvas widget]]} { ! set canvas [$canvas canvas] ! } ! if {$canvas != ""} {return $canvas} else {return none} ! #return $canvas ! } ! ! def View get_canvas2 {} { ! if {[info exists @subpatch]} {if {$@subpatch} {return [$self canvas]}} ! if {[info exists @abs]} {if {$@abs} {return [$self canvas]}} ! if {[winfo exists .$self.c]} {return $self} ! if {[winfo exists .$@canvas.c]} { ! return $@canvas ! } else { ! set next_canvas [$@canvas canvas] ! if {[winfo exists .$next_canvas.c]} { ! return $next_canvas ! } else { ! #puts "bug:: no canvas found..." ! return none ! } ! } }
- def View outside_of_the_box {} { # always hide these things ! if {[$self class] == "Wire"} {set @inside_box 0; return} ! if {[$self class] == "ObjectBox"} {set @inside_box 0; return} if {[$self class] == "MessageBox"} {set @inside_box 0; return} if {[$self class] == "Array"} { --- 1213,1227 ----
# this returns the canvas actually exists/drawn + # see also def Canvas get_canvas def View get_canvas {} { set canvas $@canvas ! while {![winfo exists [$canvas widget]]} {set canvas [$canvas canvas]} ! return $canvas }
def View outside_of_the_box {} { # always hide these things ! if {[$self class] == "Wire"} {set @inside_box 0; return} ! if {[$self class] == "ObjectBox"} {set @inside_box 0; return} if {[$self class] == "MessageBox"} {set @inside_box 0; return} if {[$self class] == "Array"} { *************** *** 1278,1283 **** set xmargin [lindex $mess 6];set ymargin [lindex $mess 7] } ! if {$x1 < [expr $pixwidth + $xmargin] && $x1 > $xmargin &&\ ! $y1 < [expr $pixheight + $ymargin] && $y1 > $ymargin} { set @inside_box 1 $@canvas visible_children+= $self --- 1243,1248 ---- set xmargin [lindex $mess 6];set ymargin [lindex $mess 7] } ! if {$x1 < $pixwidth +$xmargin && $x1 > $xmargin && \ ! $y1 < $pixheight+$ymargin && $y1 > $ymargin} { set @inside_box 1 $@canvas visible_children+= $self *************** *** 1828,1831 **** --- 1793,1805 ---- }
+ def Canvas get_canvas {} { + if {![info exists @gop]} { + if {[info exists @subpatch]} {if {$@subpatch} {return [$self canvas]}} + if {[info exists @abs]} {if {$@abs} {return [$self canvas]}} + if {[winfo exists .$self.c]} {return $self} + } + return [super] + } + def Canvas do_insert_obj {x y} { if {$x == "none" && $y == "none"} { *************** *** 4714,4718 **** def Box popup_properties {} {BoxPropertiesDialog new $self} def Box popup_clear_wires {} {[$self get_canvas] selection= $self; [$self get_canvas] clear_wires} ! def Box popup_auto_wire {} {[$self get_canvas] selection= $self; [$self get_canvas] auto_wire} def BoxPropertiesDialog init {of} { super $of --- 4688,4692 ---- def Box popup_properties {} {BoxPropertiesDialog new $self} def Box popup_clear_wires {} {[$self get_canvas] selection= $self; [$self get_canvas] clear_wires} ! def Box popup_auto_wire {} {[$self get_canvas] selection= $self; [$self get_canvas] auto_wire} def BoxPropertiesDialog init {of} { super $of