[PD-cvs] pd/src desire.tk,1.1.2.222,1.1.2.223
chunlee
chunlee at users.sourceforge.net
Sun Jun 11 11:23:19 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23596
Modified Files:
Tag: devel_0_39
desire.tk
Log Message:
copy/paste mostly working, need more test.
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.222
retrieving revision 1.1.2.223
diff -C2 -d -r1.1.2.222 -r1.1.2.223
*** desire.tk 10 Jun 2006 19:13:50 -0000 1.1.2.222
--- desire.tk 11 Jun 2006 09:23:14 -0000 1.1.2.223
***************
*** 1418,1422 ****
class_new TextBox {Box}
! def TextBox draw {} {
# TEXT = the text label
# text = the input text field
--- 1418,1422 ----
class_new TextBox {Box}
! def* TextBox draw {} {
# TEXT = the text label
# text = the input text field
***************
*** 1556,1560 ****
}
! def ObjectBox draw {} {
$self update_size
set xs $@xs
--- 1556,1560 ----
}
! def* ObjectBox draw {} {
$self update_size
set xs $@xs
***************
*** 1695,1699 ****
if {$canvas(copy)} {
lappend @selection_wire $x; $x selected?= 1
! if {$i == $born_num} {set canvas(copy) 0}
}
}
--- 1695,1702 ----
if {$canvas(copy)} {
lappend @selection_wire $x; $x selected?= 1
! if {$i == $born_num} {
! set canvas(copy) 0
! set canvas(orig_cpcanvas) $self
! }
}
}
***************
*** 1986,1991 ****
--- 1989,1996 ----
global canvas
if {$@selection != ""} {
+ set canvas(orig_cpcanvas) $self
set canvas(copy_obj) $@selection
set canvas(copy_wire) $@selection_wire
+ set canvas(copy_times) 0
puts "objects to copy::: $canvas(copy_obj)"
puts "wires to copy::: $canvas(copy_wire)"
***************
*** 1995,2016 ****
def* Canvas paste {} {
set windowx [winfo width .$self.c]
set windowy [winfo height .$self.c]
! mset {x1off x2off } [lindex [.$self.c xview]]
! mset {y1off y2off } [lindex [.$self.c yview]]
set offx [expr ($windowx * $x1off) / [expr $x2off - $x1off]]
set offy [expr ($windowy * $y1off) / [expr $y2off - $y1off]]
! puts "window size:: $windowx $windowy"
! puts "canvas size:: [.$self.c cget -width] [.$self.c cget -height]"
! puts "canvas view:: [.$self.c xview] [.$self.c yview]"
! puts "canvas 0ff:: $offx $offy"
! global canvas _
! set @selection ""
set canvas(copied_obj) ""
foreach item $canvas(copy_obj) {
mset {x1 y1} [$item xy]
! puts "$item ::: $x1 $y1"
! if {$x1 < $offx | $x1 > [expr $offx+$windowx]} {set x1 [expr $x1 + $offx]}
! if {$y1 < $offx | $y1 > [expr $offx+$windowy]} {set y1 [expr $y1 + $offy]}
if {$_($item:_class) == "Objectbox"} {
set name $_($item:text) } else {
--- 2000,2042 ----
def* Canvas paste {} {
+ global canvas _
+ puts "***************************************"
set windowx [winfo width .$self.c]
set windowy [winfo height .$self.c]
! mset {x1off x2off } [.$self.c xview]
! mset {y1off y2off } [.$self.c yview]
set offx [expr ($windowx * $x1off) / [expr $x2off - $x1off]]
set offy [expr ($windowy * $y1off) / [expr $y2off - $y1off]]
! $self deselect_all
set canvas(copied_obj) ""
+ if {$canvas(orig_cpcanvas) != $self} { set canvas(copy_times) 0 } else {incr canvas(copy_times)}
+ set notvisiblex 0
+ set notvisibley 0
+ set n 0
+
foreach item $canvas(copy_obj) {
mset {x1 y1} [$item xy]
! if {$x1 < $offx | $x1 > [expr $offx+$windowx]} {set notvisiblex 1}
! if {$y1 < $offx | $y1 > [expr $offx+$windowy]} {set notvisibley 1}
! if {$notvisiblex && $notvisibley} {incr n}
! }
!
! foreach item $canvas(copy_obj) {
! mset {x1 y1} [$item xy]
! if {$canvas(orig_cpcanvas) != $self} {
! if {$n == [llength $canvas(copy_obj)]} {
! set x1 [expr $x1 + $offx +($canvas(copy_times)*15)]
! set y1 [expr $y1 + $offy +($canvas(copy_times)*15)]
! }
!
! } else {
! if {$n == [llength $canvas(copy_obj)]} {
! set x1 [expr $x1 + $offx +($canvas(copy_times)*15)]
! set y1 [expr $y1 + $offy +($canvas(copy_times)*15)]
! } else {
! set x1 [expr $x1+($canvas(copy_times)*15)]
! set y1 [expr $y1+($canvas(copy_times)*15)]
! }
! }
if {$_($item:_class) == "Objectbox"} {
set name $_($item:text) } else {
***************
*** 2039,2042 ****
--- 2065,2070 ----
#$wire selected?= 0
}
+ #puts "selection:::::::: $_($canvas(current):selection)"
+ #set canvas(copy_obj) $_($canvas(current):selection)
#clean up
foreach obj $canvas(copy_obj) {set _($obj:duplicate) 0}
***************
*** 2656,2661 ****
set class [lindex $d $i]
switch -- $class {
! #canvas {set class $class; set canvas(current) $x}
! canvas {set class $class}
obj {set i 4; set class [lindex $d 4]}
}
--- 2684,2689 ----
set class [lindex $d $i]
switch -- $class {
! canvas {set class $class; set canvas(current) $x}
! #canvas {set class $class}
obj {set i 4; set class [lindex $d 4]}
}
***************
*** 2663,2669 ****
if {![info exists _($x:_class)]} {
# new object
-
if {[info exists classinfo($class)]} {
set _($x:_class) [lindex $classinfo($class) 0]
} {
post BLEH
--- 2691,2704 ----
if {![info exists _($x:_class)]} {
# new object
if {[info exists classinfo($class)]} {
set _($x:_class) [lindex $classinfo($class) 0]
+ if {$_($x:_class) == "Canvas" && [llength $d] > 7} {
+ puts "------------- sub-patch -------------"
+ #set obj ${x}_obj
+ #puts "calling it $obj"
+ #ObjectBox new_as $obj
+ #set _($obj:text) [lindex $d 5]
+ #$obj draw
+ }
} {
post BLEH
***************
*** 2710,2714 ****
lappend _($canvas(current):selection) $x
lappend canvas(copied_obj) $x
! if {[llength $canvas(copy_obj)] == [llength $canvas(copied_obj)]} {$canvas(current) paste_wires}
}
}
--- 2745,2751 ----
lappend _($canvas(current):selection) $x
lappend canvas(copied_obj) $x
! if {[llength $canvas(copy_obj)] == [llength $canvas(copied_obj)]} {
! $canvas(current) paste_wires
! }
}
}
***************
*** 2873,2877 ****
#class_new BlueBox {Box Labeled}
! def BlueBox draw {} {
global look
super
--- 2910,2914 ----
#class_new BlueBox {Box Labeled}
! def* BlueBox draw {} {
global look
super
More information about the Pd-cvs
mailing list