Revision: 10172 http://pure-data.svn.sourceforge.net/pure-data/?rev=10172&view=rev Author: eighthave Date: 2008-07-18 18:14:53 +0000 (Fri, 18 Jul 2008)
Log Message: ----------- stripped down cursor to what is working, to prevent lots of errors in the Pd window; fixed up help patch to use a metro to get mouse motion, and replaced typos in the names of the cursors
Modified Paths: -------------- branches/pd-extended/v0-40/externals/hcs/cursor-help.pd branches/pd-extended/v0-40/externals/hcs/cursor.c
Modified: branches/pd-extended/v0-40/externals/hcs/cursor-help.pd =================================================================== --- branches/pd-extended/v0-40/externals/hcs/cursor-help.pd 2008-07-17 21:45:38 UTC (rev 10171) +++ branches/pd-extended/v0-40/externals/hcs/cursor-help.pd 2008-07-18 18:14:53 UTC (rev 10172) @@ -1,19 +1,17 @@ -#N canvas 738 245 642 509 10; -#X obj 136 401 pddp/print; +#N canvas 119 64 638 465 10; #X obj 74 370 cursor; -#X msg 70 318 bang; -#X text 101 318 get the current mouse position; -#X obj 346 278 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm +#X msg 74 335 bang; +#X text 105 335 get the current mouse position; +#X obj 338 383 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm ; -#X text 231 261 Here's a complete list of the available cursors:; -#X msg 169 229 runmode_disconnect gumby; -#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 text 223 366 Here's a complete list of the available cursors:; +#X msg 335 124 boat; +#X msg 295 124 clock; +#X msg 441 124 dot; +#X msg 518 124 gumby; +#X msg 561 124 gobbler; +#X msg 370 124 coffee_mug; +#X msg 471 124 pirate; #X msg 42 44 runmode_nothing; #N canvas 0 22 462 312 make 0; #X obj 95 9 inlet; @@ -21,57 +19,54 @@ #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 obj 227 16 inlet; #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 2 0 6 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 connect 5 0 3 0; +#X connect 6 0 7 0; +#X connect 7 0 1 0; +#X connect 7 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 obj 74 399 pddp/print; #X msg 110 120 editmode_nothing; -#X msg 126 139 runmode_connect; -#X msg 143 158 runmode_disconnect; -#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 obj 25 244 metro 100; -#X obj 25 218 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 +#X obj 169 286 cursor; +#X text 342 258 <-- this is the actual message to send; +#X obj 56 308 metro 100; +#X obj 56 286 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X text 15 18 set your mouse cursors for this patch:; -#X text 201 81 <-- choose your cursor mode; -#X text 237 293 Here are some pictures of the cursors:; -#X obj 345 309 pddp/pddplink http://www.lehigh.edu/~sol0/ptk/cursors.gif +#X text 229 398 Here are some pictures of the cursors:; +#X obj 337 414 pddp/pddplink http://www.lehigh.edu/~sol0/ptk/cursors.gif ; -#X connect 1 0 19 0; -#X connect 1 1 0 0; -#X connect 2 0 1 0; -#X connect 6 0 24 0; -#X connect 7 0 15 1; -#X connect 8 0 15 1; -#X connect 9 0 15 1; -#X connect 10 0 15 1; -#X connect 11 0 15 1; -#X connect 12 0 15 1; -#X connect 13 0 15 1; -#X connect 14 0 15 0; -#X connect 15 0 6 0; -#X connect 16 0 15 0; -#X connect 17 0 15 0; -#X connect 18 0 15 0; -#X connect 20 0 15 0; -#X connect 21 0 15 0; -#X connect 22 0 15 0; -#X connect 26 0 1 0; -#X connect 27 0 26 0; +#X msg 126 139 editmode_connect; +#X msg 143 158 editmode_disconnect; +#X msg 169 259 editmode_disconnect pirate; +#X text 290 55 first pick a cursor:; +#X text 189 80 <-- then choose your cursor mode; +#X connect 0 0 17 0; +#X connect 1 0 0 0; +#X connect 5 0 13 1; +#X connect 6 0 13 1; +#X connect 7 0 13 1; +#X connect 8 0 13 1; +#X connect 9 0 13 1; +#X connect 10 0 13 1; +#X connect 11 0 13 1; +#X connect 12 0 13 0; +#X connect 13 0 28 0; +#X connect 14 0 13 0; +#X connect 15 0 13 0; +#X connect 16 0 13 0; +#X connect 18 0 13 0; +#X connect 21 0 0 0; +#X connect 22 0 21 0; +#X connect 26 0 13 0; +#X connect 27 0 13 0; +#X connect 28 0 19 0;
Modified: branches/pd-extended/v0-40/externals/hcs/cursor.c =================================================================== --- branches/pd-extended/v0-40/externals/hcs/cursor.c 2008-07-17 21:45:38 UTC (rev 10171) +++ branches/pd-extended/v0-40/externals/hcs/cursor.c 2008-07-18 18:14:53 UTC (rev 10172) @@ -8,6 +8,13 @@ static t_symbol *motion_symbol; static t_symbol *wheel_symbol;
+//TODO add reset method for cursor icons, this should probably be done in pd.tk + +// TODO figure out some way to get +//t_int hidio_instance_count; +/* this is used to test for the first instance to execute */ +//double last_execute_time; + static t_class *cursor_class;
typedef struct _cursor @@ -16,12 +23,23 @@ t_symbol *receive_symbol; t_canvas *parent_canvas; t_outlet *data_outlet; - t_outlet *status_outlet; +// t_outlet *status_outlet; // not used (yet?) t_int optionc; char *optionv[]; } t_cursor;
+/* idea from #tcl for a Tcl unbind +proc unbind {tag event script} { + set bind "" + foreach x [split [bind $tag $event] "\n"] { + if {$x != $script} {lappend bind $x} + } + bind $tag $event {} + foreach x $bind {bind $tag $event $x} + } +*/ + 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); @@ -34,6 +52,9 @@ x->receive_symbol->s_name); }
+/* TODO this needs some kind of working unbind to be useful, otherwise when an + * instance is deleted, you get reams of "error: #123123 no such object" + * messages in the Pd Window. static void cursor_float(t_cursor *x, t_float f) { if(f > 0) @@ -43,9 +64,12 @@ } else { - /* TODO figure out how to turn off this binding */ + // TODO figure out how to turn off this binding + sys_vgui("bind all <Motion> {+pd [concat %s motion %%x %%y \;]}\n", + x->receive_symbol->s_name); } } +*/
static void cursor_button_callback(t_cursor *x, t_float button, t_float state) { @@ -90,14 +114,16 @@ x->receive_symbol = gensym(buf); pd_bind(&x->x_obj.ob_pd, x->receive_symbol); x->data_outlet = outlet_new(&x->x_obj, 0); - x->status_outlet = outlet_new(&x->x_obj, 0); +// x->status_outlet = outlet_new(&x->x_obj, 0);
+/* not working yet sys_vgui("bind . <ButtonPress> {+pd [concat %s button %%b 1 \;]}\n", x->receive_symbol->s_name); sys_vgui("bind . <ButtonRelease> {+pd [concat %s button %%b 0 \;]}\n", x->receive_symbol->s_name); sys_vgui("bind . <MouseWheel> {+pd [concat %s wheel %%D \;]}\n", x->receive_symbol->s_name); +*/
return(x); } @@ -109,7 +135,7 @@ sizeof(t_cursor), 0, 0);
class_addbang(cursor_class, (t_method)cursor_bang); - class_addfloat(cursor_class, (t_method)cursor_float); +/* class_addfloat(cursor_class, (t_method)cursor_float); */
button_symbol = gensym("button"); motion_symbol = gensym("motion");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.