Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7246
Modified Files: Tag: desiredata desire.tk Log Message: add snap_objs2grid
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.364 retrieving revision 1.1.2.600.2.365 diff -C2 -d -r1.1.2.600.2.364 -r1.1.2.600.2.365 *** desire.tk 13 Aug 2007 20:16:55 -0000 1.1.2.600.2.364 --- desire.tk 14 Aug 2007 04:39:37 -0000 1.1.2.600.2.365 *************** *** 1431,1434 **** --- 1431,1435 ---- if {$canvas == ""} {return ""} #while {![$canvas havewindow]} {set canvas [$canvas canvas]} + while {![winfo exists [$canvas widget]]} {set canvas [$canvas canvas]} return $canvas } *************** *** 4679,4683 **** } #if {$iso != ""} {scan $iso %c key} ! if {$shift} {set motion 10} {set motion 1} set n [$@objectsel size] switch -regexp -- $key { --- 4680,4689 ---- } #if {$iso != ""} {scan $iso %c key} ! #if {$shift} {set motion 10} {set motion 1} ! if {$shift} { ! if {[$self look snap_grid]} {set motion [expr [$self look grid_size]*2]} {set motion 10} ! } else { ! if {[$self look snap_grid]} {set motion [$self look grid_size]} {set motion 1} ! } set n [$@objectsel size] switch -regexp -- $key { *************** *** 4910,4921 **** $self changed ;# until we find a way to avoid rounding errors on [$@canvas widget] move. $self changed_wires - #update/move the content of gop - #if {[$self class] == "Canvas"} { - # if {[$self gop] && ![winfo exists .$self.c]} { - #$self all_changed - # } - #} else { - # $self changed_wires - #} }
--- 4916,4919 ---- *************** *** 5668,5674 **** class_new BoxPropertiesDialog {PropertiesDialog} 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_remove_from_path {} {[$self get_canvas] selection= $self; [$self get_canvas] remove_obj_from_path} ! def Box popup_delete_from_path {} {[$self get_canvas] selection= $self; [$self get_canvas] delete_obj_from_path} def BoxPropertiesDialog init {of} { super $of --- 5666,5672 ---- class_new BoxPropertiesDialog {PropertiesDialog} def Box popup_properties {} {BoxPropertiesDialog new $self} ! def Box popup_clear_wires {} {[$self canvas] selection= $self; [$self canvas] clear_wires} ! def Box popup_remove_from_path {} {[$self canvas] selection= $self; [$self canvas] remove_obj_from_path} ! def Box popup_delete_from_path {} {[$self canvas] selection= $self; [$self canvas] delete_obj_from_path} def BoxPropertiesDialog init {of} { super $of *************** *** 6663,6669 **** def Canvas snap_grid= {val} {set ::look(Canvas:snap_grid) $val}
def Grid draw {} { - #set sw [winfo screenwidth [$@canvas widget]] - #anset sh [winfo screenheight [$@canvas widget]] set c [$@canvas widget] set lowest [$@canvas lowest_item] --- 6661,6676 ---- def Canvas snap_grid= {val} {set ::look(Canvas:snap_grid) $val}
+ def Canvas snap_objs2grid {} { + if {![$self editmode]} {return} + foreach obj [$@objects values] { + mset {x y} [$obj xy] + set grid [$self look grid_size] + set x [expr floor($x/$grid)*$grid] + set y [expr floor($y/$grid)*$grid] + $obj moveto $x $y + } + } + def Grid draw {} { set c [$@canvas widget] set lowest [$@canvas lowest_item]