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

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Nov 6 03:30:55 CET 2007


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

Modified Files:
	cursor.c cursor-help.pd 
Log Message:

- updated to work with set_cursors_in_tcl-0.41-test06.patch (patch #1826507),
 now you can actually set the cursors and have them stick throughout Pd


Index: cursor-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/cursor-help.pd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** cursor-help.pd	31 Oct 2007 19:54:41 -0000	1.3
--- cursor-help.pd	6 Nov 2007 02:30:53 -0000	1.4
***************
*** 1,45 ****
! #N canvas 284 234 514 531 10;
! #X obj 151 126 symbol;
! #X msg 149 61 boat;
! #X msg 109 61 clock;
! #X msg 245 61 dot;
! #X msg 275 61 dotbox;
! #X msg 322 61 gumby;
! #X msg 365 61 gobbler;
! #X msg 366 130 pirate;
! #X msg 366 87 mouse;
! #X msg 366 109 target;
! #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;
--- 1,72 ----
! #N canvas 309 199 638 505 10;
! #X obj 136 401 pddp/print;
! #X obj 95 342 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0
  1;
! #X obj 74 370 cursor;
! #X msg 70 318 bang;
! #X text 111 339 poll the mouse pointer position;
! #X text 101 318 get the current mouse position;
! #X obj 163 26 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm
! ;
! #X text 48 9 Here's a complete list of the available cursors:;
! #X msg 169 229 runmode_clickme dot;
! #X msg 322 151 boat;
! #X msg 282 151 clock;
! #X msg 428 151 dot;
! #X msg 505 151 gumby;
! #X msg 548 151 gobbler;
! #X msg 357 151 coffee_mug;
! #X msg 458 151 pirate;
! #X msg 42 44 runmode_nothing;
! #N canvas 0 22 454 304 make 0;
! #X obj 95 9 inlet;
! #X obj 114 258 outlet;
! #X obj 116 168 pack symbol symbol;
! #X obj 221 147 symbol;
! #X obj 94 51 symbol;
! #X obj 329 19 inlet;
! #X obj 126 111 trigger bang anything;
! #X msg 116 192 set \$1 \$2;
! #X obj 115 220 trigger bang anything;
! #X connect 0 0 4 0;
! #X connect 2 0 7 0;
! #X connect 3 0 2 1;
! #X connect 4 0 2 0;
! #X connect 5 0 6 0;
! #X connect 6 0 2 0;
! #X connect 6 1 3 0;
! #X connect 7 0 8 0;
! #X connect 8 0 1 0;
! #X connect 8 1 1 0;
! #X restore 169 205 pd make message;
! #X msg 59 63 runmode_clickme;
! #X msg 75 82 runmode_thicken;
! #X msg 92 101 runmode_addpoint;
! #X obj 67 440 pddp/print;
! #X msg 110 120 editmode_nothing;
! #X msg 126 139 runmode_connect;
! #X msg 143 158 runmode_disconnect;
! #X text 201 81 <-- choose your cursor mode;
! #X text 312 128 now pick a cursor:;
! #X obj 169 266 cursor;
! #X text 295 229 <-- this is the actual message to send;
! #X connect 1 0 2 0;
! #X connect 2 0 21 0;
! #X connect 2 1 0 0;
! #X connect 3 0 2 0;
! #X connect 8 0 27 0;
! #X connect 9 0 17 1;
! #X connect 10 0 17 1;
! #X connect 11 0 17 1;
! #X connect 12 0 17 1;
! #X connect 13 0 17 1;
! #X connect 14 0 17 1;
! #X connect 15 0 17 1;
! #X connect 16 0 17 0;
! #X connect 17 0 8 0;
! #X connect 18 0 17 0;
  #X connect 19 0 17 0;
+ #X connect 20 0 17 0;
+ #X connect 22 0 17 0;
+ #X connect 23 0 17 0;
+ #X connect 24 0 17 0;

Index: cursor.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/cursor.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** cursor.c	31 Oct 2007 19:54:41 -0000	1.4
--- cursor.c	6 Nov 2007 02:30:53 -0000	1.5
***************
*** 15,19 ****
      t_object x_obj;
      t_symbol *receive_symbol;
-     t_symbol *current_cursor;
      t_canvas *parent_canvas;
      t_outlet *data_outlet;
--- 15,18 ----
***************
*** 24,27 ****
--- 23,32 ----
  
  
+ static void cursor_setmethod(t_cursor *x, t_symbol *s, int argc, t_atom *argv)
+ {
+     sys_vgui("set cursor_%s \"%s\"\n", s->s_name, atom_getsymbol(argv)->s_name);
+     canvas_setcursor(x->parent_canvas, 0); /* hack to refresh the cursor */
+ }
+ 
  static void cursor_bang(t_cursor *x)
  {
***************
*** 43,56 ****
  }
  
- static void cursor_cursor(t_cursor *x, t_symbol *s)
- {
-     post("setting cursor: %s", s->s_name);
-     x->current_cursor = s;
-     post("set parent%lx [winfo parent .x%lx.c]; $parent%lx configure -cursor %s \n",
-              x, x->parent_canvas, x, s->s_name);
-     sys_vgui("set parent%lx [winfo parent .x%lx.c]; $parent%lx configure -cursor %s \n",
-              x, x->parent_canvas, x, s->s_name);
- }
- 
  static void cursor_button_callback(t_cursor *x, t_float button, t_float state)
  {
--- 48,51 ----
***************
*** 82,88 ****
  {
      pd_unbind(&x->x_obj.ob_pd, x->receive_symbol);
  }
  
! static void *cursor_new(t_symbol *s, int argc, t_atom *argv)
  {
      char buf[MAXPDSTRING];
--- 77,84 ----
  {
      pd_unbind(&x->x_obj.ob_pd, x->receive_symbol);
+     //TODO free the "bind all"
  }
  
! static void *cursor_new(t_symbol *s)
  {
      char buf[MAXPDSTRING];
***************
*** 120,125 ****
      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);
--- 116,119 ----
***************
*** 128,130 ****
--- 122,140 ----
      class_addmethod(cursor_class, (t_method)cursor_wheel_callback, 
                      wheel_symbol, A_DEFFLOAT, 0);
+ 
+     /* methods for setting the cursor icon */
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("runmode_nothing"), A_GIMME, 0);
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("runmode_clickme"), A_GIMME, 0);
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("runmode_thicken"), A_GIMME, 0);
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("runmode_addpoint"), A_GIMME, 0);
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("editmode_nothing"), A_GIMME, 0);
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("editmode_connect"), A_GIMME, 0);
+     class_addmethod(cursor_class, (t_method)cursor_setmethod, 
+                     gensym("editmode_disconnect"), A_GIMME, 0);
  }





More information about the Pd-cvs mailing list