[PD-cvs] pd/src desire.c,1.1.2.208,1.1.2.209
Mathieu Bouchard
matju at users.sourceforge.net
Tue Nov 28 03:19:37 CET 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15605
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
cleanup
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.208
retrieving revision 1.1.2.209
diff -C2 -d -r1.1.2.208 -r1.1.2.209
*** desire.c 28 Nov 2006 01:53:58 -0000 1.1.2.208
--- desire.c 28 Nov 2006 02:19:33 -0000 1.1.2.209
***************
*** 3048,3054 ****
static void canvas_writelist(t_gobj *y, t_binbuf *b) {
! for (; y; y = y->g_next)
! if (y->_class == scalar_class)
! canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec, b, 0);
}
--- 3048,3055 ----
static void canvas_writelist(t_gobj *y, t_binbuf *b) {
! for (; y; y = y->g_next) if (y->_class==scalar_class) {
! t_scalar *z = (t_scalar *)y;
! canvas_writescalar(z->sc_template, z->sc_vec, b, 0);
! }
}
***************
*** 3077,3091 ****
static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec) {
! for (; y; y = y->g_next)
! if (y->_class == scalar_class)
! canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
! ((t_scalar *)y)->sc_vec, p_ntemplates, p_templatevec);
}
! static t_binbuf *canvas_writetobinbuf(t_canvas *x, int wholething) {
t_symbol **templatevec = (t_symbol **)getbytes(0);
int ntemplates = 0;
t_binbuf *b = binbuf_new();
! canvas_each(y,x) if (y->_class==scalar_class && wholething) {
t_scalar *s = (t_scalar *)y;
canvas_addtemplatesforscalar(s->sc_template, s->sc_vec, &ntemplates, &templatevec);
--- 3078,3092 ----
static void canvas_addtemplatesforlist(t_gobj *y, int *p_ntemplates, t_symbol ***p_templatevec) {
! for (; y; y = y->g_next) if (y->_class == scalar_class) {
! t_scalar *z = (t_scalar *)y;
! canvas_addtemplatesforscalar(z->sc_template, z->sc_vec, p_ntemplates, p_templatevec);
! }
}
! static t_binbuf *canvas_writetobinbuf(t_canvas *x) {
t_symbol **templatevec = (t_symbol **)getbytes(0);
int ntemplates = 0;
t_binbuf *b = binbuf_new();
! canvas_each(y,x) if (y->_class==scalar_class) {
t_scalar *s = (t_scalar *)y;
canvas_addtemplatesforscalar(s->sc_template, s->sc_vec, &ntemplates, &templatevec);
***************
*** 3114,3120 ****
binbuf_addsemi(b);
/* now write out the objects themselves */
! canvas_each(y,x)
! if (y->_class==scalar_class && wholething)
! canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec, b, 0);
return b;
}
--- 3115,3122 ----
binbuf_addsemi(b);
/* now write out the objects themselves */
! canvas_each(y,x) if (y->_class==scalar_class) {
! t_scalar *z = (t_scalar *)y;
! canvas_writescalar(z->sc_template, z->sc_vec, b, 0);
! }
return b;
}
***************
*** 3127,3131 ****
if (!strcmp(format->s_name, "cr")) cr = 1;
else if (*format->s_name) pd_error(x,"canvas_write: unknown flag: %s", format->s_name);
! t_binbuf *b = canvas_writetobinbuf(x, 1);
if (b) {
if (binbuf_write(b, buf, "", cr)) pd_error(x,"%s: write failed", filename->s_name);
--- 3129,3133 ----
if (!strcmp(format->s_name, "cr")) cr = 1;
else if (*format->s_name) pd_error(x,"canvas_write: unknown flag: %s", format->s_name);
! t_binbuf *b = canvas_writetobinbuf(x);
if (b) {
if (binbuf_write(b, buf, "", cr)) pd_error(x,"%s: write failed", filename->s_name);
***************
*** 3168,3173 ****
canvas_each(y,x) gobj_save(y, b);
canvas_wires_each(oc,t,x) {
! int from = canvas_getindex(x, (t_gobj *)t.from);
! int to = canvas_getindex(x, (t_gobj *)t.to);
binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"), from, t.outlet, to, t.inlet);
appendix_save((t_gobj *)oc,b);
--- 3170,3175 ----
canvas_each(y,x) gobj_save(y, b);
canvas_wires_each(oc,t,x) {
! int from = canvas_getindex(x,t.from);
! int to = canvas_getindex(x,t.to);
binbuf_addv(b, "ssiiii;", gensym("#X"), gensym("connect"), from, t.outlet, to, t.inlet);
appendix_save((t_gobj *)oc,b);
***************
*** 3178,3196 ****
/* call this recursively to collect all the template names for a canvas or for the selection. */
static void canvas_collecttemplatesfor(t_canvas *x, int *ntemplatesp,
! t_symbol ***templatevecp, int wholething) {
canvas_each(y,x) {
! if (y->_class==scalar_class && wholething)
! canvas_addtemplatesforscalar(((t_scalar *)y)->sc_template,
! ((t_scalar *)y)->sc_vec, ntemplatesp, templatevecp);
! else if (y->_class==canvas_class && wholething)
! canvas_collecttemplatesfor((t_canvas *)y, ntemplatesp, templatevecp, 1);
}
}
/* save the templates needed by a canvas to a binbuf. */
! static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething) {
t_symbol **templatevec = (t_symbol **)getbytes(0);
int ntemplates = 0;
! canvas_collecttemplatesfor(x, &ntemplates, &templatevec, wholething);
for (int i=0; i < ntemplates; i++) {
t_template *t = template_findbyname(templatevec[i]);
--- 3180,3199 ----
/* call this recursively to collect all the template names for a canvas or for the selection. */
static void canvas_collecttemplatesfor(t_canvas *x, int *ntemplatesp,
! t_symbol ***templatevecp) {
canvas_each(y,x) {
! if (y->_class==scalar_class) {
! t_scalar *z = (t_scalar *)y;
! canvas_addtemplatesforscalar(z->sc_template, z->sc_vec, ntemplatesp, templatevecp);
! } else if (y->_class==canvas_class) {
! canvas_collecttemplatesfor((t_canvas *)y, ntemplatesp, templatevecp);
! }
}
}
/* save the templates needed by a canvas to a binbuf. */
! static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b) {
t_symbol **templatevec = (t_symbol **)getbytes(0);
int ntemplates = 0;
! canvas_collecttemplatesfor(x, &ntemplates, &templatevec);
for (int i=0; i < ntemplates; i++) {
t_template *t = template_findbyname(templatevec[i]);
***************
*** 3227,3231 ****
t_binbuf *b = binbuf_new();
int dsp_status = canvas_suspend_dsp();
! canvas_savetemplatesto(x, b, 1);
canvas_saveto(x, b);
if (binbuf_write(b, filename->s_name, dir->s_name, 0)) {
--- 3230,3234 ----
t_binbuf *b = binbuf_new();
int dsp_status = canvas_suspend_dsp();
! canvas_savetemplatesto(x, b);
canvas_saveto(x, b);
if (binbuf_write(b, filename->s_name, dir->s_name, 0)) {
***************
*** 3235,3239 ****
if (!x->owner) canvas_rename(x, filename, dir);
post("saved to: %s/%s", dir->s_name, filename->s_name);
! canvas_reload(filename, dir, (t_gobj *)x);
}
binbuf_free(b);
--- 3238,3242 ----
if (!x->owner) canvas_rename(x, filename, dir);
post("saved to: %s/%s", dir->s_name, filename->s_name);
! canvas_reload(filename,dir,x);
}
binbuf_free(b);
***************
*** 4136,4146 ****
template_conformwords(tfrom, tto, conformaction, scfrom->sc_vec, x->sc_vec);
/* replace the old one with the new one in the list */
! if (canvas->list == (t_gobj *)scfrom) {
! canvas->list = (t_gobj *)x;
x->g_next = scfrom->g_next;
} else {
! for (t_gobj *y2, *y = canvas->list; (y2 = y->g_next); y = y2) if (y2 == (t_gobj *)scfrom) {
x->g_next = y2->g_next;
! y->g_next = (t_gobj *)x;
goto nobug;
}
--- 4139,4149 ----
template_conformwords(tfrom, tto, conformaction, scfrom->sc_vec, x->sc_vec);
/* replace the old one with the new one in the list */
! if (canvas->list == scfrom) {
! canvas->list = x;
x->g_next = scfrom->g_next;
} else {
! for (t_gobj *y2, *y = canvas->list; (y2 = y->g_next); y = y2) if (y2 == scfrom) {
x->g_next = y2->g_next;
! y->g_next = x;
goto nobug;
}
***************
*** 4201,4210 ****
canvas_each(g,canvas) {
t_class *c = g->_class;
! if (c==scalar_class)
! g = (t_gobj *)template_conformscalar(tfrom, tto, conformaction, canvas, (t_scalar *)g);
! else if (c==canvas_class)
! template_conformcanvas(tfrom, tto, conformaction, (t_canvas *)g);
! else if (c==garray_class)
! template_conformarray(tfrom, tto, conformaction, garray_getarray((t_garray *)g));
}
}
--- 4204,4211 ----
canvas_each(g,canvas) {
t_class *c = g->_class;
! /* what's the purpose of the assignment here?... consult original code */
! if (c==scalar_class) g = template_conformscalar(tfrom, tto, conformaction, canvas, (t_scalar *)g);
! else if (c==canvas_class) template_conformcanvas(tfrom, tto, conformaction, (t_canvas *)g);
! else if (c==garray_class) template_conformarray(tfrom, tto, conformaction, garray_getarray((t_garray *)g));
}
}
***************
*** 5783,5792 ****
scalar to erase. When graphics updates become queueable this may fall apart... */
if (gs->gs_which == GP_GLIST) {
! if (canvas_isvisible(gs->gs_un.gs_glist)) sys_mgui((t_gobj *)(gp->gp_un.gp_scalar),"delete","");
} else {
t_array *o = gs->gs_un.gs_array;
while (STUB(o)->gs_which == GP_ARRAY) o = STUB(o)->gs_un.gs_array;
! if (canvas_isvisible(STUB(o)->gs_un.gs_glist))
! sys_mgui((t_gobj *)(o->gp.gp_un.gp_scalar), "delete","");
}
--- 5784,5792 ----
scalar to erase. When graphics updates become queueable this may fall apart... */
if (gs->gs_which == GP_GLIST) {
! if (canvas_isvisible(gs->gs_un.gs_glist)) sys_mgui(gp->gp_un.gp_scalar,"delete","");
} else {
t_array *o = gs->gs_un.gs_array;
while (STUB(o)->gs_which == GP_ARRAY) o = STUB(o)->gs_un.gs_array;
! if (canvas_isvisible(STUB(o)->gs_un.gs_glist)) sys_mgui(o->gp.gp_un.gp_scalar, "delete","");
}
***************
*** 6310,6314 ****
outlet_new(t, type == A_FLOAT ? &s_float: &s_symbol);
if (argc >= 2) gatom_reload(x,&s_,argc-2,argv+2);
! canvas_add(gl, (t_gobj *)x);
}
--- 6310,6314 ----
outlet_new(t, type == A_FLOAT ? &s_float: &s_symbol);
if (argc >= 2) gatom_reload(x,&s_,argc-2,argv+2);
! canvas_add(gl,x);
}
***************
*** 6371,6376 ****
} else {
int xwas = x->te_xpix, ywas = x->te_ypix;
! canvas_stowconnections(canvas_getcanvas(canvas), (t_gobj *)x);
! canvas_delete(canvas, (t_gobj *)x);
canvas_objtext(canvas, xwas, ywas, 0, b);
/* if it's an abstraction loadbang it here */
--- 6371,6376 ----
} else {
int xwas = x->te_xpix, ywas = x->te_ypix;
! canvas_stowconnections(canvas_getcanvas(canvas),x);
! canvas_delete(canvas,x);
canvas_objtext(canvas, xwas, ywas, 0, b);
/* if it's an abstraction loadbang it here */
***************
*** 6402,6406 ****
t_text *o;
if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
! canvas_delete(x,(t_gobj *)o);
gobj_changed(x,0);
}
--- 6402,6406 ----
t_text *o;
if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
! canvas_delete(x,o);
gobj_changed(x,0);
}
***************
*** 6709,6718 ****
char *bar=foo; *foo=0;
canvas_each(y,can) bar+=sprintf(bar,"x%lx ",(long)y);
! sys_mgui((t_gobj *)self,"children=","S",foo);
bar=foo; *foo=0;
canvas_wires_each(oc,t,can) bar+=sprintf(bar,"{%ld %ld %ld %ld} ",
! (long)canvas_getindex(can,(t_gobj *)t.from), (long)t.outlet,
! (long)canvas_getindex(can,(t_gobj *)t.to), (long)t.inlet);
! sys_mgui((t_gobj *)self,"wires=","S",foo);
sys_mgui(self,"name=","s",can->name);
sys_mgui(self,"folder=","s",canvas_getenv(can)->dir);
--- 6709,6718 ----
char *bar=foo; *foo=0;
canvas_each(y,can) bar+=sprintf(bar,"x%lx ",(long)y);
! sys_mgui(self,"children=","S",foo);
bar=foo; *foo=0;
canvas_wires_each(oc,t,can) bar+=sprintf(bar,"{%ld %ld %ld %ld} ",
! (long)canvas_getindex(can,t.from), (long)t.outlet,
! (long)canvas_getindex(can,t.to), (long)t.inlet);
! sys_mgui(self,"wires=","S",foo);
sys_mgui(self,"name=","s",can->name);
sys_mgui(self,"folder=","s",canvas_getenv(can)->dir);
***************
*** 6885,6889 ****
x->count = 0;
bng_check_minmax(x);
! outlet_new((t_text *)x, &s_bang);
bng_reload(x,0,argc,argv);
return x;
--- 6885,6889 ----
x->count = 0;
bng_check_minmax(x);
! outlet_new(x, &s_bang);
bng_reload(x,0,argc,argv);
return x;
***************
*** 6972,6976 ****
x->on=0.0;
x->nonzero=1.0;
! outlet_new((t_text *)x, &s_float);
toggle_reload(x,0,argc,argv);
return x;
--- 6972,6976 ----
x->on=0.0;
x->nonzero=1.0;
! outlet_new(x, &s_float);
toggle_reload(x,0,argc,argv);
return x;
***************
*** 7063,7067 ****
CLAMP(n,1,128);
if(n != x->number) {
! sys_mgui((t_gobj *)x,"erase","");
x->number = n;
CLAMP(x->on,0,x->number-1);
--- 7063,7067 ----
CLAMP(n,1,128);
if(n != x->number) {
! sys_mgui(x,"erase","");
x->number = n;
CLAMP(x->on,0,x->number-1);
***************
*** 7108,7112 ****
CLAMP(x->on,0,x->number-1);
x->on_old = x->on = x->isa&1 ? x->on : 0;
! outlet_new((t_text *)x, &s_list);
radio_reload(x,0,argc,argv);
return x;
--- 7108,7112 ----
CLAMP(x->on,0,x->number-1);
x->on_old = x->on = x->isa&1 ? x->on : 0;
! outlet_new(x, &s_list);
radio_reload(x,0,argc,argv);
return x;
***************
*** 7241,7245 ****
x->max=(double)(IEM_SL_DEFAULTSIZE-1);
if (isvert(x)) x->h=IEM_SL_DEFAULTSIZE; else x->w=IEM_SL_DEFAULTSIZE;
! outlet_new((t_text *)x, &s_float);
slider_reload(x,0,argc,argv);
return x;
--- 7241,7245 ----
x->max=(double)(IEM_SL_DEFAULTSIZE-1);
if (isvert(x)) x->h=IEM_SL_DEFAULTSIZE; else x->w=IEM_SL_DEFAULTSIZE;
! outlet_new(x, &s_float);
slider_reload(x,0,argc,argv);
return x;
***************
*** 7361,7365 ****
x->buf[0]=0;
x->change = 0;
! outlet_new((t_text *)x, &s_float);
nbreload(x,0,argc,argv);
return x;
--- 7361,7365 ----
x->buf[0]=0;
x->change = 0;
! outlet_new(x, &s_float);
nbreload(x,0,argc,argv);
return x;
***************
*** 7461,7466 ****
static void *vu_new(t_symbol *s, int argc, t_atom *argv) {
t_vu *x = (t_vu *)iemgui_new(vu_class);
! x->out_rms = outlet_new((t_text *)x, &s_float);
! x->out_peak = outlet_new((t_text *)x, &s_float);
x->h=IEM_VU_STEPS*3;
x->scale = 1;
--- 7461,7466 ----
static void *vu_new(t_symbol *s, int argc, t_atom *argv) {
t_vu *x = (t_vu *)iemgui_new(vu_class);
! x->out_rms = outlet_new(x, &s_float);
! x->out_peak = outlet_new(x, &s_float);
x->h=IEM_VU_STEPS*3;
x->scale = 1;
***************
*** 7468,7472 ****
x->fp = x->fr = -101.0;
vu_check_height(x, x->h);
! inlet_new((t_text *)x, (t_pd *)x, &s_float, gensym("ft1"));
vu_reload(x,0,argc,argv);
return x;
--- 7468,7472 ----
x->fp = x->fr = -101.0;
vu_check_height(x, x->h);
! inlet_new(x, (t_pd *)x, &s_float, gensym("ft1"));
vu_reload(x,0,argc,argv);
return x;
***************
*** 7491,7496 ****
static void cnv_get_pos(t_cnv *x) {
if(x->snd && x->snd->s_thing) {
! x->at[0].a_w.w_float = text_xpix((t_text *)x, x->canvas);
! x->at[1].a_w.w_float = text_ypix((t_text *)x, x->canvas);
pd_list(x->snd->s_thing, &s_list, 2, x->at);
}
--- 7491,7496 ----
static void cnv_get_pos(t_cnv *x) {
if(x->snd && x->snd->s_thing) {
! x->at[0].a_w.w_float = text_xpix(x, x->canvas);
! x->at[1].a_w.w_float = text_ypix(x, x->canvas);
pd_list(x->snd->s_thing, &s_list, 2, x->at);
}
***************
*** 7589,7593 ****
static void *dropper_new(t_symbol *s, int argc, t_atom *argv) {
t_dropper *x = (t_dropper *) iemgui_new(dropper_class);
! outlet_new((t_text *)x, &s_symbol);
dropper_reload(x,0,argc,argv);
return x;
--- 7589,7593 ----
static void *dropper_new(t_symbol *s, int argc, t_atom *argv) {
t_dropper *x = (t_dropper *) iemgui_new(dropper_class);
! outlet_new(x, &s_symbol);
dropper_reload(x,0,argc,argv);
return x;
More information about the Pd-cvs
mailing list