[PD-cvs] pd/src g_array.c,1.1.1.3.2.2.2.4,1.1.1.3.2.2.2.5 g_canvas.c,1.1.1.4.2.7.2.13,1.1.1.4.2.7.2.14 g_canvas.h,1.1.1.4.2.4.2.2,1.1.1.4.2.4.2.3 g_editor.c,1.1.1.4.2.3.2.17,1.1.1.4.2.3.2.18 u_main.tk,1.1.1.4.2.7.4.51,1.1.1.4.2.7.4.52 u_object.tk,1.1.2.27,1.1.2.28

Mathieu Bouchard matju at users.sourceforge.net
Sat May 1 03:46:20 CEST 2004


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

Modified Files:
      Tag: impd_0_37
	g_array.c g_canvas.c g_canvas.h g_editor.c u_main.tk 
	u_object.tk 
Log Message:
removed old bugs, added new ones


Index: g_array.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_array.c,v
retrieving revision 1.1.1.3.2.2.2.4
retrieving revision 1.1.1.3.2.2.2.5
diff -C2 -d -r1.1.1.3.2.2.2.4 -r1.1.1.3.2.2.2.5
*** g_array.c	2 Apr 2004 00:16:42 -0000	1.1.1.3.2.2.2.4
--- g_array.c	1 May 2004 01:46:18 -0000	1.1.1.3.2.2.2.5
***************
*** 10,13 ****
--- 10,15 ----
  #include <math.h>
  
+ #define MIN(a,b) ((a)<(b)?(a):(b))
+ 
  /* fabsf is ISO C 1999 actually */
  /* #define fabsf(x) ((float)fabs(x)) */
***************
*** 608,614 ****
      	    	if (ixpix != lastpixel)
      	    	{
!     	    	    sys_vgui("%d %f \\\n", ixpix,
      	    	    	glist_ytopixels(glist, yval));
      	    	    ndrawn++;
      	    	}
      	    	lastpixel = ixpix;
--- 610,617 ----
      	    	if (ixpix != lastpixel)
      	    	{
!     	    	    sys_vgui("%d %f ", ixpix,
      	    	    	glist_ytopixels(glist, yval));
      	    	    ndrawn++;
+ 		    if (ndrawn%4==0) sys_vgui("\\\n");
      	    	}
      	    	lastpixel = ixpix;
***************
*** 617,622 ****
      	    }
      	    	/* TK will complain if there aren't at least 2 points... */
!     	    if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n");
!     	    else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix,
      	    	    	glist_ytopixels(glist, yval));
      	    sys_vgui("-tags .x%x.a%x\n", glist_getcanvas(glist), x);
--- 620,625 ----
      	    }
      	    	/* TK will complain if there aren't at least 2 points... */
!     	    if (ndrawn == 0) sys_vgui("0 0 0 0 ");
!     	    else if (ndrawn == 1) sys_vgui("%d %f ", ixpix,
      	    	    	glist_ytopixels(glist, yval));
      	    sys_vgui("-tags .x%x.a%x\n", glist_getcanvas(glist), x);
***************
*** 650,655 ****
  }
  
