[PD-cvs] externals/hcs cursor.c,1.3,1.4 cursor-help.pd,1.2,1.3

Hans-Christoph Steiner eighthave at users.sourceforge.net
Wed Oct 31 20:54:43 CET 2007


Update of /cvsroot/pure-data/externals/hcs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13172

Modified Files:
	cursor.c cursor-help.pd 
Log Message:
added bang method and made button and wheel events always be reported, not only when polling

Index: cursor-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/cursor-help.pd,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** cursor-help.pd	31 Oct 2007 07:12:11 -0000	1.2
--- cursor-help.pd	31 Oct 2007 19:54:41 -0000	1.3
***************
*** 1,6 ****
! #N canvas 446 305 462 312 10;
! #X obj 105 271 print LEFT;
! #X obj 226 265 print RIGHT;
! #X obj 151 96 symbol;
  #X msg 149 61 boat;
  #X msg 109 61 clock;
--- 1,4 ----
! #N canvas 284 234 514 531 10;
! #X obj 151 126 symbol;
  #X msg 149 61 boat;
  #X msg 109 61 clock;
***************
*** 14,39 ****
  #X msg 366 151 pencil;
  #X msg 184 61 coffee_mug;
! #X msg 151 121 cursor \$1;
! #X obj 49 230 pddp/print;
! #X obj 186 205 pddp/print;
! #X obj 55 132 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0
  1;
! #X obj 124 174 cursor;
! #X connect 2 0 14 0;
! #X connect 3 0 2 0;
! #X connect 4 0 2 0;
! #X connect 5 0 2 0;
! #X connect 6 0 2 0;
! #X connect 7 0 2 0;
! #X connect 8 0 2 0;
! #X connect 9 0 2 0;
! #X connect 10 0 2 0;
! #X connect 11 0 2 0;
! #X connect 12 0 2 0;
! #X connect 13 0 2 0;
! #X connect 14 0 18 0;
! #X connect 17 0 18 0;
! #X connect 18 0 0 0;
! #X connect 18 0 15 0;
! #X connect 18 1 1 0;
! #X connect 18 1 16 0;
--- 12,45 ----
  #X msg 366 151 pencil;
  #X msg 184 61 coffee_mug;
! #X msg 151 151 cursor \$1;
! #X obj 51 334 pddp/print;
! #X obj 188 309 pddp/print;
! #X obj 147 250 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0
  1;
! #X obj 126 278 cursor;
! #X msg 45 218 bang;
! #X obj 46 160 key;
! #X obj 45 185 select 32;
! #X text 163 247 poll the mouse pointer position;
! #X text 80 219 get the current mouse position;
! #X obj 111 367 print CURSOR;
! #X connect 0 0 12 0;
! #X connect 1 0 0 0;
! #X connect 2 0 0 0;
! #X connect 3 0 0 0;
! #X connect 4 0 0 0;
! #X connect 5 0 0 0;
! #X connect 6 0 0 0;
! #X connect 7 0 0 0;
! #X connect 8 0 0 0;
! #X connect 9 0 0 0;
! #X connect 10 0 0 0;
! #X connect 11 0 0 0;
! #X connect 12 0 16 0;
! #X connect 15 0 16 0;
! #X connect 16 0 13 0;
! #X connect 16 0 22 0;
! #X connect 16 1 14 0;
! #X connect 17 0 16 0;
! #X connect 18 0 19 0;
! #X connect 19 0 17 0;

Index: cursor.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/cursor.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** cursor.c	31 Oct 2007 07:12:11 -0000	1.3
--- cursor.c	31 Oct 2007 19:54:41 -0000	1.4
***************
*** 23,41 ****
  } t_cursor;
  
  static void cursor_float(t_cursor *x, t_float f)
  {
      if(f > 0)
      {
-         sys_vgui("bind all <ButtonPress> {+pd [concat %s button %%b 1 \\;]}\n",
-             x->receive_symbol->s_name);
-         sys_vgui("bind all <ButtonRelease> {+pd [concat %s button %%b 0 \\;]}\n",
-             x->receive_symbol->s_name);
          sys_vgui("bind all <Motion> {+pd [concat %s motion %%x %%y \\;]}\n",
              x->receive_symbol->s_name);
-         sys_vgui("bind all <MouseWheel> {+pd [concat %s wheel %%D \\;]}\n",
-             x->receive_symbol->s_name);
      }
      else
      {
      }
  }
--- 23,43 ----
  } t_cursor;
  
+ 
+ static void cursor_bang(t_cursor *x)
+ {
+     sys_vgui("pd [concat %s motion [winfo pointerx .] [winfo pointery .] \\;]\n",
+              x->receive_symbol->s_name);
+ }
+ 
  static void cursor_float(t_cursor *x, t_float f)
  {
      if(f > 0)
      {
          sys_vgui("bind all <Motion> {+pd [concat %s motion %%x %%y \\;]}\n",
              x->receive_symbol->s_name);
      }
      else
      {
+         /* TODO figure out how to turn off this binding */
      }
  }
***************
*** 95,98 ****
--- 97,107 ----
  	x->status_outlet = outlet_new(&x->x_obj, 0);
  
+     sys_vgui("bind all <ButtonPress> {+pd [concat %s button %%b 1 \\;]}\n",
+              x->receive_symbol->s_name);
+     sys_vgui("bind all <ButtonRelease> {+pd [concat %s button %%b 0 \\;]}\n",
+              x->receive_symbol->s_name);
+     sys_vgui("bind all <MouseWheel> {+pd [concat %s wheel %%D \\;]}\n",
+              x->receive_symbol->s_name);
+ 
      return(x);
  }
***************
*** 104,120 ****
          sizeof(t_cursor), 0, 0);
  
      class_addfloat(cursor_class, (t_method)cursor_float);
  
      class_addmethod(cursor_class, (t_method)cursor_cursor, 
                      gensym("cursor"), A_DEFSYMBOL, 0);
      class_addmethod(cursor_class, (t_method)cursor_button_callback, 
!                     gensym("button"), A_DEFFLOAT, A_DEFFLOAT, 0);
      class_addmethod(cursor_class, (t_method)cursor_motion_callback, 
!                     gensym("motion"), A_DEFFLOAT, A_DEFFLOAT, 0);
      class_addmethod(cursor_class, (t_method)cursor_wheel_callback, 
!                     gensym("wheel"), A_DEFFLOAT, 0);
! 
!     button_symbol = gensym("button");
!     motion_symbol = gensym("motion");
!     wheel_symbol = gensym("wheel");
  }
--- 113,130 ----
          sizeof(t_cursor), 0, 0);
  
+     class_addbang(cursor_class, (t_method)cursor_bang);
      class_addfloat(cursor_class, (t_method)cursor_float);
  
+     button_symbol = gensym("button");
+     motion_symbol = gensym("motion");
+     wheel_symbol = gensym("wheel");
+ 
      class_addmethod(cursor_class, (t_method)cursor_cursor, 
                      gensym("cursor"), A_DEFSYMBOL, 0);
      class_addmethod(cursor_class, (t_method)cursor_button_callback, 
!                     button_symbol, A_DEFFLOAT, A_DEFFLOAT, 0);
      class_addmethod(cursor_class, (t_method)cursor_motion_callback, 
!                     motion_symbol, A_DEFFLOAT, A_DEFFLOAT, 0);
      class_addmethod(cursor_class, (t_method)cursor_wheel_callback, 
!                     wheel_symbol, A_DEFFLOAT, 0);
  }





More information about the Pd-cvs mailing list