[PD-cvs] pd/src g_editor.c,1.1.1.4.2.3.2.14,1.1.1.4.2.3.2.15

Mathieu Bouchard matju at users.sourceforge.net
Mon Apr 19 19:30:00 CEST 2004


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

Modified Files:
      Tag: impd_0_37
	g_editor.c 
Log Message:
bugfixes


Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.1.1.4.2.3.2.14
retrieving revision 1.1.1.4.2.3.2.15
diff -C2 -d -r1.1.1.4.2.3.2.14 -r1.1.1.4.2.3.2.15
*** g_editor.c	17 Apr 2004 06:04:01 -0000	1.1.1.4.2.3.2.14
--- g_editor.c	19 Apr 2004 17:29:58 -0000	1.1.1.4.2.3.2.15
***************
*** 914,918 ****
      post("canvas_click_on_wire: 0x%08x %s %f %f %f %f",
  		(unsigned)self, linesym->s_name, x, y, b, f);
!     /*post("shiftmod=%d runmode=%d altmod=%d rightclick=%d b=%f f=%f",shiftmod,runmode,altmod,rightclick,b,f);*/
      if (!run && !alt && !shift && !rightclick) {
  	/* change selection to single wire */
--- 914,918 ----
      post("canvas_click_on_wire: 0x%08x %s %f %f %f %f",
  		(unsigned)self, linesym->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 (!run && !alt && !shift && !rightclick) {
  	/* change selection to single wire */
***************
*** 933,943 ****
  }
  
! void canvas_click_on_object(t_canvas *self, t_symbol *linesym,
  t_float x, t_float y, t_float b, t_float f) {
      int run, shift, alt, rightclick;
      canvas_modifiers(self,f,0,&run,&shift,&alt,&rightclick);
      post("canvas_click_on_object: 0x%08x %s %f %f %f %f",
! 		(unsigned)self, linesym->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 (!run && !alt && !shift && !rightclick) {
      }
--- 933,945 ----
  }
  
! void canvas_click_on_object(t_canvas *self, t_symbol *objsym,
  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) {
      }
***************
*** 949,954 ****
  {
      int run, shift, alt, rightclick;
-     canvas_modifiers(x,mod,doit,&run,&shift,&alt,&rightclick);
      int x1, y1, x2, y2, clickreturned = 0;
      t_gobj *y;
      t_editor *e = x->gl_editor;
--- 951,956 ----
  {
      int run, shift, alt, rightclick;
      int x1, y1, x2, y2, clickreturned = 0;
+     canvas_modifiers(x,mod,doit,&run,&shift,&alt,&rightclick);
      t_gobj *y;
      t_editor *e = x->gl_editor;
***************
*** 965,978 ****
  
      e->e_lastmoved = 0;
!     if (doit)
!     {
!     	e->e_grab = 0;
!     	e->e_onmotion = MA_NONE;
!     }
!     /* post("click %d %d %d %d", xpos, ypos, which, mod); */
!     
!     if (e->e_onmotion != MA_NONE)
!     	return;
! 
      e->e_xwas = xpos;
      e->e_ywas = ypos;
--- 967,972 ----
  
      e->e_lastmoved = 0;
!     if (doit) {e->e_grab = 0; e->e_onmotion = MA_NONE;}
!     if (e->e_onmotion != MA_NONE) return;
      e->e_xwas = xpos;
      e->e_ywas = ypos;
***************
*** 982,994 ****
      	for (y = x->gl_list; y; y = y->g_next)
  	{
! 	    	/* check if the object wants to be clicked */
      	    if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)
  	    	&& (clickreturned = gobj_click(y,x,xpos,ypos,shift,alt,0,doit)))
!     	    	    	break;
  	}
  	if (!doit) canvas_setcursor(x, y?clickreturned:CURSOR_RUNMODE_NOTHING);
  	return;
      }
- /*    sys_vgui(".x%x.c delete x\n",x);*/
  
      /* if not a runmode left click, fall here. */
--- 976,987 ----
      	for (y = x->gl_list; y; y = y->g_next)
  	{
! 	    /* check if the object wants to be clicked */
      	    if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)
  	    	&& (clickreturned = gobj_click(y,x,xpos,ypos,shift,alt,0,doit)))
!     	    	    break;
  	}
  	if (!doit) canvas_setcursor(x, y?clickreturned:CURSOR_RUNMODE_NOTHING);
  	return;
      }
  
      /* if not a runmode left click, fall here. */
***************
*** 998,1003 ****
      	/* check you're in the rectangle */
      	ob = pd_checkobject(&y->g_pd);
!     	if (rightclick)
! 	    canvas_rightclick(x, xpos, ypos, y);
      	else if (shift)
      	{
--- 991,995 ----
      	/* check you're in the rectangle */
      	ob = pd_checkobject(&y->g_pd);
!     	if (rightclick) canvas_rightclick(x, xpos, ypos, y);
      	else if (shift)
      	{
***************
*** 1023,1047 ****
      	else
      	{
- /* make new wire? */
  	    int noutlet,ninlet;
!     	    if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4)
!     	    {
! /*  	    	int width = x2-x1;
!     	    	int nout1 = noutlet>1 ? noutlet-1 : 1;
!     	    	int closest = ((xpos-x1) * nout1 + width/2)/width;
!     	    	int hotspot = x1 + (width-IOWIDTH)*closest/nout1;
! 		if (closest < noutlet && xpos >= hotspot-1 && xpos <= hotspot + IOWIDTH+1)
!     	    	{
!     	    	    if (doit)
!     	    	    {
!     	    	    	e->e_onmotion = MA_CONNECT;
!     	    	    	e->e_xwas = xpos;
!     	    	    	e->e_ywas = ypos;
!     	    	    }    	    	    	    	
!     	    	    else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT);
!     	    	}
! 		else if (doit) goto nooutletafterall;
! */
! 	    }
  /* look for an inlet */
      	    else if (ob && (ninlet = obj_ninlets(ob)) && ypos <= y1+4)
--- 1015,1020 ----
      	else
      	{
  	    int noutlet,ninlet;
!     	    if (ob && (noutlet = obj_noutlets(ob)) && ypos >= y2-4) {}
  /* look for an inlet */
      	    else if (ob && (ninlet = obj_ninlets(ob)) && ypos <= y1+4)
***************
*** 1140,1144 ****
  		    	"connect");
  	} else {
! 		post("BORK");
  	}
  }
--- 1113,1117 ----
  		    	"connect");
  	} else {
! 		post("BORK at %s:%d",__FILE__,__LINE__);
  	}
  }





More information about the Pd-cvs mailing list