- #define ARRAYWRITECHUNKSIZE 1000
- 
  static void garray_save(t_gobj *z, t_binbuf *b)
  {
--- 653,656 ----
***************
*** 670,675 ****
  	{
  	    int chunk = n - n2, i;
! 	    if (chunk > ARRAYWRITECHUNKSIZE)
! 	    	chunk = ARRAYWRITECHUNKSIZE;
  	    binbuf_addv(b, "si", gensym("#A"), n2);
  	    for (i = 0; i < chunk; i++)
--- 671,675 ----
  	{
  	    int chunk = n - n2, i;
! 	    chunk = MIN(chunk,1000);
  	    binbuf_addv(b, "si", gensym("#A"), n2);
  	    for (i = 0; i < chunk; i++)

Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.1.1.4.2.7.4.51
retrieving revision 1.1.1.4.2.7.4.52
diff -C2 -d -r1.1.1.4.2.7.4.51 -r1.1.1.4.2.7.4.52
*** u_main.tk	27 Apr 2004 18:09:35 -0000	1.1.1.4.2.7.4.51
--- u_main.tk	1 May 2004 01:46:18 -0000	1.1.1.4.2.7.4.52
***************
*** 544,550 ****
  #########
  
! proc stat_pos_update {self x y} {
      global _
      set canvas $self.c
      set cx [$canvas canvasx $x]
      set cy [$canvas canvasy $y]
--- 544,567 ----
  #########
  
! proc canvas_select_object {canvas member flag} {
      global _
+     set self [canvastosym $canvas]
+     set i [lsearch $_($self:selection) $member]
+     switch -- $flag {
+       1 { # add
+ 	if {$i<0} {lappend _($self:selection) $member}
+       }
+       0 { # remove
+         if {$i>=0} {set _($self:selection) [lreplace $_($self:selection) $i $i]}
+       }
+     }
+ }
+ 
+ #########
+ 
+ proc statusbar_update {self x y} {
+     global _ cmdline
      set canvas $self.c
+     if {!$cmdline(statusbar)} {return}
      set cx [$canvas canvasx $x]
      set cy [$canvas canvasy $y]
***************
*** 565,568 ****
--- 582,588 ----
      }
      $self.stat.what configure -text "... $tags"
+     $self.stat.mode configure -text $_($self:mode)
+     $self.stat.action configure -text $_($self:action)
+     $self.stat.sel configure -text [llength $_($self:selection)]
  }
  
***************
*** 585,596 ****
      }
      if {$cmdline(statusbar)} {
! 	frame $name.stat -border 2 -relief ridge
! 	label $name.stat.pos -width 12 -font {courier 9} \
! 		-background #cccccc -foreground black
! 	label $name.stat.what -width 40 -font {courier 9} -anchor w \
  		-background #cccccc -foreground black
! 	pack $name.stat.pos -side left
! 	pack $name.stat.what -side left -padx 8
! 	pack $name.stat -side bottom -fill x
      }
      pack $name.scrollhort -side bottom -fill x
--- 605,621 ----
      }
      if {$cmdline(statusbar)} {
!         set f $name.stat
! 	frame $f -border 2 -relief ridge
! 	foreach {a b} {pos 12 what 32 mode 4 action 4 sel 4} {
! 		label $f.$a -width $b -font {courier 9} \
  		-background #cccccc -foreground black
! 	}
! 	label $f.mode_l -text " Mode: "
! 	label $f.action_l -text " Action: "
! 	label $f.sel_l -text " Sel: "
! 	pack $f.pos -side left
! 	pack $f.what -side left -padx 8
! 	pack $f -side bottom -fill x
! 	pack $f.mode_l $f.mode $f.action_l $f.action $f.sel_l $f.sel -side left
      }
      pack $name.scrollhort -side bottom -fill x
***************
*** 762,768 ****
      focus $name.c
      pdtk_canvas_editval $name $editable
!     if {$cmdline(statusbar)} {
!         bind $name.c <Motion> "+stat_pos_update $name %x %y"
!     }
  
      global pd_nt
--- 787,791 ----
      focus $name.c
      pdtk_canvas_editval $name $editable
!     bind $name.c <Motion> "+statusbar_update $name %x %y"
  
      global pd_nt
***************
*** 781,785 ****
  #    $name [$name.c cget -width] [winfo screenwidth $name]
  #    set mh [winfo screenheight $name]
! 
  }
  
--- 804,811 ----
  #    $name [$name.c cget -width] [winfo screenwidth $name]
  #    set mh [winfo screenheight $name]
!     global _
!     set self [canvastosym $name.c]
!     set _($self:action) none
!     set _($self:selection) {}
  }
  
***************
*** 856,859 ****
--- 882,890 ----
  		}
  	    }
+ 	    # selection
+ 	    if {[lsearch $_($self:selection) $id]<0} {
+ 		pd "$self deselect-all ; $self select-object x$id ;"
+ 	    }
+ 	    set _($self:action) move
  	}
        }
