Update of /cvsroot/pure-data/externals/ffext/tracker
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8215
Modified Files:
CHANGELOG makefile tracker-help.pd tracker.c tracker.h
tracker.tk
Log Message:
release 0.2.3 - you should really try this
Index: tracker-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker-help.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tracker-help.pd 22 Sep 2007 10:33:00 -0000 1.1
--- tracker-help.pd 29 Sep 2007 11:10:59 -0000 1.2
***************
*** 1,73 ****
! #N canvas 525 183 653 599 10;
! #X obj 65 282 tracker -data 10 10 9 8 7 6 5 4 3 2 1 0 10 9 8 7 6 5
4 3 2 1 11 10 9 8 7 6 5 4 3 2 12 11 10 9 8 7 6 5 4 3 13 12 11 10 9
8 7 6 5 4 14 13 12 11 10 9 8 7 6 5 15 14 13 12 11 10 9 8 7 6 16 15
14 13 12 11 10 9 8 7 17 16 15 14 13 12 11 10 9 8 18 17 16 15 14 13
! 12 11 10 9;
! #X msg 65 29 setrow 0 10 11 12 13 14 15 16 17 18 19;
! #X msg 79 51 setrow 0 999 999 999 999 999 999 999 999 999 999;
! #X msg 123 147 set 2 3 \$1;
! #X floatatom 123 130 5 0 0 0 - - -;
#N canvas 0 0 450 300 display_output 0;
! #X obj 60 51 inlet;
! #X obj 60 147 outlet;
! #X obj 60 85 list prepend set;
! #X obj 60 113 list trim;
! #X connect 0 0 2 0;
! #X connect 2 0 3 0;
! #X connect 3 0 1 0;
! #X restore 65 436 pd display_output;
! #X msg 65 467 16 15 14 13 12 11 10 9 8 7 16 15 14 13 12 11 10 9 8 7
! ;
! #X msg 99 100 getrow \$1;
! #X obj 99 80 r \$0-row;
! #X obj 477 555 s \$0-row;
! #X obj 477 504 f;
! #X obj 504 504 + 1;
! #X obj 477 528 % 10;
! #X obj 477 473 metro 100;
! #X obj 477 445 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
! #X floatatom 549 528 5 0 0 0 - - -;
! #X text 210 146 <- set single value;
! #X text 172 100 <- output one row;
! #X msg 146 180 get 2 3;
! #X text 212 182 <- output single value;
! #X obj 261 265 r \$0-trk;
! #X obj 419 235 s \$0-trk;
! #X text 59 530 tracker external - by Federico Ferri <mescalinum[at]gmail[dot]com>
! ;
! #X msg 419 94 resize 10 10;
! #X text 419 72 resize grid \, as in properties:;
! #X msg 433 119 resize 10 20;
! #X msg 467 168 load test.trk;
! #X msg 165 235 trackrow \$1;
! #X obj 165 217 tgl 15 0 empty \$0-tgl-trk empty 17 7 0 10 -262144 -1
-1 0 1;
! #X text 234 214 <- toggle row tracking;
! #X text 319 26 <- set whole row;
! #X msg 483 194 save test.trk;
! #X text 475 146 load/save:;
! #X connect 0 0 5 0;
! #X connect 1 0 0 0;
! #X connect 2 0 0 0;
! #X connect 3 0 0 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
! #X connect 7 0 0 0;
! #X connect 8 0 7 0;
! #X connect 10 0 11 0;
! #X connect 10 0 12 0;
! #X connect 11 0 10 1;
! #X connect 12 0 9 0;
! #X connect 13 0 10 0;
! #X connect 14 0 13 0;
! #X connect 15 0 9 0;
! #X connect 18 0 0 0;
! #X connect 20 0 0 0;
! #X connect 23 0 21 0;
! #X connect 25 0 21 0;
! #X connect 26 0 21 0;
! #X connect 27 0 0 0;
! #X connect 28 0 27 0;
! #X connect 31 0 21 0;
--- 1,106 ----
! #N canvas 355 23 810 615 10;
! #X obj 56 370 tracker -data 10 10 9 8 7 6 5 4 3 2 1 0 10 9 8 7 6 5
4 3 2 1 11 10 9 8 7 6 5 4 3 2 12 11 10 9 8 7 6 5 4 3 13 12 11 10 9
8 7 6 5 4 14 13 12 11 10 9 8 7 6 5 15 14 13 12 11 10 9 8 7 6 16 15
14 13 12 11 10 9 8 7 17 16 15 14 13 12 11 10 9 8 18 17 16 15 14 13
! 12 11 10 9 -send trk-out -recv trk;
! #X msg 54 128 setrow 0 10 11 12 13 14 15 16 17 18 19;
! #X msg 68 150 setrow 0 999 999 999 999 999 999 999 999 999 999;
! #X msg 85 197 set 2 3 \$1;
! #X floatatom 85 180 5 0 0 0 - - -;
#N canvas 0 0 450 300 display_output 0;
! #X obj 60 186 outlet;
! #X obj 60 132 list prepend set;
! #X obj 60 159 list trim;
! #X obj 60 51 r trk-out;
! #X obj 60 105 route output;
! #X obj 60 78 list trim;
! #X text 145 77 strip list selector;
! #X text 163 107 filter by output selector;
! #X text 192 136 prepend with set just to display in a msg;
! #X connect 1 0 2 0;
! #X connect 2 0 0 0;
! #X connect 3 0 5 0;
! #X connect 4 0 1 0;
! #X connect 5 0 4 0;
! #X restore 55 278 pd display_output;
! #X msg 55 309 12 11 10 9 8 7 6 5 4 3;
! #X obj 276 244 f;
! #X obj 303 244 + 1;
! #X obj 276 268 % 10;
! #X obj 276 219 metro 100;
! #X obj 276 191 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
! #X msg 446 150 resize 10 10;
! #X msg 460 175 resize 10 20;
! #X text 577 150 load/save:;
! #X obj 444 272 tgl 15 0 empty \$0-tgl-trk empty 17 7 0 10 -262144 -1
-1 0 1;
! #X text 470 268 <- toggle row tracking;
! #X obj 54 244 s trk;
! #X obj 446 213 s trk;
! #X msg 444 297 \; trk trackrow \$1;
! #X msg 276 295 \; trk getrow \$1;
! #X msg 570 179 load test.trk;
! #X msg 586 205 save test.trk;
! #X obj 570 234 s trk;
! #X text 313 184 <- playback;
! #X text 51 93 MANY WAYS TO GET OR SET DATA: ----------------------------
! ;
! #X msg 168 197 getrow \$1;
! #X msg 193 234 get 2 3;
! #X floatatom 168 178 5 0 0 0 - - -;
! #X obj 168 278 s trk;
! #X obj 31 22 cnv 15 650 35 empty empty tracker 20 12 0 14 -62784 -262144
! 0;
! #X text 226 25 tracker external - by Federico Ferri <mescalinum[at]gmail[dot]com>
! ;
! #N canvas 0 0 450 300 known_bugs 0;
! #X text 63 47 * GOP doesn't work;
! #X text 63 79 * dollarZero in send/recv doesn't work;
! #X restore 521 31 pd known_bugs;
! #N canvas 0 0 450 300 license 0;
! #X text 60 51 licensed under the terms of GNU/GPL license;
! #X text 60 79 see COPYING for details;
! #X restore 610 31 pd license;
! #N canvas 569 336 450 300 keyboard_control 0;
! #X text 41 44 first \, give focus with mouse. the focused item becomes
! red.;
! #X text 42 69 you can change value by mouse dragging \, or by keyboard.
! ;
! #X text 42 97 to change the selected value with keyboard \, type digits
! and press return. if you typed some digits you can cancel editing by
! pressing esc. you can increase decrease value with keys +/-. you can
! move selected item (cursor) with HJKL keys.;
! #X restore 556 71 pd keyboard_control;
! #X obj 31 542 cnv 15 650 35 empty empty v0.2.3 20 12 0 14 -62784 -262144
! 0;
! #N canvas 212 405 361 431 notify_and_synchronization 0;
! #X obj 42 43 tracker -rows 10 -cols 10;
! #X obj 42 213 route changenotify;
! #X obj 42 246 tracker -rows 10 -cols 10;
! #X obj 42 190 route list;
! #X connect 0 0 3 0;
! #X connect 1 0 2 0;
! #X connect 3 0 1 0;
! #X restore 496 95 pd notify_and_synchronization;
! #X text 446 127 resize:;
! #X connect 1 0 17 0;
! #X connect 2 0 17 0;
! #X connect 3 0 17 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
! #X connect 7 0 8 0;
! #X connect 7 0 9 0;
! #X connect 8 0 7 1;
! #X connect 9 0 20 0;
! #X connect 10 0 7 0;
! #X connect 11 0 10 0;
! #X connect 12 0 18 0;
! #X connect 13 0 18 0;
! #X connect 15 0 19 0;
! #X connect 21 0 23 0;
! #X connect 22 0 23 0;
! #X connect 26 0 29 0;
! #X connect 27 0 29 0;
! #X connect 28 0 26 0;
Index: CHANGELOG
===================================================================
RCS file: /cvsroot/pure-data/externals/ffext/tracker/CHANGELOG,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CHANGELOG 22 Sep 2007 23:55:08 -0000 1.1
--- CHANGELOG 29 Sep 2007 11:10:59 -0000 1.2
***************
*** 16,17 ****
--- 16,26 ----
0.2.2 --------------------------------------------------------------------
added send/receive symbols support
+
+ 0.2.3 --------------------------------------------------------------------
+ numbers are now aligned to right
+ notification messages are sent from user interaction
+ mouse behavior improved. now dragging faster changes more.
+ added nice makefile for target:
+ Linux
+ MacOS (thanks Steffen)
+ Win32 (thanks tof)
Index: tracker.tk
===================================================================
RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker.tk,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tracker.tk 22 Sep 2007 23:54:13 -0000 1.3
--- tracker.tk 29 Sep 2007 11:10:59 -0000 1.4
***************
*** 43,47 ****
}
! proc pdtk_tracker_dialog {id width height saveflag ss rs} {
set vid [string trimleft $id .]
--- 43,47 ----
}
! proc pdtk_tracker_dialog {id width height saveflag digitw ss rs} {
set vid [string trimleft $id .]
Index: makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/ffext/tracker/makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** makefile 22 Sep 2007 23:54:13 -0000 1.3
--- makefile 29 Sep 2007 11:10:59 -0000 1.4
***************
*** 1,37 ****
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:
! $(RM) -f *.o *.pd_* so_locations *.tk2c
--- 1,63 ----
all: pd_linux
+ #all: pd_win
+ #all: pd_darwin
! .SUFFIXES: .pd_linux .pd_darwin .dll .tk .tk2c
! PDPATH = /home/pat/pd
! # ----------------------- WINDOWS -------------------------
! pd_win: tracker.dll
! tracker.dll: tracker.c tracker.h tracker.tk2c
!
! WINCFLAGS = -Wall -W -Wshadow -Wstrict-prototypes -DPD -DNT -W3 -WX -Werror -Wno-unused -mms-bitfields -Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer
! WININCLUDE = -I.. -I../include -I$(PDPATH)/src
!
! WINLDFLAGS = -shared
!
! .c.dll:
! gcc -mms-bitfields $(WINCFLAGS) $(WININCLUDE) -o $*.o -c $*.c
! gcc $(WINLDFLAGS) -o $*.dll $*.o $(PDPATH)/bin/pd.dll
! strip --strip-unneeded $*.dll
! rm -f $*.o
!
! # ----------------------- LINUX i386 ----------------------
! pd_linux: tracker.pd_linux
! tracker.pd_linux: tracker.c tracker.h tracker.tk2c
!
! LINUXCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \
! -Wall -W -Wno-shadow -Wstrict-prototypes \
! -Wno-unused -Wno-parentheses -Wno-switch
! LINUXINCLUDE = -I/usr/include -I$(PDPATH)/src
! LINUXLDFLAGS = -export_dynamic -shared
!
! .c.pd_linux:
! $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
! $(LD) $(LINUXLDFLAGS) -o $*.pd_linux $*.o -lc -lm
! strip --strip-unneeded $*.pd_linux
!
! # ----------------------- Darwin (OSX) --------------------
! pd_darwin: tracker.pd_darwin
! tracker.pd_darwin: tracker.c tracker.h tracker.tk2c
!
! DARWINCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \
! -Wall -W -Wno-shadow -Wstrict-prototypes \
! -Wno-unused -Wno-parentheses -Wno-switch
! DARWININCLUDE = -I/usr/include -I$(PDPATH)/src
! DARWINLDFLAGS = -bundle -undefined suppress -flat_namespace
!
! .c.pd_darwin:
! $(CC) $(CFLAGS) -o $*.o -c $*.c
! $(LD) $(DARWINLDFLAGS) -o $*.pd_darwin $*.o -lc -lm
+ # ----------------------- Miscellaneous -------------------
.tk.tk2c:
! sh tk2c.bash < $*.tk > $*.tk2c
!
clean:
! rm -f *.o *.pd_linux *.pd_darwin *.pd_win *.dll so_locations *.tk2c
!
!
Index: tracker.h
===================================================================
RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tracker.h 22 Sep 2007 23:54:13 -0000 1.3
--- tracker.h 29 Sep 2007 11:10:59 -0000 1.4
***************
*** 61,64 ****
--- 61,65 ----
static void tracker_select_item(t_tracker* x, int r, int c);
static void tracker_select_movecur(t_tracker* x, int dx, int dy);
+ static void tracker_changenotify(t_tracker* x, t_floatarg row, t_floatarg col);
void tracker_setup(void);
Index: tracker.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ffext/tracker/tracker.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tracker.c 23 Sep 2007 08:22:11 -0000 1.4
--- tracker.c 29 Sep 2007 11:10:59 -0000 1.5
***************
*** 36,52 ****
#define MARGIN_X 3
#define MARGIN_Y 2
static const char* tracker_isedititem(t_tracker* x, int r, int c) {
if(x->x_active_row == r && x->x_active_row >= 0 &&
x->x_active_column == c && x->x_active_column >= 0 &&
! x->x_buf[0]) return ">";
! else return "";
}
static int tracker_getdisplayval(t_tracker* x, int r, int c) {
! if(tracker_isedititem(x, r, c) == ">") {
return atoi(x->x_buf);
} else {
! return x->x_data[r][c];
}
}
--- 36,83 ----
#define MARGIN_X 3
#define MARGIN_Y 2
+ #define CHR_EDIT "<"
+ #define CHR_NORM " "
+ #define DIGITS_MIN 1
+ #define DIGITS_MAX 10
+
+ static void tracker_clip_row_col(t_tracker* x, t_int* pr, t_int* pc) {
+ if((*pr) < 0) {
+ (*pr) = x->x_rows - (((-(*pr) - 1) % x->x_rows) + 1);
+ } else {
+ (*pr) = (*pr) % x->x_rows;
+ }
+ if((*pc) < 0) {
+ (*pc) = x->x_columns - (((-(*pc) - 1) % x->x_columns) + 1);
+ } else {
+ (*pc) = (*pc) % x->x_columns;
+ }
+ }
+
+ static t_float tracker_data_get(t_tracker* x, t_floatarg r, t_floatarg c) {
+ t_int ir = (t_int)r;
+ t_int ic = (t_int)c;
+ tracker_clip_row_col(x, &ir, &ic);
+ return x->x_data[(int)ir][(int)ic];
+ }
+
+ static void tracker_data_set(t_tracker* x, t_floatarg r, t_floatarg c, t_floatarg d) {
+ t_int ir = (t_int)r;
+ t_int ic = (t_int)c;
+ tracker_clip_row_col(x, &ir, &ic);
+ x->x_data[(int)ir][(int)ic] = d;
+ }
static const char* tracker_isedititem(t_tracker* x, int r, int c) {
if(x->x_active_row == r && x->x_active_row >= 0 &&
x->x_active_column == c && x->x_active_column >= 0 &&
! x->x_buf[0]) return CHR_EDIT;
! else return CHR_NORM;
}
static int tracker_getdisplayval(t_tracker* x, int r, int c) {
! if(tracker_isedititem(x, r, c) == CHR_EDIT) {
return atoi(x->x_buf);
} else {
! return tracker_data_get(x, r, c);
}
}
***************
*** 61,65 ****
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c create text %d %d -text %d%s -font -*-courier-bold--normal--%d-* -anchor nw -tags {%xTEXT %xTEXT.%d.%d} -fill black\n", canvas, text_xpix(&x->x_obj, glist)+c*x->x_cell_width+MARGIN_X, text_ypix(&x->x_obj, glist)+r*x->x_cell_height+MARGIN_Y, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c), glist_getfont(glist), x, x, r, c);
}
}
--- 92,96 ----
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c create text %d %d -text {%d%s} -font -*-courier-bold--normal--%d-* -anchor ne -tags {%xTEXT %xTEXT.%d.%d} -fill black\n", canvas, text_xpix(&x->x_obj, glist)+(c+1)*x->x_cell_width+MARGIN_X, text_ypix(&x->x_obj, glist)+r*x->x_cell_height+MARGIN_Y, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c), glist_getfont(glist), x, x, r, c);
}
}
***************
*** 73,77 ****
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c itemconfigure %xTEXT.%d.%d -text %d%s\n", canvas, x, r, c, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c));
}
}
--- 104,108 ----
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c itemconfigure %xTEXT.%d.%d -text {%d%s}\n", canvas, x, r, c, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c));
}
}
***************
*** 79,94 ****
}
! static void tracker_draw_update_row(t_tracker* x, int r) {
int c;
t_canvas* canvas = glist_getcanvas(x->x_glist);
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c itemconfigure %xTEXT.%d.%d -text %d%s\n", canvas, x, r, c, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c));
}
canvas_fixlinesfor(canvas, (t_text*)x);
}
! static void tracker_draw_update_single(t_tracker* x, int r, int c) {
t_canvas* canvas = glist_getcanvas(x->x_glist);
! sys_vgui(".x%x.c itemconfigure %xTEXT.%d.%d -text %d%s\n", canvas, x, r, c, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c));
canvas_fixlinesfor(canvas, (t_text*)x);
}
--- 110,131 ----
}
! static void tracker_draw_update_row(t_tracker* x, t_floatarg r) {
! t_int ir = (t_int)r;
! t_int ic = 0;
! tracker_clip_row_col(x, &ir, &ic);
int c;
t_canvas* canvas = glist_getcanvas(x->x_glist);
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c itemconfigure %xTEXT.%d.%d -text {%d%s}\n", canvas, x, ir, c, tracker_getdisplayval(x, r, c), tracker_isedititem(x, r, c));
}
canvas_fixlinesfor(canvas, (t_text*)x);
}
! static void tracker_draw_update_single(t_tracker* x, t_floatarg r, t_floatarg c) {
! t_int ir = (t_int)r;
! t_int ic = (t_int)c;
! tracker_clip_row_col(x, &ir, &ic);
t_canvas* canvas = glist_getcanvas(x->x_glist);
! sys_vgui(".x%x.c itemconfigure %xTEXT.%d.%d -text {%d%s}\n", canvas, x, ir, ic, tracker_getdisplayval(x, ir, ic), tracker_isedititem(x, ir, ic));
canvas_fixlinesfor(canvas, (t_text*)x);
}
***************
*** 115,119 ****
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c coords %xTEXT.%d.%d %d %d\n", canvas, x, r, c, text_xpix(&x->x_obj, glist)+c*x->x_cell_width+MARGIN_X, text_ypix(&x->x_obj, glist)+r*x->x_cell_height+MARGIN_Y);
}
}
--- 152,156 ----
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! sys_vgui(".x%x.c coords %xTEXT.%d.%d %d %d\n", canvas, x, r, c, text_xpix(&x->x_obj, glist)+(c+1)*x->x_cell_width+MARGIN_X, text_ypix(&x->x_obj, glist)+r*x->x_cell_height+MARGIN_Y);
}
}
***************
*** 167,171 ****
for (ei = 0; ei < x->x_rows; ei++) {
for (gi = 0; gi < x->x_columns; gi++) {
! binbuf_addv(b, "i", (int)x->x_data[ei][gi]);
}
}
--- 204,208 ----
for (ei = 0; ei < x->x_rows; ei++) {
for (gi = 0; gi < x->x_columns; gi++) {
! binbuf_addv(b, "i", (int)tracker_data_get(x, ei, gi));
}
}
***************
*** 190,196 ****
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
);
--- 227,233 ----
t_tracker* x = (t_tracker*)z;
! sprintf(buf, "pdtk_tracker_dialog %%s %d %d %d %d {%s} {%s}\n",
(int)x->x_columns, (int)x->x_rows,
! (int)x->b_save_data, (int)x->x_ndigits,
x->s_send->s_name, x->s_recv->s_name
);
***************
*** 261,264 ****
--- 298,302 ----
int oldr,oldc;
tracker_setitem(x, x->x_active_row, x->x_active_column, n);
+ tracker_changenotify(x, x->x_active_row, x->x_active_column);
tracker_reset_buffer(x);
tracker_draw_update_single(x, x->x_active_row, x->x_active_column);
***************
*** 291,302 ****
static void tracker_motion(t_tracker* x, t_floatarg dx, t_floatarg dy) {
! if(x->x_active_row >= 0 && x->x_active_column >= 0) {
! if(dy == 1) {
! x->x_data[x->x_active_row][x->x_active_column]--;
! tracker_draw_update_single(x, x->x_active_row, x->x_active_column);
! } else if(dy == -1) {
! x->x_data[x->x_active_row][x->x_active_column]++;
! tracker_draw_update_single(x, x->x_active_row, x->x_active_column);
! }
}
}
--- 329,338 ----
static void tracker_motion(t_tracker* x, t_floatarg dx, t_floatarg dy) {
! if(x->x_active_row >= 0 && x->x_active_column >= 0 && dy != 0) {
! t_float d = tracker_data_get(x, x->x_active_row, x->x_active_column);
! d -= dy;
! tracker_data_set(x, x->x_active_row, x->x_active_column, d);
! tracker_changenotify(x, x->x_active_row, x->x_active_column);
! tracker_draw_update_single(x, x->x_active_row, x->x_active_column);
}
}
***************
*** 396,399 ****
--- 432,443 ----
}
+ static void tracker_gdigits(t_tracker* x, t_floatarg d) {
+ x->x_ndigits = (int)d;
+ if(x->x_ndigits < DIGITS_MIN) x->x_ndigits = DIGITS_MIN;
+ if(x->x_ndigits > DIGITS_MAX) x->x_ndigits = DIGITS_MAX;
+ tracker_vis((t_gobj*)x, x->x_glist, 0);
+ tracker_vis((t_gobj*)x, x->x_glist, 1);
+ }
+
static void tracker_free(t_tracker* x) {
int ei;
***************
*** 417,420 ****
--- 461,465 ----
x->s_recv = s;
+ //x->s_recv_r = canvas_realizedollar(glist_getcanvas(x->x_glist), s);
pd_bind(&x->x_obj.ob_pd, s);
***************
*** 443,460 ****
x->x_cursor_pos = -1;
x->b_cursor = 0;
! x->b_save_data = 0;
x->s_send = gensym("");
x->s_recv = gensym("");
! int cols = 0, rows = 0;
int got_data = 0;
! if(argc == 0) {
! // set default values
! cols = 10;
! rows = 10;
! tracker_resize(x, rows, cols);
! x->b_save_data = 1;
! } else {
#define ARG_CHECK_LOOP_BEGIN while(ei < argc) { if(0) {}
#define ARG_CHECK_LOOP_END }
--- 488,499 ----
x->x_cursor_pos = -1;
x->b_cursor = 0;
! x->b_save_data = 1;
x->s_send = gensym("");
x->s_recv = gensym("");
! int cols = 10, rows = 10;
int got_data = 0;
! if(argc > 0) {
#define ARG_CHECK_LOOP_BEGIN while(ei < argc) { if(0) {}
#define ARG_CHECK_LOOP_END }
***************
*** 475,478 ****
--- 514,523 ----
cols = (int)argv[ei++].a_w.w_float;
}
+ MATCH_ARG_T("-digits", A_FLOAT) {
+ ei++;
+ x->x_ndigits = (int)argv[ei++].a_w.w_float;
+ if(x->x_ndigits < DIGITS_MIN) x->x_ndigits = DIGITS_MIN;
+ if(x->x_ndigits > DIGITS_MAX) x->x_ndigits = DIGITS_MAX;
+ }
MATCH_ARG_T("-bg", A_FLOAT) { ei++; ei++; }
MATCH_ARG_T("-bg", A_SYMBOL) { ei++; ei++; }
***************
*** 511,518 ****
int j;
for(j = 0; j < (rows * cols); j++) {
! x->x_data[j / cols][j % cols] = argv[ei++].a_w.w_float;
}
got_data = 1;
- //x->b_save_data = 1;
tracker_set_saveflag(x, 1);
}
--- 556,562 ----
int j;
for(j = 0; j < (rows * cols); j++) {
! tracker_data_set(x, j / cols, j % cols, argv[ei++].a_w.w_float);
}
got_data = 1;
tracker_set_saveflag(x, 1);
}
***************
*** 524,535 ****
/*----------------*/ARG_CHECK_LOOP_END
}
! if(!got_data) tracker_resize(x, rows, cols);
- /*if(argc == (2+cols*rows)) {
- // restore saved data
- for(ei = 2; ei < argc; ei++) {
- x->x_data[(ei-2)/cols][(ei-2)%cols] = argv[ei].a_w.w_float;
- }
- }*/
x->x_glist = (t_glist*)canvas_getcurrent();
--- 568,576 ----
/*----------------*/ARG_CHECK_LOOP_END
}
! if(!got_data) {
! tracker_set_saveflag(x, 0);
! tracker_resize(x, rows, cols);
! }
x->x_glist = (t_glist*)canvas_getcurrent();
***************
*** 547,552 ****
void* binbuf = binbuf_new();
t_canvas* canvas = glist_getcanvas(x->x_glist);
! if(binbuf_read_via_canvas(binbuf, f->s_name, canvas, 0))
! error("tracker: %s: read failed", f->s_name);
int argc = binbuf_getnatom(binbuf);
--- 588,595 ----
void* binbuf = binbuf_new();
t_canvas* canvas = glist_getcanvas(x->x_glist);
! if(binbuf_read_via_canvas(binbuf, f->s_name, canvas, 0)) {
! //error("tracker: %s: read failed", f->s_name);
! return;
! }
int argc = binbuf_getnatom(binbuf);
***************
*** 565,570 ****
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! //x->x_data[r][c] = argv[2+r*cols+c].a_w.w_float;
! x->x_data[r][c] = argv[j++].a_w.w_float;
}
}
--- 608,612 ----
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! tracker_data_set(x, r, c, argv[j++].a_w.w_float);
}
}
***************
*** 584,588 ****
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! binbuf_addv(binbuf, "i", (int)x->x_data[r][c]);
}
}
--- 626,630 ----
for(r = 0; r < x->x_rows; r++) {
for(c = 0; c < x->x_columns; c++) {
! binbuf_addv(binbuf, "i", (int)tracker_data_get(x, r, c));
}
}
***************
*** 594,621 ****
static void tracker_getrow(t_tracker* x, t_floatarg row) {
! int ei,introw;
! introw = (int)row;
! introw = introw % x->x_rows;
! if(introw < 0) introw = 0;
- t_atom *atombuf = (t_atom*)getbytes(sizeof(t_atom)*x->x_columns);
for(ei = 0; ei < x->x_columns; ei++) {
! 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);
if(x->b_cursor) {
! x->x_cursor_pos = ((t_int)row) % x->x_rows;
! if(x->x_cursor_pos < 0) x->x_cursor_pos = 0;
tracker_draw_update_cursor_pos(x);
}
}
static void tracker_toggle_cursor(t_tracker* x, t_floatarg b) {
x->b_cursor = (int)(b == 0 ? 0 : 1);
--- 636,682 ----
static void tracker_getrow(t_tracker* x, t_floatarg row) {
! int ei;
! int argc = x->x_columns + 1;
! t_atom *atombuf = (t_atom*)getbytes(sizeof(t_atom)*argc);
!
! SETSYMBOL(&atombuf[0], gensym("output"));
for(ei = 0; ei < x->x_columns; ei++) {
! SETFLOAT(&atombuf[ei+1], tracker_data_get(x, row, ei));
}
! outlet_list(x->outlet0, &s_list, argc, atombuf);
if(x->s_send != gensym(""))
! pd_list(x->s_send->s_thing, &s_list, argc, atombuf);
! freebytes(atombuf, sizeof(t_atom)*(x->x_columns+1));
if(x->b_cursor) {
! t_int ir = (t_int)row;
! t_int ic = 0;
! tracker_clip_row_col(x, &ir, &ic);
! x->x_cursor_pos = ir;
tracker_draw_update_cursor_pos(x);
}
}
+ static void tracker_changenotify(t_tracker* x, t_floatarg row, t_floatarg col) {
+ int ei = 0;
+ t_atom *atombuf = (t_atom*)getbytes(sizeof(t_atom)*5);
+
+ SETSYMBOL(&atombuf[ei], gensym("changenotify")); ei++;
+ SETSYMBOL(&atombuf[ei], gensym("set")); ei++;
+ SETFLOAT(&atombuf[ei], row); ei++;
+ SETFLOAT(&atombuf[ei], col); ei++;
+ SETFLOAT(&atombuf[ei], tracker_data_get(x, row, col)); ei++;
+
+ outlet_list(x->outlet0, &s_list, ei, atombuf);
+ if(x->s_send != gensym(""))
+ pd_list(x->s_send->s_thing, &s_list, ei, atombuf);
+
+ freebytes(atombuf, sizeof(t_atom)*ei);
+ }
+
static void tracker_toggle_cursor(t_tracker* x, t_floatarg b) {
x->b_cursor = (int)(b == 0 ? 0 : 1);
***************
*** 628,682 ****
return;
}
! int ei,introw;
!
! introw = (int)argv[0].a_w.w_float;
! introw = introw % x->x_rows;
! if(introw < 0) introw = 0;
!
for(ei = 1; ei < argc; ei++) {
! if((ei-1) >= x->x_columns) break;
if(argv[ei].a_type == A_FLOAT) {
! x->x_data[introw][ei-1] = argv[ei].a_w.w_float;
} else {
post("tracker: warning: non-float atom converted to zero-value");
! x->x_data[introw][ei-1] = 0;
}
}
!
! tracker_draw_update_row(x, introw);
}
static void tracker_getitem(t_tracker* x, t_float row, t_float col) {
! t_atom a;
! int introw,intcol;
!
! introw = (int)row;
! introw = introw % x->x_rows;
! if(introw < 0) introw = 0;
! intcol = (int)col;
! intcol = intcol % x->x_columns;
! if(intcol < 0) intcol = 0;
!
! SETFLOAT(&a, x->x_data[introw][intcol]);
!
! outlet_list(x->outlet0, &s_list, 1, &a);
if(x->s_send != gensym(""))
! pd_list(x->s_send->s_thing, &s_list, 1, &a);
}
static void tracker_setitem(t_tracker* x, t_float row, t_float col, t_float val) {
! int introw,intcol;
!
! introw = (int)row;
! introw = introw % x->x_rows;
! if(introw < 0) introw = 0;
! intcol = (int)col;
! intcol = intcol % x->x_columns;
! if(intcol < 0) intcol = 0;
!
! x->x_data[introw][intcol] = val;
!
! tracker_draw_update_single(x, introw, intcol);
}
--- 689,718 ----
return;
}
! int ei;
for(ei = 1; ei < argc; ei++) {
! if((ei - 1) >= x->x_columns) break;
if(argv[ei].a_type == A_FLOAT) {
! tracker_data_set(x, argv[0].a_w.w_float, ei - 1, argv[ei].a_w.w_float);
} else {
post("tracker: warning: non-float atom converted to zero-value");
! tracker_data_set(x, argv[0].a_w.w_float, ei - 1, 0);
}
}
! tracker_draw_update_row(x, argv[0].a_w.w_float);
}
static void tracker_getitem(t_tracker* x, t_float row, t_float col) {
! t_atom a[2];
! SETSYMBOL(&a[0], gensym("output"));
! SETFLOAT(&a[1], tracker_data_get(x, row, col));
! outlet_list(x->outlet0, &s_list, 2, &a[0]);
if(x->s_send != gensym(""))
! pd_list(x->s_send->s_thing, &s_list, 2, &a[0]);
}
static void tracker_setitem(t_tracker* x, t_float row, t_float col, t_float val) {
! tracker_data_set(x, row, col, val);
! tracker_draw_update_single(x, row, col);
}