Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13673
Modified Files: Tag: desiredata builtins.c desire.tk Log Message: more on the macro object
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.327 retrieving revision 1.1.2.600.2.328 diff -C2 -d -r1.1.2.600.2.327 -r1.1.2.600.2.328 *** desire.tk 9 Aug 2007 00:48:34 -0000 1.1.2.600.2.327 --- desire.tk 9 Aug 2007 02:07:52 -0000 1.1.2.600.2.328 *************** *** 4985,4994 **** }
! def Canvas macro_event_append {e} { ! if {![llength $@macro_q]} {after $@macro_delay [list $self macro_schedule $@macro_delay]} lappend @macro_q $e }
! def Canvas macro_schedule {delay} { if {[llength $@macro_q]} { set w [focus] --- 4985,4994 ---- }
! def Canvas macro_event_append {e obj} { ! if {![llength $@macro_q]} {after $@macro_delay [list $self macro_schedule $@macro_delay] $obj} lappend @macro_q $e }
! def Canvas macro_schedule {delay obj} { if {[llength $@macro_q]} { set w [focus] *************** *** 5001,5004 **** --- 5001,5010 ---- ButtonRelease {set name $event-$k; set fudge_motion 1} Motion {set name $event} + bang { + after $delay [list $self macro_schedule $@macro_delay] $obj + netsend [list .$obj mbang] + set @macro_q [lreplace $@macro_q 0 0] + return + } default {puts "Error: this event should not have been here.."} } *************** *** 5007,5011 **** if {$event=="KeyPress"} {event generate $w <KeyRelease-$k> -x $x -y $y} set @macro_q [lreplace $@macro_q 0 0] ! after $delay [list $self macro_schedule $@macro_delay] } } --- 5013,5017 ---- if {$event=="KeyPress"} {event generate $w <KeyRelease-$k> -x $x -y $y} set @macro_q [lreplace $@macro_q 0 0] ! after $delay [list $self macro_schedule $@macro_delay] $obj } }
Index: builtins.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v retrieving revision 1.1.2.55 retrieving revision 1.1.2.56 diff -C2 -d -r1.1.2.55 -r1.1.2.56 *** builtins.c 8 Aug 2007 18:40:43 -0000 1.1.2.55 --- builtins.c 9 Aug 2007 02:07:52 -0000 1.1.2.56 *************** *** 987,990 **** --- 987,991 ---- struct t_macro : t_object { t_symbol *sym; + t_outlet *bangout; };
*************** *** 993,1008 **** if (*s->name) x->sym = s; else x->sym = gensym("macro"); return x; }
static void macro_send(t_macro *x, t_symbol *s, int argc, t_atom *argv) { std::ostringstream t; t << s->name; for (int i=0; i<argc; i++) {t << " " << &argv[i];} ! sys_mgui(x->dix->canvas, "macro_event_append", "S", t.str().data()); } static void macro_setup() { t_class *c = macro_class = class_new2("macro",macro_new,0,sizeof(t_macro),0,"S"); class_addanything(c, macro_send); }
--- 994,1013 ---- if (*s->name) x->sym = s; else x->sym = gensym("macro"); + x-> bangout = outlet_new(x, &s_bang); return x; }
+ static void macro_bang(t_macro *x) {outlet_bang(x->bangout);} + static void macro_send(t_macro *x, t_symbol *s, int argc, t_atom *argv) { std::ostringstream t; t << s->name; for (int i=0; i<argc; i++) {t << " " << &argv[i];} ! sys_mgui(x->dix->canvas, "macro_event_append", "Sp", t.str().data(), x); } static void macro_setup() { t_class *c = macro_class = class_new2("macro",macro_new,0,sizeof(t_macro),0,"S"); class_addanything(c, macro_send); + class_addmethod2(c, macro_bang, "mbang",""); }