***************
*** 871,875 ****
  
  proc pdtk_canvas_motion {canvas x y mods} {
!     global current_x current_y tooltip _ dehighlight look wire_from wire_to
      set self [canvastosym $canvas]
      set cx [$canvas canvasx $x]
--- 902,907 ----
  
  proc pdtk_canvas_motion {canvas x y mods} {
!     global current_x current_y old_x old_y
!     global tooltip _ dehighlight look wire_from wire_to
      set self [canvastosym $canvas]
      set cx [$canvas canvasx $x]
***************
*** 884,887 ****
--- 916,921 ----
      eval $dehighlight
      set dehighlight {}
+     set old_x $current_x
+     set old_y $current_y
      set current_x $cx
      set current_y $cy
***************
*** 899,903 ****
  	#return
      }
!     foreach {type id} [identify_target $canvas $x $y -1 -1 "move "] {}
      switch $type {
        object {
--- 933,943 ----
  	#return
      }
!     switch $_($self:action) {
!       move {
!         pd "$self displace-selection [expr $cx-$old_x] [expr $cy-$old_y] ;\n"
! 	return
!       }
!     }
!     foreach {type id} [identify_target $canvas $cx $cy -1 -1 "move "] {}
      switch $type {
        object {
***************
*** 924,927 ****
--- 964,968 ----
  	    # may highlight an outlet
  	    foreach {x1 y1 x2 y2} [$canvas bbox ${id}BASE] {}
+ 	    #puts "hilite outlet: [expr $y2-3-$cy]"
  	    if {abs($y2-3-$cy)<=3} {
  	        set ports 0
***************
*** 936,941 ****
  	    }
  	  }
- 	} {
- 	    #post "BASEless object?"
  	}
        }
--- 977,980 ----
***************
*** 955,959 ****
  # how to do it right.
  proc pdtk_canvas_mouseup {name x y b} {
!     global pdtk_canvas_mouseup wire_from wire_to
      set cx [$name canvasx $x]
      set cy [$name canvasy $y]
--- 994,998 ----
  # how to do it right.
  proc pdtk_canvas_mouseup {name x y b} {
!     global pdtk_canvas_mouseup wire_from wire_to _
      set cx [$name canvasx $x]
      set cy [$name canvasy $y]
***************
*** 993,996 ****
--- 1032,1036 ----
      }
      pdtk_canvas_checkgeometry [canvastosym $name]
+     set _($self:action) none
  }
  
***************
*** 2236,2242 ****
  proc tcl_eval {} {
  	set l [.tcl.entry get]
- 	post "tcl: $l\nreturns: [eval $l]"
  	listener_append .tcl [.tcl.entry get]
  	.tcl.entry delete 0 end
  }
  
--- 2276,2282 ----
  proc tcl_eval {} {
  	set l [.tcl.entry get]
  	listener_append .tcl [.tcl.entry get]
  	.tcl.entry delete 0 end
+ 	post "tcl: $l\nreturns: [eval $l]"
  }
  

Index: g_canvas.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.h,v
retrieving revision 1.1.1.4.2.4.2.2
retrieving revision 1.1.1.4.2.4.2.3
diff -C2 -d -r1.1.1.4.2.4.2.2 -r1.1.1.4.2.4.2.3
*** g_canvas.h	27 Apr 2004 18:09:35 -0000	1.1.1.4.2.4.2.2
--- g_canvas.h	1 May 2004 01:46:18 -0000	1.1.1.4.2.4.2.3
***************
*** 231,239 ****
      int tr_nin;
      int tr_inno;
- #ifndef MATJU1
-     int tr_x11, tr_y11, tr_x12, tr_y12;
-     int tr_x21, tr_y21, tr_x22, tr_y22;
-     int tr_lx1, tr_ly1, tr_lx2, tr_ly2;
- #endif
      t_outconnect *tr_nextoc;
      int tr_nextoutno;
--- 231,234 ----

Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.1.1.4.2.3.2.17
retrieving revision 1.1.1.4.2.3.2.18
diff -C2 -d -r1.1.1.4.2.3.2.17 -r1.1.1.4.2.3.2.18
*** g_editor.c	26 Apr 2004 08:45:12 -0000	1.1.1.4.2.3.2.17
--- g_editor.c	1 May 2004 01:46:18 -0000	1.1.1.4.2.3.2.18
***************
*** 74,95 ****
  /* ------------------------ managing the selection ----------------- */
  
  void glist_deselectline(t_glist *x)
  {
!     if (x->gl_editor)
!     {
!     	x->gl_editor->e_selectedline = 0;
! 	sys_vgui("wire_select l%x .x%x.c 0\n", x->gl_editor->e_selectline_tag, x);
!     }    
  }
  
  int glist_isselected(t_glist *x, t_gobj *y)
  {
!     if (x->gl_editor)
!     {
!     	t_selection *sel;
!     	for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
!     	    if (sel->sel_what == y) return (1);
!     }
!     return (0);
  }
  
--- 74,106 ----
  /* ------------------------ managing the selection ----------------- */
  
+ /*
+ static void glist_uploadselection(t_glist *x) {
+     	t_selection *sel;
+ 	if (x->gl_editor->e_selectedline) {
+ 		sys_vgui("global _; set _(%x:selection) {l%x}\n", x->gl_editor->e_selectline_tag);
+ 		return;
+ 	}
+ 	sys_vgui("global _; set _(%x:selection) {");
+     	for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) {
+ 		sys_vgui("%x ",sel->sel_what);
+ 	}
+ 	sys_vgui("}\n");
+ }
+ */
+ 
  void glist_deselectline(t_glist *x)
  {
!     if (!x->gl_editor) return;
!     x->gl_editor->e_selectedline = 0;
!     sys_vgui("wire_select l%x .x%x.c 0\n", x->gl_editor->e_selectline_tag, x);
  }
  
  int glist_isselected(t_glist *x, t_gobj *y)
  {
!     t_selection *sel;
!     if (!x->gl_editor) return 0;
!     for (sel=x->gl_editor->e_selection; sel; sel=sel->sel_next)
! 	if (y==sel->sel_what) return 1;
!     return 0;
  }
  
***************
*** 97,112 ****
  void glist_select(t_glist *x, t_gobj *y)
  {
!     if (x->gl_editor)
!     {
! 	t_selection *sel = (t_selection *)getbytes(sizeof(*sel));
! 	if (x->gl_editor->e_selectedline)
! 	    glist_deselectline(x);
! 	    /* LATER #ifdef out the following check */
! 	if (glist_isselected(x, y)) bug("glist_select");
! 	sel->sel_next = x->gl_editor->e_selection;
! 	sel->sel_what = y;
! 	x->gl_editor->e_selection = sel;
! 	gobj_select(y, x, 1);
!     }
  }
  
--- 108,121 ----
  void glist_select(t_glist *x, t_gobj *y)
  {
!     t_selection *sel;
!     if (!x->gl_editor) return;
!     sel = (t_selection *)getbytes(sizeof(*sel));
!     if (x->gl_editor->e_selectedline) glist_deselectline(x);
!     /* LATER #ifdef out the following check */
!     if (glist_isselected(x, y)) bug("glist_select");
!     sel->sel_next = x->gl_editor->e_selection;
!     sel->sel_what = y;
!     x->gl_editor->e_selection = sel;
!     gobj_select(y, x, 1);
  }
  
***************
*** 737,745 ****
  static void canvas_properties(t_glist *x)
  {
!     char graphbuf[200];
!     sprintf(graphbuf, "pdtk_canvas_dialog %%s %g %g %g %g \n",
  	glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
  	(float)glist_isgraph(x), (float)x->gl_stretch);
!     gfxstub_new(&x->gl_pd, x, graphbuf);
  }
  
--- 746,754 ----
  static void canvas_properties(t_glist *x)
  {
!     char buf[200];
!     sprintf(buf, "pdtk_canvas_dialog %%s %g %g %g %g \n",
  	glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
  	(float)glist_isgraph(x), (float)x->gl_stretch);
!     gfxstub_new(&x->gl_pd, x, buf);
  }
  
***************
*** 939,952 ****
  t_float x, t_float y, t_float b, t_float f) {
      int run, shift, alt, rightclick;
!     t_object *id = 0;
      canvas_modifiers(self,f,0,&run,&shift,&alt,&rightclick);
      post("canvas_click_on_object: 0x%08x %s %f %f %f %f",
  		(unsigned)self, objsym->s_name, x, y, b, f);
      /*post("shift=%d run=%d alt=%d rightclick=%d b=%f f=%f",shift,run,alt,rightclick,b,f);*/
!     if (!sscanf(objsym->s_name,"x%x",&id)) {post("BORK!!!"); return;}
      if (!run && !alt && !shift && !rightclick) {
      }
  }
  
  /* mouse click */
  void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
