[PD-cvs] pd/src desire.c,1.1.2.81,1.1.2.82

Mathieu Bouchard matju at users.sourceforge.net
Mon Jun 12 22:15:19 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
deleted 240 lines (server-side mouse handling)


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.81
retrieving revision 1.1.2.82
diff -C2 -d -r1.1.2.81 -r1.1.2.82
*** desire.c	12 Jun 2006 17:32:25 -0000	1.1.2.81
--- desire.c	12 Jun 2006 20:15:16 -0000	1.1.2.82
***************
*** 1163,1169 ****
  }
  
- //static void canvas_click(t_canvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
- //{canvas_vis(x, 1);}
- 
  /* find out from subcanvas contents how much to fatten the box */
  void canvas_fattensub(t_canvas *x, int *xp1, int *yp1, int *xp2, int *yp2)
--- 1163,1166 ----
***************
*** 2471,2679 ****
  #define DCLICKINTERVAL 0.25
  
!     /* mouse click */
! void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
!     int mod, int doit)
! {
!     t_gobj *y;
!     int shiftmod, runmode, altmod, doublemod = 0, rightclick;
!     int x1=0, y1=0, x2=0, y2=0, clickreturned = 0;
!     
!     if (!x->gl_editor)
!     {
!         bug("editor");
!         return;
!     }
!     
!     shiftmod = (mod & SHIFTMOD);
!     runmode = ((mod & CTRLMOD) || (!x->gl_edit));
!     altmod = (mod & ALTMOD);
!     rightclick = (mod & RIGHTCLICK);
! 
!     canvas_undo_already_set_move = 0;
! 
!             /* if keyboard was grabbed, notify grabber and cancel the grab */
!     if (doit && x->gl_editor->e_grab && x->gl_editor->e_keyfn)
!     {
!         (* x->gl_editor->e_keyfn) (x->gl_editor->e_grab, 0);
!         glist_grab(x, 0, 0, 0, 0, 0);
!     }
! 
!     if (doit && !runmode && xpos == canvas_upx && ypos == canvas_upy &&
!         sys_getrealtime() - canvas_upclicktime < DCLICKINTERVAL)
! #ifdef SIMULATERIGHTCLICK
!             rightclick = 1;
! #else
!             doublemod = 1;
! #endif
!     x->gl_editor->e_lastmoved = 0;
!     if (doit)
!     {
!         x->gl_editor->e_grab = 0;
!         x->gl_editor->e_onmotion = MA_NONE;
!     }
!     /* post("click %d %d %d %d", xpos, ypos, which, mod); */
!     
!     if (x->gl_editor->e_onmotion != MA_NONE)
!         return;
! 
!     x->gl_editor->e_xwas = xpos;
!     x->gl_editor->e_ywas = ypos;
  
-     if (runmode && !rightclick)
-     {
-         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,
-                     shiftmod, ((mod & CTRLMOD) && (!x->gl_edit)) || altmod,
-                         0, doit)))
-                             break;
-         }
-         if (!doit)
-         {
-             if (y)
-                 canvas_setcursor(x, clickreturned);
-             else canvas_setcursor(x, CURSOR_RUNMODE_NOTHING);
-         }
-         return;
-     }
-         /* if not a runmode left click, fall here. */
-     y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2);
-     if (y) {
-         t_object *ob = pd_checkobject(&y->g_pd);
-             /* check you're in the rectangle */
-         ob = pd_checkobject(&y->g_pd);
-         if (rightclick)
-             canvas_rightclick(x, xpos, ypos, y);
-         else if (shiftmod)
-         {
-             if (doit)
-             {
-                 t_rtext *rt;
-                 if (ob && (rt = x->gl_editor->e_textedfor) &&
-                     rt == glist_findrtext(x, ob))
-                 {
-                     rtext_mouse(rt, xpos - x1, ypos - y1, RTEXT_SHIFT);
-                     x->gl_editor->e_onmotion = MA_DRAGTEXT;
-                     x->gl_editor->e_xwas = x1;
-                     x->gl_editor->e_ywas = y1;
-                 }
-                 else
-                 {
-                     if (glist_isselected(x, y))
-                         glist_deselect(x, y);
-                     else glist_select(x, y);
-                 }
-             }
-         }
-         else
-         {
-                 /* look for an outlet */
-             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)
-                     {
-                         int issignal = obj_issignaloutlet(ob, closest);
-                         x->gl_editor->e_onmotion = MA_CONNECT;
-                         x->gl_editor->e_xwas = xpos;
-                         x->gl_editor->e_ywas = ypos;
-                         sys_vgui(
-                           ".x%lx.c create line %d %d %d %d -width %d -tags x\n",
-                                 (long)x, xpos, ypos, xpos, ypos,
-                                     (issignal ? 2 : 1));
-                     }                                   
-                     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)
- 			{
- 				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 = x->gl_editor->e_textedfor) &&
!                     rt == glist_findrtext(x, ob))
!                 {
!                     rtext_mouse(rt, xpos - x1, ypos - y1,
!                         (doublemod ? RTEXT_DBL : RTEXT_DOWN));
!                     x->gl_editor->e_onmotion = MA_DRAGTEXT;
!                     x->gl_editor->e_xwas = x1;
!                     x->gl_editor->e_ywas = y1;
!                 }
!                 else
!                 {
!                         /* otherwise select and drag to displace */
!                     if (!glist_isselected(x, y))
!                     {
!                         glist_noselect(x);
!                         glist_select(x, y);
!                     }
!                     x->gl_editor->e_onmotion = MA_MOVE;
!                 }
!             }
!             else canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); 
!         }
!         return;
!     }
!         /* if right click doesn't hit any boxes, call rightclick
!             routine anyway */
!     if (rightclick)
!         canvas_rightclick(x, xpos, ypos, 0);
  
