Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17753
Modified Files: Tag: impd_0_37 g_hdial.c Log Message: radio buttons are now only one class
Index: g_hdial.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v retrieving revision 1.1.1.4.2.2.2.14 retrieving revision 1.1.1.4.2.2.2.15 diff -C2 -d -r1.1.1.4.2.2.2.14 -r1.1.1.4.2.2.2.15 *** g_hdial.c 1 May 2004 15:38:35 -0000 1.1.1.4.2.2.2.14 --- g_hdial.c 3 May 2004 00:40:48 -0000 1.1.1.4.2.2.2.15 *************** *** 23,36 **** #define IEM_RADIO_MAX 128
! static t_class *hradio_class, *hradio_old_class; ! static t_class *vradio_class, *vradio_old_class;
/* widget helper functions */
static int isvert(t_hradio *x) { ! t_class *c = x->x_gui.x_obj.te_g.g_pd; ! if (c==vradio_class || c==vradio_old_class) return 1; ! if (c==hradio_class || c==hradio_old_class) return 0; ! abort(); }
--- 23,33 ---- #define IEM_RADIO_MAX 128
! static t_class *radio_class; ! static t_symbol *sym_hdl, *sym_vdl, *sym_vradio;
/* widget helper functions */
static int isvert(t_hradio *x) { ! return x->x_flavor == sym_vdl || x->x_flavor == sym_vradio; }
*************** *** 69,78 **** binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"), (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, ! isvert(x) ? ! (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ? ! gensym("vdl") : gensym("vradio")) : ! (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ? ! gensym("hdl") : gensym("hradio")), ! x->x_gui.x_w, x->x_change, iem_symargstoint(&x->x_gui), x->x_number, srl[0], srl[1], srl[2], --- 66,70 ---- binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"), (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, ! x->x_flavor, x->x_gui.x_w, x->x_change, iem_symargstoint(&x->x_gui), x->x_number, srl[0], srl[1], srl[2], *************** *** 152,157 **** static void hradio_bang(t_hradio *x) { ! /* compatibility with earlier "hdial" behavior */ ! if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) { if(x->x_change && x->x_on!=x->x_on_old) --- 144,149 ---- static void hradio_bang(t_hradio *x) { ! /* compatibility with earlier "hdial" behavior */ ! if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl) { if(x->x_change && x->x_on!=x->x_on_old) *************** *** 182,188 **** int i=(int)f; CLAMP(i,0,x->x_number-1); ! if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) { ! /* compatibility with earlier "hdial" behavior */ if(x->x_change && i!=x->x_on_old) { --- 174,180 ---- int i=(int)f; CLAMP(i,0,x->x_number-1); ! if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl) { ! /* compatibility with earlier "hdial" behavior */ if(x->x_change && i!=x->x_on_old) { *************** *** 218,224 **** CLAMP(i,0,x->x_number-1);
! if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class) { ! /* compatibility with earlier "vdial" behavior */ if (x->x_change && i!=x->x_on_old) { --- 210,216 ---- CLAMP(i,0,x->x_number-1);
! if (x->x_flavor == sym_vdl || x->x_flavor == sym_hdl) { ! /* compatibility with earlier "vdial" behavior */ if (x->x_change && i!=x->x_on_old) { *************** *** 309,315 **** static void hradio_single_change(t_hradio *x) {x->x_change = 0;}
! static void *hradio_donew(t_class *qlass, int argc, t_atom *argv) { ! t_hradio *x = (t_hradio *)iemgui_new(qlass); int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE, on=0; --- 301,307 ---- static void hradio_single_change(t_hradio *x) {x->x_change = 0;}
! static void *hradio_new(t_symbol *s, int argc, t_atom *argv) { ! t_hradio *x = (t_hradio *)iemgui_new(radio_class); int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE, on=0; *************** *** 319,322 **** --- 311,316 ---- int isa,fstyle;
+ x->x_flavor = s; + fprintf(stderr,"flavour = %s\n",x->x_flavor->s_name); if(pd_scanargs(argc,argv,"iiiiaaaiiiiiiii", &a,&chg,&isa,&num,&srl[0],&srl[1],&srl[2], *************** *** 329,333 **** x->x_gui.x_font_style = fstyle; x->x_gui.x_draw = (t_iemfunptr)hradio_draw; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); x->x_gui.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; --- 323,326 ---- *************** *** 339,344 **** x->x_on_old = x->x_on; x->x_change = !! chg; ! if (x->x_gui.x_rcv_able) ! pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_fontsize = MAX(fs,4); x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a); --- 332,336 ---- x->x_on_old = x->x_on; x->x_change = !! chg; ! if (x->x_gui.x_rcv_able) pd_bind((t_pd *)x, x->x_gui.x_rcv); x->x_gui.x_fontsize = MAX(fs,4); x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a); *************** *** 349,369 **** }
- static void *hradio_new(t_symbol *s, int argc, t_atom *argv) - {return hradio_donew(hradio_class, argc, argv);} - static void *hdial_new(t_symbol *s, int argc, t_atom *argv) - {return hradio_donew(hradio_old_class, argc, argv);} - static void *vradio_new(t_symbol *s, int argc, t_atom *argv) - {return hradio_donew(vradio_class, argc, argv);} - static void *vdial_new(t_symbol *s, int argc, t_atom *argv) - {return hradio_donew(vradio_old_class, argc, argv);} - static void hradio_ff(t_hradio *x) { ! if(x->x_gui.x_rcv_able) ! pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); }
! static void hradio_methods(t_class *c, t_class *o) { class_addbang(c, hradio_bang); class_addfloat(c, hradio_float); --- 341,356 ---- }
static void hradio_ff(t_hradio *x) { ! if(x->x_gui.x_rcv_able) pd_unbind((t_pd *)x, x->x_gui.x_rcv); gfxstub_deleteforkey(x); }
! static t_widgetbehavior wb; ! void g_hradio_setup(void) ! { ! t_class *c = radio_class = class_new(gensym("radio"), (t_newmethod)hradio_new, ! (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); ! class_addbang(c, hradio_bang); class_addfloat(c, hradio_float); *************** *** 373,410 **** class_addmethod(c, (t_method)hradio_set, gensym("set"), A_FLOAT, 0); class_addmethod(c, (t_method)hradio_size, gensym("size"), A_GIMME, 0); - iemgui_register_class(c); class_addmethod(c, (t_method)hradio_init, gensym("init"), A_FLOAT, 0); class_addmethod(c, (t_method)hradio_number, gensym("number"), A_FLOAT, 0); class_addmethod(c, (t_method)hradio_single_change, gensym("single_change"), 0); class_addmethod(c, (t_method)hradio_double_change, gensym("double_change"), 0); - class_addbang(o, hradio_bang); - class_addfloat(o, hradio_float); - class_addmethod(o, (t_method)hradio_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(o, (t_method)hradio_dialog, gensym("dialog"), A_GIMME, 0); - class_addmethod(o, (t_method)hradio_loadbang, gensym("loadbang"), 0); - class_addmethod(o, (t_method)hradio_set, gensym("set"), A_FLOAT, 0); - class_addmethod(o, (t_method)hradio_size, gensym("size"), A_GIMME, 0); iemgui_register_class(c); - class_addmethod(o, (t_method)hradio_init, gensym("init"), A_FLOAT, 0); - class_addmethod(o, (t_method)hradio_number, gensym("number"), A_FLOAT, 0); - class_addmethod(o, (t_method)hradio_single_change, gensym("single_change"), 0); - class_addmethod(o, (t_method)hradio_double_change, gensym("double_change"), 0); - } - - static t_widgetbehavior wb; - void g_hradio_setup(void) - { - hradio_class = class_new(gensym("hradio"), (t_newmethod)hradio_new, - (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); - vradio_class = class_new(gensym("vradio"), (t_newmethod)vradio_new, - (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); - hradio_old_class = class_new(gensym("hdl"), (t_newmethod)hdial_new, - (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0); - vradio_old_class = class_new(gensym("vdl"), (t_newmethod)vdial_new, - (t_method)hradio_ff, sizeof(t_hradio), 0, A_GIMME, 0);
- hradio_methods(hradio_class,hradio_old_class); - hradio_methods(vradio_class,vradio_old_class); wb.w_getrectfn = hradio_getrect; wb.w_displacefn = iemgui_displace; --- 360,369 ---- *************** *** 415,434 **** wb.w_clickfn = hradio_newclick;
! class_setwidget(hradio_class, &wb); ! class_setwidget(vradio_class, &wb); ! class_sethelpsymbol(hradio_class, gensym("hradio")); ! class_sethelpsymbol(vradio_class, gensym("vradio")); ! class_setsavefn(hradio_class, hradio_save); ! class_setsavefn(vradio_class, hradio_save); ! class_setpropertiesfn(hradio_class, hradio_properties); ! class_setpropertiesfn(vradio_class, hradio_properties);
class_addcreator((t_newmethod)hradio_new, gensym("rdb"), A_GIMME, 0); class_addcreator((t_newmethod)hradio_new, gensym("radiobut"), A_GIMME, 0); class_addcreator((t_newmethod)hradio_new, gensym("radiobutton"), A_GIMME, 0); - class_setwidget(hradio_old_class, &wb); - class_setwidget(vradio_old_class, &wb); - class_sethelpsymbol(hradio_old_class, gensym("hradio")); - class_sethelpsymbol(vradio_old_class, gensym("vradio")); }
--- 374,392 ---- wb.w_clickfn = hradio_newclick;
! sym_hdl = gensym("hdl"); ! sym_vdl = gensym("vdl"); ! sym_vradio = gensym("vradio");
+ class_setwidget(c, &wb); + class_sethelpsymbol(c, gensym("hradio")); + class_setsavefn(c, hradio_save); + class_setpropertiesfn(c, hradio_properties); + class_addcreator((t_newmethod)hradio_new, gensym("hradio"), A_GIMME, 0); + class_addcreator((t_newmethod)hradio_new, gensym("vradio"), A_GIMME, 0); + class_addcreator((t_newmethod)hradio_new, gensym("hdl"), A_GIMME, 0); + class_addcreator((t_newmethod)hradio_new, gensym("vdl"), A_GIMME, 0); class_addcreator((t_newmethod)hradio_new, gensym("rdb"), A_GIMME, 0); class_addcreator((t_newmethod)hradio_new, gensym("radiobut"), A_GIMME, 0); class_addcreator((t_newmethod)hradio_new, gensym("radiobutton"), A_GIMME, 0); }