Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31537
Modified Files: Tag: desiredata desire.c Log Message: renamed functions in [nbx] to something more normal
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.38 retrieving revision 1.1.2.217.2.39 diff -C2 -d -r1.1.2.217.2.38 -r1.1.2.217.2.39 *** desire.c 7 Dec 2006 18:17:43 -0000 1.1.2.217.2.38 --- desire.c 7 Dec 2006 19:16:51 -0000 1.1.2.217.2.39 *************** *** 7172,7180 **** }
! static t_class *nbclass;
! static void nbclip(t_nbx *x) {CLAMP(x->val,x->min,x->max);}
! static int nbcheck_minmax(t_nbx *x) { double min=x->min, max=x->max; int val=(int)x->val; --- 7172,7180 ---- }
! static t_class *nbx_class;
! static void nbx_clip(t_nbx *x) {CLAMP(x->val,x->min,x->max);}
! static int nbx_check_minmax(t_nbx *x) { double min=x->min, max=x->max; int val=(int)x->val; *************** *** 7191,7226 **** }
! static void nbbang(t_nbx *x) { outlet_float(x->ob_outlet, x->val); if(x->snd && x->snd->s_thing) pd_float(x->snd->s_thing, x->val); }
! static void nbset(t_nbx *x, t_floatarg f) {SET(val,f); nbclip(x);} ! static void nbfloat(t_nbx *x, t_floatarg f) {nbset(x, f); if(iemgui_forward(x)) nbbang(x);}
! static void nblog_height(t_nbx *x, t_floatarg lh) { SET(log_height,max(10,(int)lh)); SET(k,x->is_log ? exp(log(x->max/x->min)/(double)(x->log_height)) : 1.0); }
! static void nbsize(t_nbx *x, t_symbol *s, int ac, t_atom *av) { SET(w,max(1,(int)atom_getintarg(0, ac, av))); if(ac > 1) SET(h,max(8,(int)atom_getintarg(1, ac, av))); }
! static void nbrange(t_nbx *x, t_float min, t_float max) ! {SET(min,min); SET(max,max); nbcheck_minmax(x);}
! static void nblin(t_nbx *x) {SET(is_log,0); } ! static void nblog(t_nbx *x) {SET(is_log,1); nbcheck_minmax(x);} ! static void nbloadbang(t_nbx *x) {if(iemgui_loadbang(x)) nbbang(x);}
! static void nblist(t_nbx *x, t_symbol *s, int ac, t_atom *av) { if (!IS_A_FLOAT(av,0)) return; ! nbset(x, atom_getfloatarg(0, ac, av)); ! nbbang(x); }
! static int nbpickle(t_nbx *x, t_foo *foo) { return pd_pickle(foo,"iiddbiaaaiiiicccd;i", &x->w,&x->h,&x->min,&x->max,&x->is_log,&x->isa,&x->snd,&x->rcv,&x->lab, --- 7191,7226 ---- }
! static void nbx_bang(t_nbx *x) { outlet_float(x->ob_outlet, x->val); if(x->snd && x->snd->s_thing) pd_float(x->snd->s_thing, x->val); }
! static void nbx_set(t_nbx *x, t_floatarg f) {SET(val,f); nbx_clip(x);} ! static void nbx_float(t_nbx *x, t_floatarg f) {nbx_set(x, f); if(iemgui_forward(x)) nbx_bang(x);}
! static void nbx_log_height(t_nbx *x, t_floatarg lh) { SET(log_height,max(10,(int)lh)); SET(k,x->is_log ? exp(log(x->max/x->min)/(double)(x->log_height)) : 1.0); }
! static void nbx_size(t_nbx *x, t_symbol *s, int ac, t_atom *av) { SET(w,max(1,(int)atom_getintarg(0, ac, av))); if(ac > 1) SET(h,max(8,(int)atom_getintarg(1, ac, av))); }
! static void nbx_range(t_nbx *x, t_float min, t_float max) ! {SET(min,min); SET(max,max); nbx_check_minmax(x);}
! static void nbx_lin(t_nbx *x) {SET(is_log,0); } ! static void nbx_log(t_nbx *x) {SET(is_log,1); nbx_check_minmax(x);} ! static void nbx_loadbang(t_nbx *x) {if(iemgui_loadbang(x)) nbx_bang(x);}
! static void nbx_list(t_nbx *x, t_symbol *s, int ac, t_atom *av) { if (!IS_A_FLOAT(av,0)) return; ! nbx_set(x, atom_getfloatarg(0, ac, av)); ! nbx_bang(x); }
! static int nbx_pickle(t_nbx *x, t_foo *foo) { return pd_pickle(foo,"iiddbiaaaiiiicccd;i", &x->w,&x->h,&x->min,&x->max,&x->is_log,&x->isa,&x->snd,&x->rcv,&x->lab, *************** *** 7228,7246 **** }
! static void nbsavefn(t_nbx *x, t_binbuf *b) { t_foo foo = {0,0,b}; if (!b) return; pd_savehead(b,x,"nbx"); ! nbpickle(x,&foo); }
! static void nbreload(t_nbx *x, t_symbol *s, int argc, t_atom *argv) { t_foo foo = { argc, argv, 0 }; binbuf_update(x,gensym("nbx"),argc,argv); ! if (!nbpickle(x,&foo)) return; if (!x->isa&1) x->val=0.0; iemgui_constrain(x); SET(w,max(x->w,1)); ! nbcheck_minmax(x); SET(w,max(x->w,1)); if (x->rcv) pd_bind(x,x->rcv); --- 7228,7246 ---- }
! static void nbx_savefn(t_nbx *x, t_binbuf *b) { t_foo foo = {0,0,b}; if (!b) return; pd_savehead(b,x,"nbx"); ! nbx_pickle(x,&foo); }
! static void nbx_reload(t_nbx *x, t_symbol *s, int argc, t_atom *argv) { t_foo foo = { argc, argv, 0 }; binbuf_update(x,gensym("nbx"),argc,argv); ! if (!nbx_pickle(x,&foo)) return; if (!x->isa&1) x->val=0.0; iemgui_constrain(x); SET(w,max(x->w,1)); ! nbx_check_minmax(x); SET(w,max(x->w,1)); if (x->rcv) pd_bind(x,x->rcv); *************** *** 7248,7253 **** }
! static void *nbnew(t_symbol *s, int argc, t_atom *argv) { ! t_nbx *x = (t_nbx *)iemgui_new(nbclass); SET(log_height,256); SET(is_log,0); --- 7248,7253 ---- }
! static void *nbx_new(t_symbol *s, int argc, t_atom *argv) { ! t_nbx *x = (t_nbx *)iemgui_new(nbx_class); SET(log_height,256); SET(is_log,0); *************** *** 7259,7284 **** SET(change,0); outlet_new(x, &s_float); ! nbreload(x,0,argc,argv); return x; }
static void g_numbox_setup(void) { ! t_class *c = nbclass = class_new(gensym("nbx"), (t_newmethod)nbnew, (t_method)iemgui_free, sizeof(t_nbx), 0, A_GIMME, 0); ! class_addcreator((t_newmethod)nbnew, gensym("nbx"), A_GIMME, 0); iemgui_subclass(c); ! class_addbang(c,nbbang); ! class_addfloat(c,nbfloat); ! class_addlist(c, nblist); ! class_addmethod3(c,nbreload,"reload","*"); ! class_addmethod3(c,nbloadbang,"loadbang",""); ! class_addmethod3(c,nbset,"set","f"); ! class_addmethod3(c,nbsize,"size","*"); ! class_addmethod3(c,nbrange,"range","*"); ! class_addmethod3(c,nblog,"log",""); ! class_addmethod3(c,nblin,"lin",""); class_addmethod3(c,iemgui_init,"init","f"); ! class_addmethod3(c,nblog_height,"log_height","f"); ! class_setsavefn(c,(t_savefn)nbsavefn); class_sethelpsymbol(c, gensym("numbox2")); } --- 7259,7284 ---- SET(change,0); outlet_new(x, &s_float); ! nbx_reload(x,0,argc,argv); return x; }
static void g_numbox_setup(void) { ! t_class *c = nbx_class = class_new(gensym("nbx"), (t_newmethod)nbx_new, (t_method)iemgui_free, sizeof(t_nbx), 0, A_GIMME, 0); ! class_addcreator((t_newmethod)nbx_new, gensym("nbx"), A_GIMME, 0); iemgui_subclass(c); ! class_addbang(c,nbx_bang); ! class_addfloat(c,nbx_float); ! class_addlist(c, nbx_list); ! class_addmethod3(c,nbx_reload,"reload","*"); ! class_addmethod3(c,nbx_loadbang,"loadbang",""); ! class_addmethod3(c,nbx_set,"set","f"); ! class_addmethod3(c,nbx_size,"size","*"); ! class_addmethod3(c,nbx_range,"range","*"); ! class_addmethod3(c,nbx_log,"log",""); ! class_addmethod3(c,nbx_lin,"lin",""); class_addmethod3(c,iemgui_init,"init","f"); ! class_addmethod3(c,nbx_log_height,"log_height","f"); ! class_setsavefn(c,(t_savefn)nbx_savefn); class_sethelpsymbol(c, gensym("numbox2")); }