!         /* if not an editing action, and if we didn't hit a
!         box, set cursor and return */
!     if (runmode || rightclick)
!     {
!         canvas_setcursor(x, CURSOR_RUNMODE_NOTHING);
!         return;
!     }
!         /* having failed to find a box, we try lines now. */
!     if (!runmode && !altmod && !shiftmod)
!     {/* was trying to select wire here*/}
!     canvas_setcursor(x, CURSOR_EDITMODE_NOTHING);
!     if (doit)
!     {
!         if (!shiftmod) glist_noselect(x);
!         sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags x\n",
!               (long)x, xpos, ypos, xpos, ypos);
!         x->gl_editor->e_xwas = xpos;
!         x->gl_editor->e_ywas = ypos;
!         x->gl_editor->e_onmotion = MA_REGION;
!     }
! }
  
- void canvas_mousedown(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
-     t_floatarg which, t_floatarg mod)
- {
-     canvas_doclick(x, xpos, ypos, which, mod, 1);
- }
  
  int canvas_isconnected (t_canvas *x, t_text *ob1, int n1,
--- 2468,2482 ----
  #define DCLICKINTERVAL 0.25
  
! /* canvas_doclick was here */
  
                  /* check if the object wants to be clicked */
  
! /*                canvas_setcursor(x, clickreturned);
!             else canvas_setcursor(x, CURSOR_RUNMODE_NOTHING);
! */
  
!         /* if not a runmode left click, fall here. */
! /*    y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2);*/
  
  
  int canvas_isconnected (t_canvas *x, t_text *ob1, int n1,
***************
*** 2990,3040 ****
  }
  
- void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos,
-     t_floatarg fmod)
- { 
-     /* post("motion %d %d", xpos, ypos); */
-     int mod = fmod;
-     if (!x->gl_editor)
-     {
-         bug("editor");
-         return;
-     }
- 
- 	sys_vgui(".x%lx.c delete y\n",(long)x); /* GG: bad hack */
- 	
-     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)
-             bug("e_motionfn");
-         (*x->gl_editor->e_motionfn)(&x->gl_editor->e_grab->g_pd,
-             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_DRAGTEXT)
-     {
-         t_rtext *rt = x->gl_editor->e_textedfor;
-         if (rt)
-             rtext_mouse(rt, xpos - x->gl_editor->e_xwas,
-                 ypos - x->gl_editor->e_ywas, RTEXT_DRAG);
-     }
-     else canvas_doclick(x, xpos, ypos, 0, mod, 0);
-     
-     x->gl_editor->e_lastmoved = 1;
- }
- 
  void canvas_startmotion(t_canvas *x)
  {
--- 2793,2796 ----
***************
*** 11589,11593 ****
  	t_text *o;
  	if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {error("gargamel was here"); return;}
! 	glist_delete(x,o);
  	gobj_changed(x,0);
  }
--- 11345,11349 ----
  	t_text *o;
  	if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {error("gargamel was here"); return;}
! 	glist_delete(x,(t_gobj *)o);
  	gobj_changed(x,0);
  }
***************
*** 12884,12896 ****
      class_addcreator((t_newmethod)subcanvas_new,gensym("pd"), A_DEFSYMBOL, 0);
      class_addcreator((t_newmethod)subcanvas_new, gensym("page"),  A_DEFSYMBOL, 0);
- //  class_addmethod3(c,canvas_click,"click","fffff");
      class_addmethod3(c,canvas_dsp,"dsp","");
      class_addmethod3(c,canvas_rename_method,"rename","*");
      class_addcreator((t_newmethod)table_new, gensym("table"), A_DEFSYM, A_DEFFLOAT, 0);
  
- //  class_addmethod3(c,canvas_mousedown,"mouse","ffff");
- //  class_addmethod3(c,canvas_mouseup,"mouseup","fff");
      class_addmethod3(c,canvas_key,"key","*");
-     class_addmethod3(c,canvas_motion,"motion","fff");
      class_addmethod3(c,canvas_menuclose,"menuclose","F");
  
--- 12640,12648 ----
***************
*** 12907,12910 ****
--- 12659,12669 ----
  /* end die */
  
+ /* <dead>
+   class_addmethod3(c,canvas_click,    "click",  "fffff");
+   class_addmethod3(c,canvas_motion,   "motion", "fff");
+   class_addmethod3(c,canvas_mousedown,"mouse",  "ffff");
+   class_addmethod3(c,canvas_mouseup,  "mouseup","fff");
+ </dead> */
+ 
      class_addmethod3(c,canvas_editmode, "editmode","F");
  





More information about the Pd-cvs mailing list