--- 948,985 ----
  t_float x, t_float y, t_float b, t_float f) {
      int run, shift, alt, rightclick;
!     t_gobj *id = 0;
      canvas_modifiers(self,f,0,&run,&shift,&alt,&rightclick);
      post("canvas_click_on_object: 0x%08x %s %f %f %f %f",
  		(unsigned)self, objsym->s_name, x, y, b, f);
      /*post("shift=%d run=%d alt=%d rightclick=%d b=%f f=%f",shift,run,alt,rightclick,b,f);*/
!     if (!sscanf(objsym->s_name,"x%x",&id)) {post("BORK!!! %s:%d",__FILE__,__LINE__); return;}
      if (!run && !alt && !shift && !rightclick) {
      }
  }
  
+ static void canvas_select_wire (t_canvas *self, t_symbol *wiresym) {
+ 	post("NOT IMPLEMENTED");
+ }
+ 
+ static void canvas_select_object (t_canvas *self, t_symbol *objsym) {
+     t_gobj *id = 0;
+     if (!sscanf(objsym->s_name,"x%x",&id)) {post("BORK!!! %s:%d",__FILE__,__LINE__); return;}
+     if (glist_isselected(self,id)) {
+ 	post("object %x already is selected!",id);
+ 	return;
+     }
+     glist_select(self,id);
+ }
+ 
+ static void canvas_deselect_object (t_canvas *self, t_symbol *objsym) {
+     t_gobj *id = 0;
+     if (!sscanf(objsym->s_name,"x%x",&id)) {post("BORK!!! %s:%d",__FILE__,__LINE__); return;}
+     if (!glist_isselected(self,id)) {
+ 	post("object %x already is deselected!",id);
+ 	return;
+     }
+     glist_deselect(self,id);
+ }
+ 
  /* mouse click */
  void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
