[PD-cvs] pd/src desire.tk,1.1.2.126,1.1.2.127

chunlee chunlee at users.sourceforge.net
Fri Nov 25 10:54:39 CET 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31186

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
got wire to render (it doesn't update yet), but not yet to clean up the 
code yet


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.126
retrieving revision 1.1.2.127
diff -C2 -d -r1.1.2.126 -r1.1.2.127
*** desire.tk	23 Nov 2005 16:48:51 -0000	1.1.2.126
--- desire.tk	25 Nov 2005 09:54:37 -0000	1.1.2.127
***************
*** 67,74 ****
--- 67,76 ----
  
  def* observable changed {args} {
+ 	puts "____ subscribers:$@subscribers ____"
  	foreach x $@subscribers {eval [concat [list $x notice $self] $args]}
  }
  
  def* observable child_changed {origin args} {
+ 	#puts "==== [concat [list $x notice $origin] $args] ===="
  	foreach x $@subscribers {eval [concat [list $x notice $origin] $args]}
  }
***************
*** 1322,1325 ****
--- 1324,1328 ----
  	# think of the children!!!
  	set born [lwithout $children $@children]; foreach x $born {$x   subscribe $self; $x changed; $x canvas= $self}
+ 	puts "---------------- born:$born"
  	set dead [lwithout $@children $children]; foreach x $dead {$x unsubscribe $self; $x erase}
  	set @children $children
***************
*** 1342,1348 ****
  def* canvas wires= {wires2} {
  	set wires {}
! 	set born [lwithout $wires $@wires]; foreach x $born {$x   subscribe $self; $x changed; $x canvas= $self}
! 	set dead [lwithout $@wires $wires]; foreach x $dead {$x unsubscribe $self; $x erase}
! 	set @wires $wires
  	foreach x $wires2 {
  		if {[llength $x]==4} {
--- 1345,1354 ----
  def* canvas wires= {wires2} {
  	set wires {}
! 	#set born [lwithout $wires $@wires]; foreach x $born {$x   subscribe $self; $x changed; $x canvas= $self}
! 	#puts "===== born:$born"
! 	#set dead [lwithout $@wires $wires]; foreach x $dead {$x unsubscribe $self; $x erase}
! 	#set @wires $wires
! 	#puts "===== [concat [list wire_new $self]]"
! 	
  	foreach x $wires2 {
  		if {[llength $x]==4} {
***************
*** 1352,1356 ****
--- 1358,1371 ----
  		}
  	}
+ 	
+ 	set born [lwithout $wires $@wires]; foreach x $born {$x   subscribe $self; $x changed; $x canvas= $self}
+ 	puts "===== born:$born"
+ 	set dead [lwithout $@wires $wires]; foreach x $dead {$x unsubscribe $self; $x erase}
+ 	set @wires $wires
+ 	puts "===== [concat [list wire_new $self]]"
+ 	
+ 	puts "==== self:$self wires:$wires"
  	$self changed
+ 	#$wires changed
  }
  
***************
*** 1961,1965 ****
         $@canvas deselect_all
         set _($@canvas:selection) $self
!        set _($@canvas:action) move
      }
  
--- 1976,1981 ----
         $@canvas deselect_all
         set _($@canvas:selection) $self
!        #set _($@canvas:action) move
!        set _($@canvas:action) edit
      }
  
***************
*** 1987,2008 ****
  class_new wire {view}
  
! def* wire init {children from outno to inno} {
      super
!     set from_obj [lindex $children $from]
!     set to_obj [lindex $children $to]
!     puts "......from:$from_obj outlet:$outno to:$to_obj inlet:$inno"
      # no time to carry on for now......
  
  }
  
! def wire draw {} {
  	global look
! 	set bbox1 [$canvas bbox [join [list "$@obj1" o "$@port1"] ""]]
! 	set bbox2 [$canvas bbox [join [list "$@obj2" i "$@port2"] ""]]
  	if {[llength $bbox1] < 4} {puts stderr "wire_draw: crap ($@obj1 outlet)"; return}
  	if {[llength $bbox2] < 4} {puts stderr "wire_draw: crap ($@obj2 inlet)";  return}
  	mset {x1 y1} [l/2 [l+ [lrange $bbox1 0 1] [lrange $bbox1 2 3]]]
  	mset {x2 y2} [l/2 [l+ [lrange $bbox2 0 1] [lrange $bbox2 2 3]]]
! 	wire_draw $self 1 $x1 $y1 $x2 $y2
  	set xys [list $x1 $y1 $x2 $y2]
  	set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))]
--- 2003,2032 ----
  class_new wire {view}
  
! def* wire init {canvas from outno to inno} {
      super
!     global _
!     #puts "------ children:$_($canvas:children)"
!     #hack
!     set children $_($canvas:children)
!     set @obj1 [lindex $children $from]
!     set @obj2 [lindex $children $to]
!     set @port1 $outno
!     set @port2 $inno
!     #puts "......from:$@obj1 outlet:$@port1 to:$@obj2 inlet:$@port2"
      # no time to carry on for now......
  
  }
  
! def* wire draw {} {
  	global look
! 	set thick 2
! 	puts "------- from:$@obj1 outlet:$@port1 to:$@obj2 inlet:$@port2"
! 	set bbox1 [.$@canvas.c bbox [join [list "$@obj1" o "$@port1"] ""]]
! 	set bbox2 [.$@canvas.c bbox [join [list "$@obj2" i "$@port2"] ""]]
  	if {[llength $bbox1] < 4} {puts stderr "wire_draw: crap ($@obj1 outlet)"; return}
  	if {[llength $bbox2] < 4} {puts stderr "wire_draw: crap ($@obj2 inlet)";  return}
  	mset {x1 y1} [l/2 [l+ [lrange $bbox1 0 1] [lrange $bbox1 2 3]]]
  	mset {x2 y2} [l/2 [l+ [lrange $bbox2 0 1] [lrange $bbox2 2 3]]]
! 	#wire_draw $self 1 $x1 $y1 $x2 $y2
  	set xys [list $x1 $y1 $x2 $y2]
  	set length [expr sqrt(pow($x2-$x1,2)+pow($y2-$y1,2))]
***************
*** 2190,2193 ****
--- 2214,2218 ----
  		incr i
  	}
+ 	puts "==== x:$x"
  	$x changed
  }





More information about the Pd-cvs mailing list