Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5012
Modified Files: Tag: desiredata desire.tk Log Message: simple subpatcherize
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.145 retrieving revision 1.1.2.600.2.146 diff -C2 -d -r1.1.2.600.2.145 -r1.1.2.600.2.146 *** desire.tk 28 Dec 2006 15:46:24 -0000 1.1.2.600.2.145 --- desire.tk 31 Dec 2006 00:35:26 -0000 1.1.2.600.2.146 *************** *** 295,306 **** #-----------------------------------------------------------------------------------# #used during subpatcherize ! set subpatcherize(cut) 0 ! set subpatcherize(insert) 0 set subpatcherize(paste) 0 - set subpatcherize(parent) 0 - set subpatcherize(sub) 0 - set subpatcherize(count) 0 - set subpatcherize(x) 0 - set subpatcherize(y) 0 #-----------------------------------------------------------------------------------# # adapted from matju's MetaRuby (UndoQueue.rb) --- 295,300 ---- #-----------------------------------------------------------------------------------# #used during subpatcherize ! set subpatcherize(edit) 0 set subpatcherize(paste) 0 #-----------------------------------------------------------------------------------# # adapted from matju's MetaRuby (UndoQueue.rb) *************** *** 389,393 **** set rbackup @redo_q; set @redo_q {} set err [catch {uplevel 2 $code}] ! if {$err} {set err $errorInfo} set atom $@undo_q set @undo_q $ubackup --- 383,387 ---- set rbackup @redo_q; set @redo_q {} set err [catch {uplevel 2 $code}] ! if {$err} {set err $errorInfo; puts "errorinfo :::: $errorInfo"} set atom $@undo_q set @undo_q $ubackup *************** *** 1297,1301 ****
class_new Canvas {Menuable ObjectBox} ! def Canvas close {} { if {$@subpatch} { --- 1291,1295 ----
class_new Canvas {Menuable ObjectBox} ! def Canvas close {} { if {$@subpatch} { *************** *** 2394,2401 ****
def Canvas havewindow= {flag} { set was [winfo exists .$self] if {$flag && $was && [$self gop]} {$self redraw} if {$flag && $was} {$self raise} ! if {$flag && !$was} {$self init_window} ;#??? if {!$flag && $was} {$self delete_window} ;#??? } --- 2388,2404 ----
def Canvas havewindow= {flag} { + global subpatcherize set was [winfo exists .$self] if {$flag && $was && [$self gop]} {$self redraw} if {$flag && $was} {$self raise} ! if {$flag && !$was} { ! if {!$subpatcherize(paste) && !$subpatcherize(edit)} { ! $self init_window ! } else { ! if {$subpatcherize(paste)} {set subpatherize(paste) 0} ! if {$subpatcherize(edit)} {set subpatherize(edit) 0} ! } ! ! } ;#??? if {!$flag && $was} {$self delete_window} ;#??? } *************** *** 2484,2499 **** def Canvas delete_selection {} { if {![llength $@selection] && ![llength $@selection_wire]} {return} foreach obj $@selection { ! foreach wire $_($obj:wires2) { ! set find [lsearch $@wires $wire] ! if {$find != -1} {$self disconnect [$wire connects]} ! $wire delete ! } ! $self del [$self index $obj] } foreach x $@selection_wire { ! set find [lsearch $@wires $x] ! if {$find != -1} {$self disconnect [$x connects]} ! $x delete } # don't use $self selection= here, otherwise it might call changed on deleted stuff.. --- 2487,2510 ---- def Canvas delete_selection {} { if {![llength $@selection] && ![llength $@selection_wire]} {return} + set del_wire {} foreach obj $@selection { ! foreach wire $_($obj:wires2) { ! set find [lsearch $@wires $wire] ! set find2 [lsearch $del_wire $wire] ! if {$find != -1 && $find2 < 0} { ! $self disconnect [$wire connects] ! lappend del_wire $wire ! $wire delete ! } ! } ! $self del [$self index $obj] } foreach x $@selection_wire { ! set find [lsearch $@wires $x] ! set find2 [lsearch $del_wire $x] ! if {$find != -1 && $find2 < 0} { ! $self disconnect [$x connects] ! $x delete ! } } # don't use $self selection= here, otherwise it might call changed on deleted stuff.. *************** *** 2991,2995 ****
def Canvas visible_rect {} { - global subpatcherize set c [$self widget] set height [winfo height $c] --- 3002,3005 ---- *************** *** 3069,3077 ****
def Canvas do_paste {offset} { - global paste subpatcherize set in 0 $self deselect_all netsend [list .$self "push"] - set paste(state) $self foreach mess [pd_mess_split [$::clipboard value]] { set type [lindex $mess 1] --- 3079,3085 ---- *************** *** 3278,3284 **** }
def Canvas subpatcherize {} { - global subpatcherize - set subpatcherize(sub) 0 if {![llength $@selection]} {return} set x 0; set y 0 --- 3286,3291 ---- }
+ def Canvas new_object_subpatcherize {subpatch} {$subpatch subpatcherize_paste} def Canvas subpatcherize {} { if {![llength $@selection]} {return} set x 0; set y 0 *************** *** 3288,3297 **** set y [expr $y + $y1] } ! set subpatcherize(x) [expr $x / [llength $@selection]] ! set subpatcherize(y) [expr $y / [llength $@selection]] ! set subpatcherize(cut) 1 ! set subpatcherize(parent) $self ! incr subpatcherize(count) $self cut }
--- 3295,3316 ---- set y [expr $y + $y1] } ! set x [expr $x / [llength $@selection]] ! set y [expr $y / [llength $@selection]] $self cut + netsend [list .$self "push"] + netsend [list #N canvas 0 0 450 300 sub 0] [list $self new_object_subpatcherize] + netsend [list #X restore $x $y pd sub] + netsend [list .$self "pop"] + } + def Canvas subpatcherize_paste {} { + global subpatcherize + set subpatcherize(paste) 1 + set in 0 + $self deselect_all + netsend [list .$self "push"] + foreach mess [pd_mess_split [$::clipboard value]] {netsend $mess} + netsend [list #X pop 1] + set subpatcherize(edit) 1 + $self edit }
*************** *** 4537,4545 **** #A 0 0;
- #state is 0 when not pasting, its the canvas id if it is - set paste(state) 0 - #set paste(count) 0 - #set paste(count2) 0 - proc change {self canvas e {ninlets 0} {noutlets 0}} { foreach mess [pd_mess_split $e] {change_2 $self $mess} --- 4556,4559 ----