Update of /cvsroot/pure-data/externals/ffext/tracker In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30768
Modified Files: makefile tracker.c tracker.h tracker.tk Log Message: added send/receive support, makefile for pd_darwin
Index: tracker.tk =================================================================== RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker.tk,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tracker.tk 21 Sep 2007 21:42:17 -0000 1.2 --- tracker.tk 22 Sep 2007 23:54:13 -0000 1.3 *************** *** 9,12 **** --- 9,16 ---- set var_saveflag [concat saveflag_$vid] global $var_saveflag + set var_sym_send [concat sym_send_$vid] + global $var_sym_send + set var_sym_recv [concat sym_recv_$vid] + global $var_sym_recv
set cmd [concat $id resize \ *************** *** 20,23 **** --- 24,33 ---- ;] pd $cmd + + set ss [string trim [set $var_sym_send]] + if {$ss != {}} {pd [concat $id set_send $ss ;]} + + set rs [string trim [set $var_sym_recv]] + if {$rs != {}} {pd [concat $id set_recv $rs ;]} }
*************** *** 33,37 **** }
! proc pdtk_tracker_dialog {id width height saveflag} { set vid [string trimleft $id .]
--- 43,47 ---- }
! proc pdtk_tracker_dialog {id width height saveflag ss rs} { set vid [string trimleft $id .]
*************** *** 42,49 **** --- 52,65 ---- set var_saveflag [concat saveflag_$vid] global $var_saveflag + set var_sym_send [concat sym_send_$vid] + global $var_sym_send + set var_sym_recv [concat sym_recv_$vid] + global $var_sym_recv
set $var_graph_width $width set $var_graph_height $height set $var_saveflag $saveflag + set $var_sym_recv $rs + set $var_sym_send $ss
toplevel $id *************** *** 86,91 **** --- 102,121 ---- pack $id.3rangef.lsaveflag $id.3rangef.saveflag -side left
+ frame $id.4rangef + pack $id.4rangef -side top + label $id.4rangef.lwidth -text "Send symbol :" + entry $id.4rangef.ss -textvar $var_sym_send -width 10 + pack $id.4rangef.lwidth $id.4rangef.ss -side left + + frame $id.5rangef + pack $id.5rangef -side top + label $id.5rangef.lwidth -text "Receive symbol :" + entry $id.5rangef.rs -textvar $var_sym_recv -width 10 + pack $id.5rangef.lwidth $id.5rangef.rs -side left + bind $id.1rangef.width <KeyPress-Return> [concat tracker_ok $id] bind $id.2rangef.height <KeyPress-Return> [concat tracker_ok $id] + bind $id.4rangef.ss <KeyPress-Return> [concat tracker_ok $id] + bind $id.5rangef.rs <KeyPress-Return> [concat tracker_ok $id] focus $id.1rangef.width }
Index: makefile =================================================================== RCS file: /cvsroot/pure-data/externals/ffext/tracker/makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** makefile 22 Sep 2007 10:13:46 -0000 1.2 --- makefile 22 Sep 2007 23:54:13 -0000 1.3 *************** *** 1,18 **** ! all: tracker.pd_linux ! tracker.pd_linux: tracker.c tracker.h tracker.tk2c
STRIP = strip ! CFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \ -Wall -W -Wno-shadow -Wstrict-prototypes \ ! -Wno-unused -Wno-parentheses -Wno-switch \ ! -I/usr/include -I../pd/src
! .SUFFIXES: .pd_linux .tk .tk2c
.tk.tk2c: ./tk2c.bash < $*.tk > $*.tk2c ! .c.pd_linux: ! $(CC) $(CFLAGS) -o $*.o -c $*.c ! $(LD) -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm $(STRIP) --strip-unneeded $*.pd_linux clean: --- 1,36 ---- ! all: pd_linux ! ! SUFFIX=pd_linux ! #SUFFIX=pd_darwin ! ! $(SUFFIX): tracker.$(SUFFIX) ! tracker.$(SUFFIX): tracker.c tracker.h tracker.tk2c ! ! pd_darwin: tracker.pd_darwin ! tracker.pd_: tracker.c tracker.h tracker.tk2c
STRIP = strip ! CFLAGS = -DPD -O2 \ -Wall -W -Wno-shadow -Wstrict-prototypes \ ! -Wno-unused -Wno-parentheses -Wno-switch ! INCLUDE = -I/usr/include -I../pd/src ! LDFLAGS =
! ifeq ($(SUFFIX),pd_linux) ! CFLAGS += -DUNIX -funroll-loops -fomit-frame-pointer ! LDFLAGS += -export_dynamic -shared -lc -lm ! endif ! ifeq ($(SUFFIX),pd_darwin) ! LDFLAGS += -bundle -undefined suppress -flat_namespace ! STRIP = false ! endif ! ! .SUFFIXES: .$(SUFFIX) .tk .tk2c
.tk.tk2c: ./tk2c.bash < $*.tk > $*.tk2c ! .c.$(SUFFIX): ! $(CC) $(CFLAGS) $(INCLUDE) -o $*.o -c $*.c ! $(LD) $(LDFLAGS) -o $*.pd_linux $*.o $(STRIP) --strip-unneeded $*.pd_linux clean:
Index: tracker.h =================================================================== RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tracker.h 21 Sep 2007 21:42:17 -0000 1.2 --- tracker.h 22 Sep 2007 23:54:13 -0000 1.3 *************** *** 35,38 **** --- 35,40 ---- t_float** x_data; // data (2d matrix) t_outlet* outlet0; // outlet + t_symbol* s_send; + t_symbol* s_recv; } t_tracker;
Index: tracker.c =================================================================== RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tracker.c 21 Sep 2007 21:42:17 -0000 1.2 --- tracker.c 22 Sep 2007 23:54:13 -0000 1.3 *************** *** 177,180 **** --- 177,185 ---- }
+ if(*x->s_send->s_name) + binbuf_addv(b, "ss", gensym("-send"), x->s_send); + + if(*x->s_recv->s_name) + binbuf_addv(b, "ss", gensym("-recv"), x->s_recv);
binbuf_addv(b, ";"); *************** *** 185,191 **** t_tracker* x = (t_tracker*)z;
! sprintf(buf, "pdtk_tracker_dialog %%s %d %d %d\n", (int)x->x_columns, (int)x->x_rows, ! (int)x->b_save_data ); //post("buf=%s", buf); --- 190,197 ---- t_tracker* x = (t_tracker*)z;
! sprintf(buf, "pdtk_tracker_dialog %%s %d %d %d {%s} {%s}\n", (int)x->x_columns, (int)x->x_rows, ! (int)x->b_save_data, ! x->s_send->s_name, x->s_recv->s_name ); //post("buf=%s", buf); *************** *** 193,220 **** }
- /*static void tracker_dialog(t_tracker* x, t_symbol* s, int argc, t_atom* argv) { - t_canvas* canvas = glist_getcanvas(x->x_glist); - int ei; - if(!x) { - post("tracker: error: trying to set properties on an unexisting object"); - return; - } - if(argc != 2) { - post("tracker: error in number of arguments (%d)", argc); - return; - } - if(argv[0].a_type != A_FLOAT || argv[1].a_type != A_FLOAT) { - post("tracker: error in format of arguments"); - return; - } - - tracker_draw_erase(x, x->x_glist); - - tracker_resize(x, (int)argv[1].a_w.w_float, (int)argv[0].a_w.w_float); - - tracker_draw_new(x, x->x_glist); - canvas_fixlinesfor(canvas, (t_text*)x); - }*/ - static void tracker_select(t_gobj* z, t_glist* glist, int selected) { t_tracker* x = (t_tracker*)z; --- 199,202 ---- *************** *** 420,424 **** } freebytes(x->x_data, x->x_rows*sizeof(t_float)); ! //pd_unbind(&x->x_obj.ob_pd, keyname_sym); }
--- 402,422 ---- } freebytes(x->x_data, x->x_rows*sizeof(t_float)); ! } ! ! static void tracker_set_saveflag(t_tracker* x, t_floatarg b) { ! x->b_save_data = (int)(b == 0 ? 0 : 1); ! } ! ! static void tracker_set_send(t_tracker* x, t_symbol *s) { ! x->s_send = s; ! } ! ! static void tracker_set_recv(t_tracker* x, t_symbol *s) { ! if(x->s_recv != gensym("")) ! pd_unbind(&x->x_obj.ob_pd, x->s_recv); ! ! x->s_recv = s; ! ! pd_bind(&x->x_obj.ob_pd, s); }
*************** *** 447,450 **** --- 445,451 ---- x->b_save_data = 0;
+ x->s_send = gensym(""); + x->s_recv = gensym(""); + int cols = 0, rows = 0; int got_data = 0; *************** *** 456,463 **** x->b_save_data = 1; } else { - //if(argc <= 2) { - // post("tracker: error: wrong # of arguments (<2)"); - // return NULL; - //} #define ARG_CHECK_LOOP_BEGIN while(ei < argc) { if(0) {} #define ARG_CHECK_LOOP_END } --- 457,460 ---- *************** *** 486,489 **** --- 483,496 ---- MATCH_ARG_T("-bd", A_FLOAT) { ei++; ei++; } MATCH_ARG_T("-bd", A_SYMBOL) { ei++; ei++; } + MATCH_ARG_T("-send", A_SYMBOL){ + ei++; + //x->s_send = argv[ei++].a_w.w_symbol; + tracker_set_send(x, argv[ei++].a_w.w_symbol); + } + MATCH_ARG_T("-recv", A_SYMBOL){ + ei++; + //x->s_recv = argv[ei++].a_w.w_symbol; + tracker_set_recv(x, argv[ei++].a_w.w_symbol); + } MATCH_ARG("-data") { ei++; *************** *** 507,511 **** } got_data = 1; ! x->b_save_data = 1; } MATCH_FAILED { --- 514,519 ---- } got_data = 1; ! //x->b_save_data = 1; ! tracker_set_saveflag(x, 1); } MATCH_FAILED { *************** *** 596,600 **** --- 604,612 ---- SETFLOAT(&atombuf[ei], x->x_data[introw][ei]); } + outlet_list(x->outlet0, &s_list, x->x_columns, atombuf); + if(x->s_send != gensym("")) + pd_list(x->s_send->s_thing, &s_list, x->x_columns, atombuf); + freebytes(atombuf, sizeof(t_atom)*x->x_columns);
*************** *** 606,613 **** }
- static void tracker_set_saveflag(t_tracker* x, t_floatarg b) { - x->b_save_data = (int)(b == 0 ? 0 : 1); - } - static void tracker_toggle_cursor(t_tracker* x, t_floatarg b) { x->b_cursor = (int)(b == 0 ? 0 : 1); --- 618,621 ---- *************** *** 654,657 **** --- 662,667 ----
outlet_list(x->outlet0, &s_list, 1, &a); + if(x->s_send != gensym("")) + pd_list(x->s_send->s_thing, &s_list, 1, &a); }
*************** *** 690,710 **** ); class_addlist(tracker_class, tracker_list); ! class_addmethod(tracker_class, (t_method)tracker_toggle_cursor, gensym("trackrow"), A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_update, gensym("update"), A_GIMME, 0); ! //class_addmethod(tracker_class, (t_method)tracker_dialog, gensym("dialog"), A_GIMME, 0); ! class_addmethod(tracker_class, (t_method)tracker_setrow, gensym("setrow"), A_GIMME, 0); ! class_addmethod(tracker_class, (t_method)tracker_getrow, gensym("getrow"), A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_setitem, gensym("set"), A_FLOAT, A_FLOAT, A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_getitem, gensym("get"), A_FLOAT, A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_gresize, gensym("resize"), A_FLOAT, A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_set_saveflag, gensym("set_saveflag"), A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_file_load, gensym("load"), A_SYMBOL, 0); ! class_addmethod(tracker_class, (t_method)tracker_file_save, gensym("save"), A_SYMBOL, 0);
tracker_widgetbehavior.w_getrectfn = tracker_getrect; tracker_widgetbehavior.w_displacefn = tracker_displace; tracker_widgetbehavior.w_selectfn = tracker_select; ! //tracker_widgetbehavior.w_activatefn = NULL; ! tracker_widgetbehavior.w_activatefn = tracker_activate; tracker_widgetbehavior.w_deletefn = tracker_delete; tracker_widgetbehavior.w_visfn = tracker_vis; --- 700,732 ---- ); class_addlist(tracker_class, tracker_list); ! class_addmethod(tracker_class, (t_method)tracker_toggle_cursor, ! gensym("trackrow"), A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_update, ! gensym("update"), A_GIMME, 0); ! class_addmethod(tracker_class, (t_method)tracker_setrow, ! gensym("setrow"), A_GIMME, 0); ! class_addmethod(tracker_class, (t_method)tracker_getrow, ! gensym("getrow"), A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_setitem, ! gensym("set"), A_FLOAT, A_FLOAT, A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_getitem, ! gensym("get"), A_FLOAT, A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_gresize, ! gensym("resize"), A_FLOAT, A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_set_saveflag, ! gensym("set_saveflag"), A_FLOAT, 0); ! class_addmethod(tracker_class, (t_method)tracker_set_send, ! gensym("set_send"), A_SYMBOL, 0); ! class_addmethod(tracker_class, (t_method)tracker_set_recv, ! gensym("set_recv"), A_SYMBOL, 0); ! class_addmethod(tracker_class, (t_method)tracker_file_load, ! gensym("load"), A_SYMBOL, 0); ! class_addmethod(tracker_class, (t_method)tracker_file_save, ! gensym("save"), A_SYMBOL, 0);
tracker_widgetbehavior.w_getrectfn = tracker_getrect; tracker_widgetbehavior.w_displacefn = tracker_displace; tracker_widgetbehavior.w_selectfn = tracker_select; ! tracker_widgetbehavior.w_activatefn = NULL; tracker_widgetbehavior.w_deletefn = tracker_delete; tracker_widgetbehavior.w_visfn = tracker_vis;