Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2684
Modified Files: Tag: impd_0_37 g_dropper.c Log Message: moving target debuild
Index: g_dropper.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/g_dropper.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -C2 -d -r1.1.2.12 -r1.1.2.13 *** g_dropper.c 3 May 2004 21:18:38 -0000 1.1.2.12 --- g_dropper.c 3 May 2004 23:44:28 -0000 1.1.2.13 *************** *** 21,35 **** #endif
- t_widgetbehavior dropper_widgetbehavior; static t_class *dropper_class;
void dropper_draw(t_dropper *x, t_glist *glist, int mode) { ! if (mode==IEM_GUI_DRAW_MODE_ERASE) ! sys_mgui((t_iemgui *)x,"dropper","erase",""); ! else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"dropper","select","i",x->x_gui.x_selected); ! else { ! pd_upload((t_gobj *)x,glist); ! sys_mgui((t_iemgui *)x,"dropper","draw","");} }
--- 21,28 ---- #endif
static t_class *dropper_class;
void dropper_draw(t_dropper *x, t_glist *glist, int mode) { ! iemgui_draw((t_iemgui *)x,glist,mode,"dropper"); }
*************** *** 50,61 **** t_iemgui *y = (t_iemgui *)x; t_symbol *srl[3]; ! iemgui_save(&x->x_gui, srl,0); binbuf_addv(b, "ssiisiisssiiiiiii", gensym("#X"),gensym("obj"), ! (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, ! gensym("dropper"), x->x_gui.x_w, ! iem_symargstoint(&x->x_gui), srl[0], srl[1], srl[2], ! x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol)); binbuf_addv(b, ";"); --- 43,52 ---- t_iemgui *y = (t_iemgui *)x; t_symbol *srl[3]; ! iemgui_save(y,srl,0); binbuf_addv(b, "ssiisiisssiiiiiii", gensym("#X"),gensym("obj"), ! (t_int)((t_text *)x)->te_xpix,(t_int)((t_text *)x)->te_ypix, ! gensym("dropper"), y->x_w, iem_symargstoint(&x->x_gui), srl[0], srl[1], srl[2], ! y->x_ldx, y->x_ldy, y->x_font_style, y->x_fontsize, convert_color2(y->x_bcol), convert_color2(y->x_fcol), convert_color2(y->x_lcol)); binbuf_addv(b, ";"); *************** *** 75,142 **** }
static void *dropper_new(t_symbol *s, int argc, t_atom *argv) { char buf[50]; - t_dropper *x = (t_dropper *)pd_new(dropper_class); - int bflcol[]={-262144, -196672, -1}; - int a=20; - int ldx=0, ldy=-6, isa=0, fstyle=0, fs=8; - t_symbol *srl[3]={0,0,0}; - if (pd_scanargs(argc,argv,"iiaaaiiiiiii", - &a,&isa,&srl[0],&srl[1],&srl[2], - &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2])) - { - iem_inttosymargs(&x->x_gui, isa); - //iemgui_new_getnames2(&x->x_gui, 2, srl[0], srl[1], srl[2]); - } - else { - post("ei??"); - //iemgui_new_getnames(&x->x_gui, 6, 0); - } - x->x_gui.x_font_style = fstyle; - x->x_gui.x_draw = (t_iemfunptr)dropper_draw; - x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - x->x_gui.x_ldx=ldx; - x->x_gui.x_ldy=ldy; - 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; - if (x->x_gui.x_rcv_able) - pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); sprintf(buf, "d%x", (int)x); x->x_s = gensym(buf); pd_bind(&x->x_gui.x_obj.ob_pd, x->x_s); ! x->x_gui.x_fontsize = MAX(fs,4); ! x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a); ! //iemgui_all_colfromload(&x->x_gui, bflcol); ! x->x_gui.x_locked = 0; ! iemgui_verify_snd_ne_rcv(&x->x_gui); ! outlet_new(&x->x_gui.x_obj, &s_symbol); return x; }
! static void dropper_ff(t_dropper *x) { ! if(x->x_gui.x_rcv_able) ! pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_s); gfxstub_deleteforkey(x); }
void g_dropper_setup(void) { t_class *c = dropper_class = class_new(gensym("dropper"), (t_newmethod)dropper_new, ! (t_method)dropper_ff, sizeof(t_dropper), 0, A_GIMME, 0); class_addbang(c, dropper_bang); class_addsymbol(c, dropper_symbol); ! //class_addmethod(c, (t_method)dropper_reload, gensym("reload"), A_GIMME, 0); ! iemgui_subclass(c); ! dropper_widgetbehavior.w_getrectfn = dropper_getrect; ! dropper_widgetbehavior.w_displacefn = iemgui_displace; ! dropper_widgetbehavior.w_selectfn = iemgui_select; ! dropper_widgetbehavior.w_activatefn = NULL; ! dropper_widgetbehavior.w_deletefn = iemgui_delete; ! dropper_widgetbehavior.w_visfn = iemgui_vis; ! class_setwidget(dropper_class, &dropper_widgetbehavior); ! class_sethelpsymbol(dropper_class, gensym("dropper")); ! class_setsavefn(dropper_class, dropper_save); } --- 66,126 ---- }
+ static void dropper_reload(t_dropper *x, int argc, t_atom *argv) + { + t_iemgui *y = (t_iemgui *)x; + y->x_binbufindex = 2; + int isa=0; + if (!pd_scanargs(argc,argv,"iiaaaiiiiiii", + &y->x_w,&isa,&y->x_snd,&y->x_rcv,&y->x_lab, + &y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize, + &y->x_bcol,&y->x_fcol,&y->x_lcol)) return; + iem_inttosymargs(y,isa); + y->x_h = y->x_w; + y->x_snd_able = y->x_snd!=sym_empty; + y->x_rcv_able = y->x_rcv!=sym_empty; + if (y->x_rcv_able) pd_bind((t_pd *)x, y->x_rcv); + iemgui_constrain(y); + } + static void *dropper_new(t_symbol *s, int argc, t_atom *argv) { + t_iemgui *y = iemgui_new(dropper_class); + t_dropper *x = (t_dropper *)y; + y->x_draw = (t_iemfunptr)dropper_draw; + y->x_locked = 0; char buf[50]; sprintf(buf, "d%x", (int)x); x->x_s = gensym(buf); pd_bind(&x->x_gui.x_obj.ob_pd, x->x_s); ! outlet_new((t_text *)x, &s_symbol); ! dropper_reload(x,argc,argv); return x; }
! static void dropper_free(t_dropper *x) { ! if(x->x_gui.x_rcv_able) pd_unbind((t_pd *)x, x->x_gui.x_rcv); pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_s); gfxstub_deleteforkey(x); }
+ static t_widgetbehavior wb; void g_dropper_setup(void) { t_class *c = dropper_class = class_new(gensym("dropper"), (t_newmethod)dropper_new, ! (t_method)dropper_free, sizeof(t_dropper), 0, A_GIMME, 0); ! iemgui_subclass(c); class_addbang(c, dropper_bang); class_addsymbol(c, dropper_symbol); ! class_addmethod(c, (t_method)dropper_reload, gensym("reload"), A_GIMME, 0); ! wb.w_getrectfn = dropper_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = 0; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = 0; ! class_setwidget(c, &wb); ! class_sethelpsymbol(c, gensym("dropper")); ! class_setsavefn(c, dropper_save); }