Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28189
Modified Files:
Tag: desiredata
desire.c
Log Message:
added object_table method and some more SET()
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.63
retrieving revision 1.1.2.217.2.64
diff -C2 -d -r1.1.2.217.2.63 -r1.1.2.217.2.64
*** desire.c 13 Dec 2006 04:38:58 -0000 1.1.2.217.2.63
--- desire.c 13 Dec 2006 05:58:30 -0000 1.1.2.217.2.64
***************
*** 139,144 ****
hashkey k;
hashvalue v;
! hash_foreach(k,v,self->visual) {free(v);}
! hash_free(self->visual);
manager_nevermind(master);
free(self);
--- 139,146 ----
hashkey k;
hashvalue v;
! if (self->visual) {
! hash_foreach(k,v,self->visual) {free(v);}
! hash_free(self->visual);
! }
manager_nevermind(master);
free(self);
***************
*** 6129,6134 ****
void canvas_atom(t_canvas *gl, t_atomtype type, t_symbol *s, int argc, t_atom *argv) {
t_gatom *x = (t_gatom *)pd_new(gatom_class);
! if (type == A_FLOAT) {x->width = 5; SETFLOAT(&x->atom, 0);}
! else {x->width = 10; SETSYMBOL(&x->atom, &s_symbol);}
x->canvas = gl;
SET(min,0);
--- 6131,6136 ----
void canvas_atom(t_canvas *gl, t_atomtype type, t_symbol *s, int argc, t_atom *argv) {
t_gatom *x = (t_gatom *)pd_new(gatom_class);
! if (type == A_FLOAT) {SET(width, 5); SETFLOAT(&x->atom, 0);}
! else {SET(width,10); SETSYMBOL(&x->atom, &s_symbol);}
x->canvas = gl;
SET(min,0);
***************
*** 6181,6185 ****
binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->x, (t_int)x->y);
} else {
! binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (t_int)x->x, (t_int)x->y);
}
if (x->binbuf) {
--- 6183,6187 ----
binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->x, (t_int)x->y);
} else {
! binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (t_int)x->x, (t_int)x->y);
}
if (x->binbuf) {
***************
*** 6632,6641 ****
static void iemgui_constrain(t_iemgui *x) {
! x->fontsize = max(x->fontsize,4);
! x->h = iemgui_clip_size(x->h);
! x->w = iemgui_clip_size(x->w);
}
! void iemgui_init(t_iemgui *x, t_floatarg f) {x->isa = (x->isa&~1) | !!f;}
void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
--- 6634,6643 ----
static void iemgui_constrain(t_iemgui *x) {
! SET(fontsize,max(x->fontsize,4));
! SET(h,iemgui_clip_size(x->h));
! SET(w,iemgui_clip_size(x->w));
}
! void iemgui_init(t_iemgui *x, t_floatarg f) {SET(isa,(x->isa&~1)|!!f);}
void binbuf_update(t_iemgui *x, t_symbol *qlass, int argc, t_atom *argv) {
***************
*** 6666,6670 ****
}
SET(ftbreak,max(x->ftbreak,10));
! SET(fthold ,max(x->fthold, 50));
}
--- 6668,6672 ----
}
SET(ftbreak,max(x->ftbreak,10));
! SET(fthold ,max(x->fthold, 50));
}
***************
*** 6742,6746 ****
static void toggle_bang(t_toggle *x) {SET(on,x->on?0.0:x->nonzero); toggle_action(x);}
! static void toggle_set(t_toggle *x, t_floatarg f) {SET(on,f); if(f) x->nonzero=f;}
static void toggle_float(t_toggle *x, t_floatarg f) {toggle_set(x,f);if(iemgui_forward(x)) toggle_action(x);}
static void toggle_fout (t_toggle *x, t_floatarg f) {toggle_set(x,f); toggle_action(x);}
--- 6744,6748 ----
static void toggle_bang(t_toggle *x) {SET(on,x->on?0.0:x->nonzero); toggle_action(x);}
! static void toggle_set(t_toggle *x, t_floatarg f) {SET(on,f); if(f) SET(nonzero,f);}
static void toggle_float(t_toggle *x, t_floatarg f) {toggle_set(x,f);if(iemgui_forward(x)) toggle_action(x);}
static void toggle_fout (t_toggle *x, t_floatarg f) {toggle_set(x,f); toggle_action(x);}
***************
*** 6770,6774 ****
SET(on,x->isa&1 && x->on ? x->nonzero : 0.0);
SET(nonzero,argc==14 && IS_A_FLOAT(argv,13) ? atom_getfloatarg(13, argc, argv) : 1.0);
! if (!x->nonzero) x->nonzero=1.0;
iemgui_constrain(x);
if (x->rcv) pd_bind(x,x->rcv);
--- 6772,6776 ----
SET(on,x->isa&1 && x->on ? x->nonzero : 0.0);
SET(nonzero,argc==14 && IS_A_FLOAT(argv,13) ? atom_getfloatarg(13, argc, argv) : 1.0);
! if (!x->nonzero) SET(nonzero,1.0);
iemgui_constrain(x);
if (x->rcv) pd_bind(x,x->rcv);
***************
*** 6904,6908 ****
double span = x->is_log ? log(x->max/x->min) : (x->max - x->min);
if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE;
! if (isvert(x)) {x->h=w;} else {x->w=w;}
if(x->val > m) {SET(pos,m); SET(val,x->pos);}
SET(k,span/l);
--- 6906,6910 ----
double span = x->is_log ? log(x->max/x->min) : (x->max - x->min);
if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE;
! if (isvert(x)) SET(h,w); else SET(w,w);
if(x->val > m) {SET(pos,m); SET(val,x->pos);}
SET(k,span/l);
***************
*** 6955,6960 ****
static void slider_range(t_slider *x, t_float min, t_float max)
{SET(min,min); SET(max,max); slider_check_minmax(x);}
! static void slider_lin(t_slider *x) {x->is_log=0; slider_check_minmax(x);}
! static void slider_log(t_slider *x) {x->is_log=1; slider_check_minmax(x);}
static void slider_steady(t_slider *x, t_floatarg f) {SET(steady,!!f);}
static void slider_float(t_slider *x, t_floatarg f) {slider_set(x,f);if(iemgui_forward(x))slider_bang(x);}
--- 6957,6962 ----
static void slider_range(t_slider *x, t_float min, t_float max)
{SET(min,min); SET(max,max); slider_check_minmax(x);}
! static void slider_lin(t_slider *x) {SET(is_log,0); slider_check_minmax(x);}
! static void slider_log(t_slider *x) {SET(is_log,1); slider_check_minmax(x);}
static void slider_steady(t_slider *x, t_floatarg f) {SET(steady,!!f);}
static void slider_float(t_slider *x, t_floatarg f) {slider_set(x,f);if(iemgui_forward(x))slider_bang(x);}
***************
*** 7068,7072 ****
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));
--- 7070,7074 ----
binbuf_update(x,gensym("nbx"),argc,argv);
if (!nbx_pickle(x,&foo)) return;
! if (!x->isa&1) SET(val,0.0);
iemgui_constrain(x);
SET(w,max(x->w,1));
***************
*** 7130,7135 ****
static float vu_round(float v) {return 0.01*(int)(100.0*v+0.5);}
! static void vu_float0(t_vu *x, t_floatarg v) {SET(rms, vuify(x,v)); x->fr=vu_round(v); outlet_float(x->out_rms, x->fr);}
! static void vu_float1(t_vu *x, t_floatarg v) {SET(peak,vuify(x,v)); x->fp=vu_round(v); outlet_float(x->out_peak,x->fp);}
static void vu_bang(t_vu *x) {
--- 7132,7137 ----
static float vu_round(float v) {return 0.01*(int)(100.0*v+0.5);}
! static void vu_float0(t_vu *x, t_floatarg v) {SET(rms, vuify(x,v)); SET(fr,vu_round(v)); outlet_float(x->out_rms, x->fr);}
! static void vu_float1(t_vu *x, t_floatarg v) {SET(peak,vuify(x,v)); SET(fp,vu_round(v)); outlet_float(x->out_peak,x->fp);}
static void vu_bang(t_vu *x) {
***************
*** 7164,7168 ****
SET(out_rms ,outlet_new(x, &s_float));
SET(out_peak,outlet_new(x, &s_float));
! x->h=IEM_VU_STEPS*3;
SET(scale,1);
SET(rms,0); /* ??? */
--- 7166,7170 ----
SET(out_rms ,outlet_new(x, &s_float));
SET(out_peak,outlet_new(x, &s_float));
! SET(h,IEM_VU_STEPS*3);
SET(scale,1);
SET(rms,0); /* ??? */
***************
*** 7228,7234 ****
SET(fcol,0x000000);
SET(lcol,0x404040);
! x->w=15;
! x->vis_w=100;
! x->vis_h=60;
cnv_reload(x,0,argc,argv);
return x;
--- 7230,7236 ----
SET(fcol,0x000000);
SET(lcol,0x404040);
! SET(w,15);
! SET(vis_w,100);
! SET(vis_h,60);
cnv_reload(x,0,argc,argv);
return x;
***************
*** 7868,7871 ****
--- 7870,7884 ----
};
+ t_hash *object_table;
+
+ void glob_object_table(void) {
+ hashkey k; hashvalue v;
+ post("object_table = {");
+ hash_foreach(k,v,object_table) {
+ post(" %p %ld %s",k,(long)v,((t_pd *)k)->_class->c_name->s_name);
+ }
+ post("} (%d objects)",hash_size(object_table));
+ }
+
extern t_class *glob_pdobject;
extern "C" void glob_init(void) {
***************
*** 7922,7925 ****
--- 7935,7941 ----
class_addmethod3(c,glob_help, "help", "s");
class_addmethod3(c,glob_redraw, "redraw", "");
+
+ class_addmethod3(c,glob_object_table,"object_table","");
+
class_addanything(c, max_default);
pd_bind((t_pd *)&glob_pdobject, gensym("pd"));