From 1e9ee7bc8ebcba281bf912d7527d3e3e9fcbaba7 Mon Sep 17 00:00:00 2001 From: Thomas O Fredericks Date: Mon, 11 Oct 2010 15:30:53 +0000 Subject: Fixed a few bugs, added a symbol handler to paramGui and updated help files svn path=/trunk/externals/tof/; revision=14219 --- src/Makefile | 45 +++++- src/list_accum-help.pd | 27 ---- src/param.c | 4 +- src/param.h | 23 +++ src/paramDump.h | 10 +- src/paramGui.h | 380 +++++++++++++++++++++++++++---------------------- src/tof.h | 47 ++++-- 7 files changed, 316 insertions(+), 220 deletions(-) delete mode 100644 src/list_accum-help.pd (limited to 'src') diff --git a/src/Makefile b/src/Makefile index bd98bf8..9e3647e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,18 +1,21 @@ # # SETUP # + # Points to the folder that contains pd's /src dir PD_SRC = ../../../pd -# Points to the folder that contains pd's compiled /bin dir + +# Points to the folder that contains pd's compiled /bin dir (for OS X) PD_BIN = /Applications/Pd-extended.app/Contents/Resources -# Points to the folder to which you want to put the built file -OUTPUT = ~/Make/pd/tof +# Points to the folder to which you want to move the built file +OUTPUT = ~/Make/pd/tof # # FIND OS # + UNAME := $(shell uname -s) ifeq ($(UNAME),Linux) OS_NAME = linux @@ -111,18 +114,46 @@ endif CXXFLAGS = $(CFLAGS) +### C++ files +%.$(EXTENSION): %.cpp +%.$(EXTENSION): %.cc + $(CXX) $(OPT_CFLAGS) $(CXXFLAGS) -o "$*.o" -c "$<" + $(CXX) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) + chmod a-x "$*.$(EXTENSION)" +# $(STRIP) $*.$(EXTENSION) +# rm -f -- $*.o + mv $*.$(EXTENSION) $(OUTPUT) -### C files +%.o: %.cpp +%.o: %.cc + $(CXX) $(OPT_CFLAGS) $(CXXFLAGS) -o "$*.o" -c "$<" -.c: - $(CC) $(OPT_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c" - $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) +### C files +%.o: %.c + $(CC) $(OPT_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c" + +%.$(EXTENSION): %.o + $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) \ + `test -f $*.libs && cat $*.libs` \ + `my_dylib=$(patsubst $(externals_src)/%,%,$(@D)); test -f $(@D)/lib$${my_dylib}.$(DYLIB_EXTENSION) && echo -L$(@D) -l$$my_dylib` \ + `my_obj=$(patsubst $(externals_src)/%,%,$(@D)); test -f $(@D)/shared/$${my_obj}.o && echo $(@D)/shared/$${my_obj}.o` \ + `test -f $(dir $*)../$(BUILDSRC_OS_NAME)/$(notdir $*).libs && \ + cat $(dir $*)../$(BUILDSRC_OS_NAME)/$(notdir $*).libs` chmod a-x "$*.$(EXTENSION)" $(STRIP) $*.$(EXTENSION) rm -f -- $*.o mv $*.$(EXTENSION) $(OUTPUT) +### C files +#.c: +# $(CC) $(OPT_CFLAGS) $(CFLAGS) -o "$*.o" -c "$*.c" +# $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS) +# chmod a-x "$*.$(EXTENSION)" +# $(STRIP) $*.$(EXTENSION) +# rm -f -- $*.o +# mv $*.$(EXTENSION) $(OUTPUT) + diff --git a/src/list_accum-help.pd b/src/list_accum-help.pd deleted file mode 100644 index e7795ba..0000000 --- a/src/list_accum-help.pd +++ /dev/null @@ -1,27 +0,0 @@ -#N canvas 1298 133 478 349 10; -#X obj 56 223 tof/list_accum; -#X msg 77 158 1 2 3 4 5 6; -#X obj 55 86 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 --1; -#X obj 54 288 print; -#X floatatom 69 131 5 0 0 0 - - -; -#X msg 159 158 a b c d; -#X obj 171 194 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 --1 -1; -#X obj 140 256 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 --1 -1; -#X text 35 36 Tags: lists; -#X text 36 5 Description: Accumulates incomming atoms into one big -list; -#X text 113 135 Inlet 1 \, anything: Accumulate atoms; -#X text 192 194 Inlet 2 \, bang: Clear accumulated atoms; -#X text 76 85 Inlet 1 \, bang: Output and clear accumulated atoms; -#X text 160 254 Outlet 2 \, bang: Nothing accumulated (empty); -#X text 93 288 Outlet 1 \, list: Accumulated atoms; -#X connect 0 0 3 0; -#X connect 0 1 7 0; -#X connect 1 0 0 0; -#X connect 2 0 0 0; -#X connect 4 0 0 0; -#X connect 5 0 0 0; -#X connect 6 0 0 1; diff --git a/src/param.c b/src/param.c index a0779f2..fc8a152 100644 --- a/src/param.c +++ b/src/param.c @@ -314,7 +314,7 @@ static void* paramClass_new(t_symbol *s, int ac, t_atom *av) // Create memory space t_symbol* selector; - tof_set_selector(&selector,&ac_p,&av_p); + param_set_selector(&selector,&ac_p,&av_p); x->selector = selector; x->alloc = ac_p + 10; x->ac = ac_p; @@ -334,7 +334,7 @@ static void* paramClass_new(t_symbol *s, int ac, t_atom *av) inlet_new((t_object *)x, (t_pd *)p, 0, 0); x->outlet = outlet_new(&x->x_obj, &s_list); - + //post("Selector: %s",x->selector->s_name); return (x); diff --git a/src/param.h b/src/param.h index 46daca6..ff1c89d 100644 --- a/src/param.h +++ b/src/param.h @@ -42,6 +42,29 @@ typedef struct _paramroot { static t_paramroot* PARAMROOTS; +// set selector +// CHANGES +// USUALLY THE SELECTED SELECTOR WOULD ONLY BE BANG, ANYTHING OR LIST. +// I ADDED FLOAT +static void param_set_selector(t_symbol** selector_sym_p,int* ac_p, t_atom** av_p ) { + if(!(*ac_p)) { + *selector_sym_p = &s_bang; + } else if( IS_A_SYMBOL(*av_p, 0 )) { + + *selector_sym_p = atom_getsymbol(*av_p); + *ac_p = (*ac_p)-1; + *av_p = (*av_p)+1; + + } else if ( IS_A_FLOAT(*av_p, 0 ) && *ac_p == 1 ) { + *selector_sym_p = &s_float; + *ac_p = 1; + + } else { + *selector_sym_p = &s_list; + } +} + + static t_paramroot* param_get_root(t_symbol* root) { if (PARAMROOTS == NULL) { diff --git a/src/paramDump.h b/src/paramDump.h index 878b8c5..d6684e5 100644 --- a/src/paramDump.h +++ b/src/paramDump.h @@ -51,7 +51,8 @@ static void paramDump_guis(t_paramDump *x, t_symbol* s) { while (p) { if (p->GUI ) { p->GUI(p->x,&ac,&av,&send,&receive); - outlet_anything(x->outlet,p->path,ac,av); + tof_outlet_list_prepend(x->outlet,&s_list,ac,av,p->path); + //outlet_anything(x->outlet,p->path,ac,av); } p = p->next; @@ -61,7 +62,8 @@ static void paramDump_guis(t_paramDump *x, t_symbol* s) { while (p) { if (p->GUI && (strncmp(p->path->s_name,s->s_name,length)==0) ) { p->GUI(p->x,&ac,&av,&send,&receive); - outlet_anything(x->outlet,p->path,ac,av); + tof_outlet_list_prepend(x->outlet,&s_list,ac,av,p->path); + //outlet_anything(x->outlet,p->path,ac,av); } p = p->next; @@ -93,7 +95,7 @@ static void paramDump_symbol(t_paramDump *x, t_symbol* s) { while (p) { if ( p->get && (strncmp(p->path->s_name,s->s_name,length)==0) ) { p->get(p->x, &selector, &ac, &av); - tof_outlet_anything_prepend(x->outlet,selector,ac,av,p->path); + tof_outlet_list_prepend(x->outlet,selector,ac,av,p->path); } p = p->next; } @@ -120,7 +122,7 @@ static void paramDump_bang(t_paramDump *x) { while (p) { if ( p->get ) { p->get(p->x, &selector, &ac, &av); - tof_outlet_anything_prepend(x->outlet,selector,ac,av,p->path); + tof_outlet_list_prepend(x->outlet,selector,ac,av,p->path); } p = p->next; } diff --git a/src/paramGui.h b/src/paramGui.h index 2cef335..be33f0a 100644 --- a/src/paramGui.h +++ b/src/paramGui.h @@ -4,6 +4,17 @@ static t_class *paramGui_class; #define GUI_X_STEP 200 #define GUI_Y_STEP 18 + /* + CHANGES + + Added a symbol message handler and a subpath variable + + Banging inlet 2 only resets the gui but does not recreate it + + + */ + + typedef struct _paramGui @@ -14,7 +25,12 @@ typedef struct _paramGui t_canvas* childcanvas; //t_symbol* fullpath; t_symbol* path; + + int path_l; + + t_symbol* subpath; + int subpath_l; int build; t_symbol* root; @@ -68,7 +84,7 @@ static void paramGui_buildCanvas(t_paramGui* x,int x_position,int y_position) { int i; t_symbol* shortpath; - int gui_built = 1; + int gui_update = 0; // ac & av for updating the values of the gui (p->get()) // after it is created @@ -79,175 +95,190 @@ static void paramGui_buildCanvas(t_paramGui* x,int x_position,int y_position) { t_param* p = get_param_list(x->root); + + + while (p) { - gui_built = 1; + gui_update = 0; if (p->GUI && (strncmp(p->path->s_name,x->path->s_name,x->path_l)==0)) { - p->GUI(p->x,&ac,&av,&send,&receive); - if ( send == NULL ) send = s_empty; - if ( receive == NULL ) receive = s_empty; - - /* - // This code alows the positioning of the guis, but creates - // too many problems - if ( IS_A_FLOAT(av,0) ) { - pos_x = GUI_X_STEP * atom_getfloat(av); - av++; - ac--; - } - - if ( IS_A_FLOAT(av,0) ) { - pos_y = GUI_Y_STEP * atom_getfloat(av); - av++; - ac--; - } - */ - if ( IS_A_SYMBOL(av,0)) { - - // Make shortpath (removes what is common between paths) - // Do not make shortpath if we are at the root (x->path_l==1) - if ( x->path_l < 2) { - shortpath = p->path; - } else { - shortpath = gensym(p->path->s_name + x->path_l); + + if ( x->subpath==NULL || (x->path_l > 0 && strncmp((p->path->s_name)+(x->path_l-1),x->subpath->s_name,x->subpath_l)==0)) { + + + p->GUI(p->x,&ac,&av,&send,&receive); + if ( send == NULL ) send = s_empty; + if ( receive == NULL ) receive = s_empty; + + /* + // This code alows the positioning of the guis, but creates + // too many problems + if ( IS_A_FLOAT(av,0) ) { + pos_x = GUI_X_STEP * atom_getfloat(av); + av++; + ac--; } - - - - type = atom_getsymbol(av); - if ( type == s_nbx ) { - SETSYMBOL(&atoms[0],s_obj); - SETFLOAT(&atoms[1],pos_x); - SETFLOAT(&atoms[2],pos_y); - SETSYMBOL(&atoms[3],s_nbx); - SETFLOAT(&atoms[4],5); - SETFLOAT(&atoms[5],14); - SETFLOAT(&atoms[6],-1.0e+37); - SETFLOAT(&atoms[7],1.0e+37); - SETFLOAT(&atoms[8],0); - SETFLOAT(&atoms[9],0); - SETSYMBOL(&atoms[10],send); - SETSYMBOL(&atoms[11],receive); - SETSYMBOL(&atoms[12],shortpath); - SETFLOAT(&atoms[13],50); - SETFLOAT(&atoms[14],8); - SETFLOAT(&atoms[15],0); - SETFLOAT(&atoms[16],8); - SETFLOAT(&atoms[17],-262144); - SETFLOAT(&atoms[18],-1); - SETFLOAT(&atoms[19],-1); - SETFLOAT(&atoms[20],0); - SETFLOAT(&atoms[21],256); - pd_forwardmess((t_pd*)x->childcanvas, 22, atoms); - pos_y = pos_y + GUI_Y_STEP; - - } else if (type == s_bng) { - SETSYMBOL(&atoms[0],s_obj); - SETFLOAT(&atoms[1],pos_x); - SETFLOAT(&atoms[2],pos_y); - SETSYMBOL(&atoms[3],s_bng); - SETFLOAT(&atoms[4],15); - SETFLOAT(&atoms[5],250); - SETFLOAT(&atoms[6],50); - SETFLOAT(&atoms[7],0); - SETSYMBOL(&atoms[8],send); - SETSYMBOL(&atoms[9],receive); - SETSYMBOL(&atoms[10],shortpath); - SETFLOAT(&atoms[11],17); - SETFLOAT(&atoms[12],7); - SETFLOAT(&atoms[13],0); - SETFLOAT(&atoms[14],8); - SETFLOAT(&atoms[15],-262144); - SETFLOAT(&atoms[16],-1); - SETFLOAT(&atoms[17],-1); - pd_forwardmess((t_pd*)x->childcanvas, 18, atoms); - pos_y = pos_y + GUI_Y_STEP; - } else if ( (type == s_slider) || (type == s_knob) || (type == s_hsl) ) { - SETSYMBOL(&atoms[0],s_obj); - SETFLOAT(&atoms[1],pos_x); - SETFLOAT(&atoms[2],pos_y); - SETSYMBOL(&atoms[3],s_hsl); - SETFLOAT(&atoms[4],100); - SETFLOAT(&atoms[5],15); - if (ac > 1 && IS_A_FLOAT(av,1) ) { - SETFLOAT(&atoms[6],atom_getfloat(av+1)); - } else { - SETFLOAT(&atoms[6],0); - } - if (ac > 2 && IS_A_FLOAT(av,2) ) { - SETFLOAT(&atoms[7],atom_getfloat(av+2)); - } else { - SETFLOAT(&atoms[7],1); - } - SETFLOAT(&atoms[8],0); - SETFLOAT(&atoms[9],0); - SETSYMBOL(&atoms[10],send); - SETSYMBOL(&atoms[11],receive); - SETSYMBOL(&atoms[12],shortpath); - SETFLOAT(&atoms[13],105); - SETFLOAT(&atoms[14],7); - SETFLOAT(&atoms[15],0); - SETFLOAT(&atoms[16],8); - SETFLOAT(&atoms[17],-262144); - SETFLOAT(&atoms[18],-1); - SETFLOAT(&atoms[19],-1); - SETFLOAT(&atoms[20],0); - SETFLOAT(&atoms[21],1); - pd_forwardmess((t_pd*)x->childcanvas, 22, atoms); - pos_y = pos_y + GUI_Y_STEP; - - } else if (type == s_tgl) { - SETSYMBOL(&atoms[0],s_obj); - SETFLOAT(&atoms[1],pos_x); - SETFLOAT(&atoms[2],pos_y); - SETSYMBOL(&atoms[3],s_tgl); - SETFLOAT(&atoms[4],15); - SETFLOAT(&atoms[5],0); - SETSYMBOL(&atoms[6],send); - SETSYMBOL(&atoms[7],receive); - SETSYMBOL(&atoms[8],shortpath); - SETFLOAT(&atoms[9],17); - SETFLOAT(&atoms[10],7); - SETFLOAT(&atoms[11],0); - SETFLOAT(&atoms[12],8); - SETFLOAT(&atoms[13],-262144); - SETFLOAT(&atoms[14],1); - SETFLOAT(&atoms[15],-1); - SETFLOAT(&atoms[16],0); - SETFLOAT(&atoms[17],1); - pd_forwardmess((t_pd*)x->childcanvas, 18, atoms); - pos_y = pos_y + GUI_Y_STEP; - - - } else if ( type == s_symbolatom || type == s_sym) { - SETSYMBOL(&atoms[0],s_symbolatom); - SETFLOAT(&atoms[1],pos_x); - SETFLOAT(&atoms[2],pos_y); - SETFLOAT(&atoms[3],17); - SETFLOAT(&atoms[4],0); - SETFLOAT(&atoms[5],0); - SETFLOAT(&atoms[6],1); - SETSYMBOL(&atoms[7],shortpath); - SETSYMBOL(&atoms[8],receive); - SETSYMBOL(&atoms[9],send); - pd_forwardmess((t_pd*)x->childcanvas, 10,atoms); - pos_y = pos_y + GUI_Y_STEP; - } else { - SETSYMBOL(&atoms[0],s_text); - SETFLOAT(&atoms[1],pos_x); - SETFLOAT(&atoms[2],pos_y); - SETSYMBOL(&atoms[3],shortpath); - pd_forwardmess((t_pd*)x->childcanvas, 4,atoms); - pos_y = pos_y + GUI_Y_STEP; - gui_built = 0; - } - - if ((gui_built) && (receive != s_empty) && (p->get)) { - p->get(p->x,&s_got,&ac_got,&av_got); - tof_send_anything_prepend(receive,s_got,ac_got,av_got,s_set); - } - } + if ( IS_A_FLOAT(av,0) ) { + pos_y = GUI_Y_STEP * atom_getfloat(av); + av++; + ac--; + } + */ + if ( IS_A_SYMBOL(av,0)) { + + // Make shortpath (removes what is common between paths) + // Do not make shortpath if we are at the root (x->path_l==1) + if ( x->path_l < 2) { + shortpath = p->path; + } else { + shortpath = gensym(p->path->s_name + x->path_l); + } + + + + + type = atom_getsymbol(av); + if ( type == s_nbx ) { + SETSYMBOL(&atoms[0],s_obj); + SETFLOAT(&atoms[1],pos_x); + SETFLOAT(&atoms[2],pos_y); + SETSYMBOL(&atoms[3],s_nbx); + SETFLOAT(&atoms[4],5); + SETFLOAT(&atoms[5],14); + SETFLOAT(&atoms[6],-1.0e+37); + SETFLOAT(&atoms[7],1.0e+37); + SETFLOAT(&atoms[8],0); + SETFLOAT(&atoms[9],0); + SETSYMBOL(&atoms[10],send); + SETSYMBOL(&atoms[11],receive); + SETSYMBOL(&atoms[12],shortpath); + SETFLOAT(&atoms[13],50); + SETFLOAT(&atoms[14],8); + SETFLOAT(&atoms[15],0); + SETFLOAT(&atoms[16],8); + SETFLOAT(&atoms[17],-262144); + SETFLOAT(&atoms[18],-1); + SETFLOAT(&atoms[19],-1); + SETFLOAT(&atoms[20],0); + SETFLOAT(&atoms[21],256); + pd_forwardmess((t_pd*)x->childcanvas, 22, atoms); + pos_y = pos_y + GUI_Y_STEP; + gui_update = 1; + + } else if (type == s_bng) { + + SETSYMBOL(&atoms[0],s_obj); + SETFLOAT(&atoms[1],pos_x); + SETFLOAT(&atoms[2],pos_y); + SETSYMBOL(&atoms[3],s_bng); + SETFLOAT(&atoms[4],15); + SETFLOAT(&atoms[5],250); + SETFLOAT(&atoms[6],50); + SETFLOAT(&atoms[7],0); + SETSYMBOL(&atoms[8],send); + SETSYMBOL(&atoms[9],receive); + SETSYMBOL(&atoms[10],shortpath); + SETFLOAT(&atoms[11],17); + SETFLOAT(&atoms[12],7); + SETFLOAT(&atoms[13],0); + SETFLOAT(&atoms[14],8); + SETFLOAT(&atoms[15],-262144); + SETFLOAT(&atoms[16],-1); + SETFLOAT(&atoms[17],-1); + pd_forwardmess((t_pd*)x->childcanvas, 18, atoms); + pos_y = pos_y + GUI_Y_STEP; + + } else if ( (type == s_slider) || (type == s_knob) || (type == s_hsl) ) { + SETSYMBOL(&atoms[0],s_obj); + SETFLOAT(&atoms[1],pos_x); + SETFLOAT(&atoms[2],pos_y); + SETSYMBOL(&atoms[3],s_hsl); + SETFLOAT(&atoms[4],100); + SETFLOAT(&atoms[5],15); + if (ac > 1 && IS_A_FLOAT(av,1) ) { + SETFLOAT(&atoms[6],atom_getfloat(av+1)); + } else { + SETFLOAT(&atoms[6],0); + } + if (ac > 2 && IS_A_FLOAT(av,2) ) { + SETFLOAT(&atoms[7],atom_getfloat(av+2)); + } else { + SETFLOAT(&atoms[7],1); + } + SETFLOAT(&atoms[8],0); + SETFLOAT(&atoms[9],0); + SETSYMBOL(&atoms[10],send); + SETSYMBOL(&atoms[11],receive); + SETSYMBOL(&atoms[12],shortpath); + SETFLOAT(&atoms[13],105); + SETFLOAT(&atoms[14],7); + SETFLOAT(&atoms[15],0); + SETFLOAT(&atoms[16],8); + SETFLOAT(&atoms[17],-262144); + SETFLOAT(&atoms[18],-1); + SETFLOAT(&atoms[19],-1); + SETFLOAT(&atoms[20],0); + SETFLOAT(&atoms[21],1); + pd_forwardmess((t_pd*)x->childcanvas, 22, atoms); + pos_y = pos_y + GUI_Y_STEP; + gui_update = 1; + } else if (type == s_tgl) { + SETSYMBOL(&atoms[0],s_obj); + SETFLOAT(&atoms[1],pos_x); + SETFLOAT(&atoms[2],pos_y); + SETSYMBOL(&atoms[3],s_tgl); + SETFLOAT(&atoms[4],15); + SETFLOAT(&atoms[5],0); + SETSYMBOL(&atoms[6],send); + SETSYMBOL(&atoms[7],receive); + SETSYMBOL(&atoms[8],shortpath); + SETFLOAT(&atoms[9],17); + SETFLOAT(&atoms[10],7); + SETFLOAT(&atoms[11],0); + SETFLOAT(&atoms[12],8); + SETFLOAT(&atoms[13],-262144); + SETFLOAT(&atoms[14],1); + SETFLOAT(&atoms[15],-1); + SETFLOAT(&atoms[16],0); + SETFLOAT(&atoms[17],1); + pd_forwardmess((t_pd*)x->childcanvas, 18, atoms); + pos_y = pos_y + GUI_Y_STEP; + gui_update = 1; + + } else if ( type == s_symbolatom || type == s_sym) { + SETSYMBOL(&atoms[0],s_symbolatom); + SETFLOAT(&atoms[1],pos_x); + SETFLOAT(&atoms[2],pos_y); + SETFLOAT(&atoms[3],17); + SETFLOAT(&atoms[4],0); + SETFLOAT(&atoms[5],0); + SETFLOAT(&atoms[6],1); + SETSYMBOL(&atoms[7],shortpath); + SETSYMBOL(&atoms[8],receive); + SETSYMBOL(&atoms[9],send); + pd_forwardmess((t_pd*)x->childcanvas, 10,atoms); + pos_y = pos_y + GUI_Y_STEP; + gui_update = 1; + } else { + SETSYMBOL(&atoms[0],s_text); + SETFLOAT(&atoms[1],pos_x); + SETFLOAT(&atoms[2],pos_y); + SETSYMBOL(&atoms[3],shortpath); + pd_forwardmess((t_pd*)x->childcanvas, 4,atoms); + pos_y = pos_y + GUI_Y_STEP; + gui_update = 0; + } + + if ((gui_update) && (receive != s_empty) && (p->get) && (ac_got)) { + p->get(p->x,&s_got,&ac_got,&av_got); + //post("path: %s selector: %s ac: %i",p->path->s_name,s_got->s_name,ac_got); + + if ( s_got != &s_bang) tof_send_anything_prepend(receive,s_got,ac_got,av_got,s_set); + } + + } + } } p = p->next; @@ -263,6 +294,7 @@ static void paramGui_buildCanvas(t_paramGui* x,int x_position,int y_position) { // Change the build flag x->build = 0; + x->subpath=NULL; // Show canvas t_atom a; @@ -281,6 +313,9 @@ static void paramGui_motion_callback(t_paramGui *x, t_float x_position, t_float } + + + static void paramGui_bang(t_paramGui *x) { if (x->childcanvas && !x->waiting) { @@ -308,9 +343,20 @@ static void paramGui_bang(t_paramGui *x) { } } +static void paramGui_symbol(t_paramGui *x, t_symbol* s) { + if ( x->subpath != NULL && x->subpath != s) x->build = 1; + x->subpath = s; + x->subpath_l = strlen(x->subpath->s_name); + paramGui_bang(x); +} + static void paramGui_reset(t_paramGui *x) { x->build = 1; - paramGui_bang(x); + //paramGui_bang(x); + // Hide canvas + t_atom a; + SETFLOAT(&a,0); + pd_typedmess((t_pd*)x->childcanvas,s_vis,1,&a); } @@ -424,7 +470,7 @@ void paramGui_setup(void) { sizeof(t_paramGui), 0, A_GIMME, 0); class_addbang(paramGui_class, paramGui_bang); - //class_addsymbol(paramGui_class, paramGui_symbol); + class_addsymbol(paramGui_class, paramGui_symbol); // The mouse position callback class_addmethod(paramGui_class, (t_method)paramGui_motion_callback,\ diff --git a/src/tof.h b/src/tof.h index 80c5e0a..7adf800 100644 --- a/src/tof.h +++ b/src/tof.h @@ -148,18 +148,7 @@ static void tof_get_canvas_arguments(t_canvas *canvas, int *ac_p, t_atom **av_p) -// set selector -static void tof_set_selector(t_symbol** selector_sym_p,int* ac_p, t_atom** av_p ) { - if(!(*ac_p)) { - *selector_sym_p = &s_bang; - } else if(IS_A_SYMBOL(*av_p, 0)) { - *selector_sym_p = atom_getsymbol(*av_p); - *ac_p = (*ac_p)-1, - *av_p = (*av_p)+1; - } else{ - *selector_sym_p = &s_list; - } -} + /* static int tof_get_tagged_argument(char tag, int ac, t_atom *av, int *start, int *count) { @@ -257,6 +246,33 @@ static int tof_find_tagged_argument(char tag,t_symbol *name, int ac, t_atom *av, +static void tof_outlet_list_prepend(t_outlet* outlet, t_symbol* s, int argc, t_atom* argv, t_symbol* pp) { + + if (s == &s_list || s == &s_float || s == &s_symbol ) { + int ac = argc + 1; + t_atom *av = (t_atom *)getbytes(ac*sizeof(t_atom)); + tof_copy_atoms(argv,av+1,argc); + SETSYMBOL(av, pp); + outlet_list(outlet,&s_list,ac,av); + freebytes(av, ac*sizeof(t_atom)); + + //outlet_list(outlet,&s_list,argc,argv); + } else if (s == &s_bang ) { + t_atom a; + SETSYMBOL(&a,pp); + outlet_list(outlet,&s_list,1,&a); + } else { + int ac = argc + 2; + t_atom *av = (t_atom *)getbytes(ac*sizeof(t_atom)); + tof_copy_atoms(argv,av+2,argc); + SETSYMBOL(av+1, s); + SETSYMBOL(av, pp); + outlet_list(outlet,&s_list,ac,av); + freebytes(av, ac*sizeof(t_atom)); + //outlet_symbol(outlet,pp); + } +} + static void tof_outlet_anything_prepend(t_outlet* outlet, t_symbol* s, int argc, t_atom* argv, t_symbol* pp) { if (s == &s_list || s == &s_float || s == &s_symbol) { @@ -269,7 +285,9 @@ static void tof_outlet_anything_prepend(t_outlet* outlet, t_symbol* s, int argc, outlet_anything(outlet,pp,ac,av); freebytes(av, ac*sizeof(t_atom)); } else { - outlet_bang(outlet); + //t_atom a; + outlet_anything(outlet,pp,0,NULL); + //outlet_symbol(outlet,pp); } } @@ -279,6 +297,9 @@ static void tof_send_anything_prepend(t_symbol* target,t_symbol* selector, int a if (target->s_thing) { if ( selector == &s_list || selector == &s_float || selector == &s_symbol ) { typedmess(target->s_thing, prepend, ac, av); + } else if ( selector == &s_bang) { + + typedmess(target->s_thing, prepend, 0, NULL); } else { int new_ac = ac + 1; t_atom *new_av = getbytes(new_ac*sizeof(*new_av)); -- cgit v1.2.1