***************
*** 1022,1041 ****
      	    if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4) {}
  /* look for an inlet */
!     	    else if (ob && (ninlet = obj_ninlets(ob)) && ypos <= y1+4)
!     	    {
! /*    	    	int width = x2-x1;
!     	    	int nin1 = ninlet>1 ? ninlet-1 : 1;
!     	    	int closest = ((xpos-x1) * nin1 + width/2)/width;
!     	    	int hotspot = x1 + (width-IOWIDTH)*closest/nin1;
! 		if (closest < ninlet && xpos >= hotspot-1 && xpos <= hotspot + IOWIDTH+1)
! 			canvas_inlettip(x,ob,closest,xpos,ypos);
! */
!     	    }
  	    /* not in an outlet; select and move */
!     	    else if (doit)
      	    {
  		t_rtext *rt;
! 		    /* check if the box is being text edited */
! 	    nooutletafterall:
  		if (ob && (rt = e->e_textedfor) && rt == glist_findrtext(x, ob))
      	    	{
--- 1055,1065 ----
      	    if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4) {}
  /* look for an inlet */
!     	    else if (ob && (ninlet = obj_ninlets(ob)) && ypos <= y1+4) {}
  	    /* not in an outlet; select and move */
! /*
! 		    else if (doit)
      	    {
  		t_rtext *rt;
! 		// check if the box is being text edited
  		if (ob && (rt = e->e_textedfor) && rt == glist_findrtext(x, ob))
      	    	{
***************
*** 1047,1061 ****
      	    	else
  		{
! 			/* otherwise select and drag to displace */
! 		    if (!glist_isselected(x, y))
!     	    	    {
!     	    		glist_noselect(x);
!     	    		glist_select(x, y);
!     	    	    }
! 		    e->e_onmotion = MA_MOVE;
  		}
  	    }
      	    else canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); 
!     	}
      	return;
      }
--- 1071,1080 ----
      	    	else
  		{
! 		    // otherwise select and drag to displace
  		}
  	    }
      	    else canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); 
! */
! }
      	return;
      }
