[PD-cvs] pd/src desire.tk,1.1.2.311,1.1.2.312
Mathieu Bouchard
matju at users.sourceforge.net
Fri Aug 11 03:58:03 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10693
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
new Paste (Ctrl+V)
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.311
retrieving revision 1.1.2.312
diff -C2 -d -r1.1.2.311 -r1.1.2.312
*** desire.tk 11 Aug 2006 00:55:30 -0000 1.1.2.311
--- desire.tk 11 Aug 2006 01:58:01 -0000 1.1.2.312
***************
*** 950,954 ****
}
! def* View item {suffix type coords args} {
global font
set c .$@canvas.c
--- 950,954 ----
}
! def View item {suffix type coords args} {
global font
set c .$@canvas.c
***************
*** 1662,1669 ****
}
! def Canvas selection {} {return @selection}
! def Canvas selection= {objs} {set @selection $objs}
def Canvas selection+= {objs} {
set @selection [concat [lwithout $@selection $objs] $objs]
}
--- 1662,1676 ----
}
! def Canvas selection {} {return $@selection}
! def Canvas selection= {objs} {
! post "SELECTION=: %s " [uplevel 2 {info locals}]
! foreach o $@selection {$o selected?= 0}
! set @selection $objs
! foreach o $@selection {$o selected?= 1}
! }
!
def Canvas selection+= {objs} {
set @selection [concat [lwithout $@selection $objs] $objs]
+ foreach o $objs {$o selected?= 1}
}
***************
*** 1734,1737 ****
--- 1741,1746 ----
#def Canvas del {i} {lset @children $i ""}
+ def Canvas children {} {return $@children}
+
def Canvas children= {children} {
# think of the children!!!
***************
*** 2153,2156 ****
--- 2162,2192 ----
def* Canvas paste {} {
global clipboard
+ set n [llength $@children] ;# is a racecondition
+ foreach line [split [$clipboard value] ";"] {
+ if {[llength $line] == 0} {continue}
+ switch -- [lindex $line 0] {
+ "#N" {error "don't know how to paste a subpatch"}
+ "#X" {
+ switch -- [lindex $line 1] {
+ restore {error "don't know how to paste a subpatch"}
+ connect {
+ mset {foo bar from outlet to inlet} $line
+ pd .$@canvas connect [expr $n+$from] $outlet [expr $n+$to] $inlet
+ }
+ default {eval [concat [list pd .$self] [lrange $line 1 end]]}
+ }
+
+ }
+ default {error "Canvas paste can't parse clipboard ([lindex $line 0])"}
+ }
+ }
+ #after 1 "$self paste2 $n"
+ after 300 "$self paste2 $n" ;# racecondition
+ }
+ # part two
+ def* Canvas paste2 {n} {$self selection= [lrange [$self children] $n end]}
+
+ def* Canvas paste_OLD {} {
+ global clipboard
puts "***************************************"
set windowx [winfo width .$self.c]
***************
*** 5880,5909 ****
class_new ClipboardDialog {Dialog}
! def ClipboardDialog init {} {
! global clipboard
super
wm title .$self "Clipboard"
pack [text .$self.text -yscrollcommand ".$self.scroll set" -width 72
] -side left -fill both -expand yes
pack [scrollbar .$self.scroll -command ".$self.text yview"] -side right -fill y
! $clipboard subscribe $self
$self notice
}
def ClipboardDialog notice {args} {
- global clipboard
.$self.text delete 0.0 end
! .$self.text insert 0.0 [$clipboard value]
}
def ClipboardDialog _delete {} {
super
! $clipboard unsubscribe $self
}
! ClipboardDialog new
def Wire deconstruct {{selcanvas ""}} {
global obj_index_sel
if {$selcanvas == ""} {
list #X connect \
--- 5916,5946 ----
class_new ClipboardDialog {Dialog}
! def ClipboardDialog init {clipboard} {
super
+ set @clipboard $clipboard
wm title .$self "Clipboard"
pack [text .$self.text -yscrollcommand ".$self.scroll set" -width 72
] -side left -fill both -expand yes
pack [scrollbar .$self.scroll -command ".$self.text yview"] -side right -fill y
! $@clipboard subscribe $self
$self notice
}
def ClipboardDialog notice {args} {
.$self.text delete 0.0 end
! .$self.text insert 0.0 [$@clipboard value]
}
def ClipboardDialog _delete {} {
super
! $@clipboard unsubscribe $self
}
! ClipboardDialog new $clipboard
def Wire deconstruct {{selcanvas ""}} {
global obj_index_sel
+ # the selcanvas system could be abstracted out using an ObjectList such that
+ # Canvas<ObjectList and $selection class == ObjectList
if {$selcanvas == ""} {
list #X connect \
More information about the Pd-cvs
mailing list