[PD-cvs] pd/src desire.c, 1.1.2.50, 1.1.2.51 desire.tk, 1.1.2.119, 1.1.2.120

Mathieu Bouchard matju at users.sourceforge.net
Sat Nov 12 10:33:33 CET 2005


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

Modified Files:
      Tag: devel_0_39
	desire.c desire.tk 
Log Message:
server-side wires


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.119
retrieving revision 1.1.2.120
diff -C2 -d -r1.1.2.119 -r1.1.2.120
*** desire.tk	11 Nov 2005 01:51:06 -0000	1.1.2.119
--- desire.tk	12 Nov 2005 09:33:31 -0000	1.1.2.120
***************
*** 1360,1365 ****
  }
  
- def canvas children_index {child} {lindex $@children $child}
- 
  def* canvas add {obj} {
  	set i [lsearch $@children $obj]
--- 1360,1363 ----
***************
*** 1471,1481 ****
  	if {$@editmode && [llength [$id bbox]]} {
  	  mset {x1 y1 x2 y2} [$id bbox]
! 	  if {abs($y1+3-$y)<=3} {
  		set port [$id hilite_io i $x $y]
  		set @dehighlight "$c delete ${id}i${port}b; set wire_to {}"
  		return
  	  }
! 	  if {abs($y2-3-$y)<=3} {
  		set port [$id hilite_io o $x $y]
  		set @dehighlight "$c delete ${id}o${port}b"
  		return
--- 1469,1483 ----
  	if {$@editmode && [llength [$id bbox]]} {
  	  mset {x1 y1 x2 y2} [$id bbox]
! 	  post %s "y=$y y1=$y1 y2=$y2"
! 	  if {$y<$y1+6} {
  		set port [$id hilite_io i $x $y]
+ 		if {$port==""} return
  		set @dehighlight "$c delete ${id}i${port}b; set wire_to {}"
+ 		set @wire_to [list $id $port]
  		return
  	  }
! 	  if {$y>=$y2-6} {
  		set port [$id hilite_io o $x $y]
+ 		if {$port==""} return
  		set @dehighlight "$c delete ${id}o${port}b"
  		return
***************
*** 1511,1514 ****
--- 1513,1517 ----
  }
  
+ 
  #-----------------------------------------------------------------------------------#
  class_new statusbar {view}
***************
*** 1615,1624 ****
  	mset {x1 y1 x2 y2} [$id bbox]
  	set outs 0; set outs [$id noutlets]
! 	post %s "y=$y y1=$y1 y2=$y2 abs(\$y2-3-\$y)=[expr abs($y2-3-$y)] outs=$outs"
! 	if {abs($y2-3-$y)<=3 && $outs} {
  		set out [expr int(($x-$x1)*$outs/($x2-$x1))]
  		mset {x1 y1 x2 y2} [$c bbox ${id}o${out}]
  		$c create line  [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] $x $y -dash {4 4 4 4} -tags lnew
! 		set @wire_from [list $self $out]
  		set @action wire
  		return
--- 1618,1626 ----
  	mset {x1 y1 x2 y2} [$id bbox]
  	set outs 0; set outs [$id noutlets]
! 	if {$y>=$y2-6 && $outs} {
  		set out [expr int(($x-$x1)*$outs/($x2-$x1))]
  		mset {x1 y1 x2 y2} [$c bbox ${id}o${out}]
  		$c create line  [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] $x $y -dash {4 4 4 4} -tags lnew
! 		set @wire_from [list $id $out]
  		set @action wire
  		return
***************
*** 1633,1637 ****
  
  def* canvas click {x y b f} {
-     global look focus
      set c .$self.c
      focus $c
--- 1635,1638 ----
***************
*** 1685,1692 ****
          mset {x1 y1 x2 y2} [$id bbox]
          set ins 0; set ins [$id ninlets]
!         if {abs($y1+3-$y)<=3 && $ins} {
  	  set in [expr int(($x-$x1)*$ins/($x2-$x1))]
  	  set @wire_to [list $id $in]
! 	  }
  	puts "connect $@wire_from $@wire_to"
  	}
--- 1686,1698 ----
          mset {x1 y1 x2 y2} [$id bbox]
          set ins 0; set ins [$id ninlets]
!         if {$y<$y1+6 && $ins} {
  	  set in [expr int(($x-$x1)*$ins/($x2-$x1))]
  	  set @wire_to [list $id $in]
! 	  post "wire_from=%s wire_to=%s" $@wire_from $@wire_to
! 	  mset {from outlet} $@wire_from
! 	  mset {to    inlet} $@wire_to
! 	  pd .$self connect [lsearch $@children $from] $inlet \
! 			    [lsearch $@children $to]  $outlet
! 	}
  	puts "connect $@wire_from $@wire_to"
  	}

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.50
retrieving revision 1.1.2.51
diff -C2 -d -r1.1.2.50 -r1.1.2.51
*** desire.c	7 Nov 2005 01:26:53 -0000	1.1.2.50
--- desire.c	12 Nov 2005 09:33:30 -0000	1.1.2.51
***************
*** 3555,3559 ****
          while (inno >= obj_ninlets(objsink))
              inlet_new(objsink, &objsink->ob_pd, &s_, &s_);
! 
      if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
      if (glist_isvisible(x))
--- 3555,3560 ----
          while (inno >= obj_ninlets(objsink))
              inlet_new(objsink, &objsink->ob_pd, &s_, &s_);
!     post("canvas_connect: objsrc=%d outno=%d objsink=%d inno=%d",objsrc,outno,objsink,inno);
!     gobj_changed(x,"");
      if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
      if (glist_isvisible(x))
***************
*** 12260,12264 ****
  	binbuf_gettext(buf,&s,&n);
  	sys_vgui("update_object x%lx {%.*s}\n", (long)self,n,s);
! 	sys_mgui(self,"ninlets=","i", obj_ninlets((t_text *)self));
  	sys_mgui(self,"noutlets=","i",obj_noutlets((t_text *)self));
  	binbuf_free(buf);
--- 12261,12265 ----
  	binbuf_gettext(buf,&s,&n);
  	sys_vgui("update_object x%lx {%.*s}\n", (long)self,n,s);
! 	sys_mgui(self,"ninlets=" ,"i", obj_ninlets((t_text *)self));
  	sys_mgui(self,"noutlets=","i",obj_noutlets((t_text *)self));
  	binbuf_free(buf);
***************
*** 12267,12274 ****
  		// buffer overflow bug here
  		char foo[4096];
! 		char *bar = foo;
  		t_gobj *y;
  		glist_each(y,(t_canvas *)self) bar+=sprintf(bar,"x%lx ",(long)y);
  		sys_mgui((t_gobj *)self,"children=","S",foo);
  	}
  }
--- 12268,12284 ----
  		// buffer overflow bug here
  		char foo[4096];
! 		char *bar;
! 		t_linetraverser t;
! 		t_outconnect *oc;
  		t_gobj *y;
+ 		bar=foo; *foo=0;
+ 		linetraverser_start(&t,(t_canvas *)self);
  		glist_each(y,(t_canvas *)self) bar+=sprintf(bar,"x%lx ",(long)y);
  		sys_mgui((t_gobj *)self,"children=","S",foo);
+ 		bar=foo; *foo=0;
+ 		while((oc = linetraverser_next(&t))) bar+=sprintf(bar,"%ld %ld %ld %ld ",
+ 			(long)canvas_getindex((t_canvas *)self,(t_gobj *)t.tr_ob),  (long)t.tr_outno,
+ 			(long)canvas_getindex((t_canvas *)self,(t_gobj *)t.tr_ob2), (long)t.tr_inno);
+ 		sys_mgui((t_gobj *)self,"wires=","S",foo);
  	}
  }





More information about the Pd-cvs mailing list