***************
*** 1159,1164 ****
      t_floatarg fxpos, t_floatarg fypos, t_floatarg fwhich)
  {
!     int xpos = fxpos, ypos = fypos, which = fwhich;
!     /* post("mouseup %d %d %d", xpos, ypos, which); */
      if (!x->gl_editor) {bug("editor"); return;}
  #ifdef SIMULATERIGHTCLICK
--- 1178,1183 ----
      t_floatarg fxpos, t_floatarg fypos, t_floatarg fwhich)
  {
!     int xpos = fxpos, ypos = fypos;
!     /* post("mouseup %d %d %d", xpos, ypos); */
      if (!x->gl_editor) {bug("editor"); return;}
  #ifdef SIMULATERIGHTCLICK
***************
*** 1167,1182 ****
      canvas_upy = ypos;
  #endif
! 
! /*    if (x->gl_editor->e_onmotion == MA_CONNECT)
!     	canvas_doconnect(x, xpos, ypos, which, 1);
!     else */ if (x->gl_editor->e_onmotion == MA_REGION)
      	canvas_doregion(x, xpos, ypos, 1);
      else if (x->gl_editor->e_onmotion == MA_MOVE)
      {
!     	    /* after motion, if there's only one item selected, activate it */
      	if (x->gl_editor->e_selection &&
      	    !(x->gl_editor->e_selection->sel_next))
!     	    	gobj_activate(x->gl_editor->e_selection->sel_what,
!     	    	    x, 1);
      }
      else if (x->gl_editor->e_onmotion == MA_PASSOUT)
--- 1186,1197 ----
      canvas_upy = ypos;
  #endif
!     if (x->gl_editor->e_onmotion == MA_REGION)
      	canvas_doregion(x, xpos, ypos, 1);
      else if (x->gl_editor->e_onmotion == MA_MOVE)
      {
!     	/* after motion, if there's only one item selected, activate it */
      	if (x->gl_editor->e_selection &&
      	    !(x->gl_editor->e_selection->sel_next))
!     	    	gobj_activate(x->gl_editor->e_selection->sel_what, x, 1);
      }
      else if (x->gl_editor->e_onmotion == MA_PASSOUT)
***************
*** 1186,1190 ****
  
      /* displace the selection by (dx, dy) pixels */
! static void canvas_displaceselection(t_canvas *x, int dx, int dy)
  {
      t_selection *y;
--- 1201,1205 ----
  
      /* displace the selection by (dx, dy) pixels */
! static void canvas_displaceselection(t_canvas *x, float dx, float dy)
  {
      t_selection *y;
***************
*** 1192,1197 ****
      if (!canvas_undo_already_set_move)
      {
!     	canvas_setundo(x, canvas_undo_move, canvas_undo_set_move(x, 1),
!     	    "motion");
      	canvas_undo_already_set_move = 1;
      }
--- 1207,1211 ----
      if (!canvas_undo_already_set_move)
      {
!     	canvas_setundo(x,canvas_undo_move,canvas_undo_set_move(x, 1),"motion");
      	canvas_undo_already_set_move = 1;
      }
***************
*** 1199,1203 ****
      {
      	t_class *cl = pd_class(&y->sel_what->g_pd);
!     	gobj_displace(y->sel_what, x, dx, dy);
      	if (cl == vinlet_class) resortin = 1;
      	else if (cl == voutlet_class) resortout = 1;
--- 1213,1217 ----
      {
      	t_class *cl = pd_class(&y->sel_what->g_pd);
!     	gobj_displace(y->sel_what, x, (int)dx, (int)dy);
      	if (cl == vinlet_class) resortin = 1;
      	else if (cl == voutlet_class) resortout = 1;
***************
*** 1312,1328 ****
      if (!x->gl_editor) {bug("editor"); return;}
      glist_setlastxy(x, xpos, ypos);
!     if (x->gl_editor->e_onmotion == MA_MOVE)
!     {
!     	canvas_displaceselection(x, 
! 	    xpos - x->gl_editor->e_xwas,
! 	    ypos - x->gl_editor->e_ywas);
!     	x->gl_editor->e_xwas = xpos;
!     	x->gl_editor->e_ywas = ypos;	
!     }
!     else if (x->gl_editor->e_onmotion == MA_REGION)
      	canvas_doregion(x, xpos, ypos, 0);
!     else /* if (x->gl_editor->e_onmotion == MA_CONNECT)
!     	canvas_doconnect(x, xpos, ypos, 0, 0);
!     else */ if (x->gl_editor->e_onmotion == MA_PASSOUT)
      {
      	if (!x->gl_editor->e_motionfn)
--- 1326,1332 ----
      if (!x->gl_editor) {bug("editor"); return;}
      glist_setlastxy(x, xpos, ypos);
!     if (x->gl_editor->e_onmotion == MA_REGION)
      	canvas_doregion(x, xpos, ypos, 0);
!     else if (x->gl_editor->e_onmotion == MA_PASSOUT)
      {
      	if (!x->gl_editor->e_motionfn)
***************
*** 1595,1607 ****
  static void canvas_clearline(t_canvas *x)
  {
!     if (x->gl_editor->e_selectedline)
      {
      	canvas_disconnect(x,
! 	     x->gl_editor->e_selectline_index1, x->gl_editor->e_selectline_outno,
! 	     x->gl_editor->e_selectline_index2, x->gl_editor->e_selectline_inno);
  	canvas_setundo(x, canvas_undo_disconnect,
  	    canvas_undo_set_disconnect(x,
! 	    	x->gl_editor->e_selectline_index1, x->gl_editor->e_selectline_outno,
! 	    	x->gl_editor->e_selectline_index2, x->gl_editor->e_selectline_inno),
  	    "disconnect");
      }
--- 1599,1612 ----
  static void canvas_clearline(t_canvas *x)
  {
!     t_editor *e = x->gl_editor;
!     if (e->e_selectedline)
      {
      	canvas_disconnect(x,
! 	     e->e_selectline_index1, e->e_selectline_outno,
! 	     e->e_selectline_index2, e->e_selectline_inno);
  	canvas_setundo(x, canvas_undo_disconnect,
  	    canvas_undo_set_disconnect(x,
! 	    	e->e_selectline_index1, e->e_selectline_outno,
! 	    	e->e_selectline_index2, e->e_selectline_inno),
  	    "disconnect");
      }
***************
*** 1983,1986 ****
--- 1988,1998 ----
      class_addmethod(c, (t_method)canvas_add_wire, gensym("add-wire"), A_GIMME, A_NULL);
      class_addmethod(c, (t_method)canvas_inlettip, gensym("inlet-tip"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
+ 
+     class_addmethod(c, (t_method)canvas_select_wire, gensym("select-wire"), A_SYMBOL, A_NULL);
+     class_addmethod(c, (t_method)canvas_select_object, gensym("select-object"), A_SYMBOL, A_NULL);
+     class_addmethod(c, (t_method)canvas_deselect_object, gensym("deselect-object"), A_SYMBOL, A_NULL);
+     class_addmethod(c, (t_method)glist_noselect, gensym("deselect-all"), A_NULL);
+     class_addmethod(c, (t_method)canvas_displaceselection, gensym("displace-selection"), A_FLOAT, A_FLOAT, A_NULL);
+ 
  /* ------------------------ menu actions ---------------------------- */
      class_addmethod(c, (t_method)canvas_menuclose, gensym("menuclose"), A_DEFFLOAT, 0);

Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.1.1.4.2.7.2.13
retrieving revision 1.1.1.4.2.7.2.14
diff -C2 -d -r1.1.1.4.2.7.2.13 -r1.1.1.4.2.7.2.14
*** g_canvas.c	26 Apr 2004 11:37:43 -0000	1.1.1.4.2.7.2.13
--- g_canvas.c	1 May 2004 01:46:18 -0000	1.1.1.4.2.7.2.14
***************
*** 281,290 ****
      	    t->tr_nout = obj_noutlets(ob);
      	    outno = 0;
- #ifndef MATJU1
-    	    if (glist_isvisible(t->tr_x))
-    	    	gobj_getrect(y, t->tr_x,
-    	    	    &t->tr_x11, &t->tr_y11, &t->tr_x12, &t->tr_y12);
-    	    else t->tr_x11 = t->tr_y11 = t->tr_x12 = t->tr_y12 = 0;
- #endif /*MATJU1*/
  	}
  	t->tr_nextoutno = outno + 1;
--- 281,284 ----
***************
*** 296,317 ****
      t->tr_nin = obj_ninlets(t->tr_ob2);
      if (!t->tr_nin) bug("drawline");
- #ifndef MATJU1
-     if (glist_isvisible(t->tr_x))
-     {
-     	int inplus = (t->tr_nin == 1 ? 1 : t->tr_nin - 1);
-     	int outplus = (t->tr_nout == 1 ? 1 : t->tr_nout - 1);
-     	gobj_getrect(&t->tr_ob2->ob_g, t->tr_x,
-    	    &t->tr_x21, &t->tr_y21, &t->tr_x22, &t->tr_y22);
-     	t->tr_lx1 = t->tr_x11 + ((t->tr_x12 - t->tr_x11 - IOWIDTH) * t->tr_outno)/outplus + IOMIDDLE;
-     	t->tr_ly1 = t->tr_y12;
-     	t->tr_lx2 = t->tr_x21 + ((t->tr_x22 - t->tr_x21 - IOWIDTH) * t->tr_inno)/inplus + IOMIDDLE;
-     	t->tr_ly2 = t->tr_y21;
-     }
-     else
-     {
-     	t->tr_x21 = t->tr_y21 = t->tr_x22 = t->tr_y22 = 0;
-     	t->tr_lx1 = t->tr_ly1 = t->tr_lx2 = t->tr_ly2 = 0;
-     }
- #endif /*MATJU1*/    
      return (rval);
  }
--- 290,293 ----
***************
*** 373,384 ****
      else x->gl_env = 0;
  
!     if (yloc < GLIST_DEFCANVASYLOC)
!         yloc = GLIST_DEFCANVASYLOC;
!     if (xloc < 0)
!         xloc = 0;
!     x->gl_x1 = 0;
!     x->gl_y1 = 0;
!     x->gl_x2 = 1;
!     x->gl_y2 = 1;
      canvas_setbounds(x, xloc, yloc, xloc + width, yloc + height);
      x->gl_owner = owner;
--- 349,356 ----
      else x->gl_env = 0;
  
!     yloc = MAX(yloc,GLIST_DEFCANVASYLOC);
!     xloc = MAX(xloc,0);
!     x->gl_x1 = x->gl_y1 = 0;
!     x->gl_x2 = x->gl_y2 = 1;
      canvas_setbounds(x, xloc, yloc, xloc + width, yloc + height);
      x->gl_owner = owner;
***************
*** 1403,1404 ****
--- 1375,1377 ----
      g_readwrite_setup();
  }
+ 

Index: u_object.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -C2 -d -r1.1.2.27 -r1.1.2.28
*** u_object.tk	30 Apr 2004 23:04:30 -0000	1.1.2.27
--- u_object.tk	1 May 2004 01:46:18 -0000	1.1.2.28
***************
*** 228,231 ****
--- 228,232 ----
  	if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)}
  	$canvas itemconfigure ${self}BASE -outline $colour
+ 	canvas_select_object $canvas $self $flag
  }
  
***************
*** 240,250 ****
  }
  
! proc brokenbox_select {self canvas flag} {
! 	global look
! 	if {$flag} {set colour #ff0000} {set colour $look(objectframe3)}
! 	$canvas itemconfigure ${self}BASE -outline $colour
! }
  
  proc brokenbox_select {self canvas flag} {objectbox_select $self $canvas $flag}
  proc brokenbox_erase {self canvas} {objectbox_erase $self $canvas}
  
--- 241,253 ----
  }
  
! #proc brokenbox_select {self canvas flag} {
! #	global look
! #	if {$flag} {set colour #ff0000} {set colour $look(objectframe3)}
! #	$canvas itemconfigure ${self}BASE -outline $colour
! #	canvas_select_object $canvas $self $flag
! #}
  
  proc brokenbox_select {self canvas flag} {objectbox_select $self $canvas $flag}
+ 
  proc brokenbox_erase {self canvas} {objectbox_erase $self $canvas}
  
***************
*** 269,272 ****
--- 272,276 ----
  	if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)}
  	$canvas itemconfigure ${self}BASE -outline $colour
+ 	canvas_select_object $canvas $self $flag
  }
  
***************
*** 312,315 ****
--- 316,320 ----
  	if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)}
  	$canvas itemconfigure ${self}BASE -outline $colour
+ 	canvas_select_object $canvas $self $flag
  }
  
***************
*** 370,373 ****
--- 375,379 ----
  	$canvas itemconfigure ${self}BASE4 -fill $colour
  	label_select $self $canvas
+ 	canvas_select_object $canvas $self $flag
  }
  
***************
*** 418,422 ****
  	foreach {x1 y1} [object_xy $self $canvas] {}
  }
! proc comment_select {self canvas flag} {}
  proc comment_erase {self canvas} {}
  
--- 424,430 ----
  	foreach {x1 y1} [object_xy $self $canvas] {}
  }
! proc comment_select {self canvas flag} {
! 	canvas_select_object $canvas $self $flag
! }
  proc comment_erase {self canvas} {}
  
***************
*** 447,450 ****
--- 455,459 ----
  	if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)}
  	$canvas itemconfigure ${self}BASE -outline $colour
+ 	canvas_select_object $canvas $self $flag
  }
  





More information about the Pd-cvs mailing list