Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28739
Modified Files: Tag: impd_0_37 g_all_guis.c g_bang.c g_dropper.c g_graph.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c g_template.c g_toggle.c g_vumeter.c g_all_guis.h g_canvas.h u_main.tk u_object.tk Log Message: deleting 400 lines
Index: g_toggle.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_toggle.c,v retrieving revision 1.1.1.3.2.2.2.11 retrieving revision 1.1.1.3.2.2.2.12 diff -C2 -d -r1.1.1.3.2.2.2.11 -r1.1.1.3.2.2.2.12 *** g_toggle.c 8 Apr 2004 10:48:12 -0000 1.1.1.3.2.2.2.11 --- g_toggle.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.2.2.12 *************** *** 3,8 **** * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
--- 3,9 ---- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_toggle.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ + /* Copyright 2004 by Mathieu Bouchard */
*************** *** 23,27 **** #endif
- t_widgetbehavior toggle_widgetbehavior; static t_class *toggle_class;
--- 24,27 ---- *************** *** 29,33 **** if (mode==IEM_GUI_DRAW_MODE_ERASE) sys_mgui((t_iemgui *)x,"toggle","erase",""); else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"toggle","select","i",x->x_gui.x_fsf.x_selected); else { pd_upload((t_gobj *)x,glist); --- 29,33 ---- if (mode==IEM_GUI_DRAW_MODE_ERASE) sys_mgui((t_iemgui *)x,"toggle","erase",""); else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"toggle","select","i",x->x_gui.x_selected); else { pd_upload((t_gobj *)x,glist); *************** *** 54,65 **** iemgui_save(&x->x_gui, srl, bflcol); binbuf_addv(b, "ssiisiisssiiiiiiiff", gensym("#X"),gensym("obj"), ! (t_int)x->x_gui.x_obj.te_xpix, ! (t_int)x->x_gui.x_obj.te_ypix, ! gensym("tgl"), x->x_gui.x_w, ! iem_symargstoint(&x->x_gui.x_isa), ! srl[0], srl[1], srl[2], ! x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, ! bflcol[0], bflcol[1], bflcol[2], x->x_on, x->x_nonzero); binbuf_addv(b, ";"); } --- 54,63 ---- iemgui_save(&x->x_gui, srl, bflcol); binbuf_addv(b, "ssiisiisssiiiiiiiff", gensym("#X"),gensym("obj"), ! (t_int)x->x_gui.x_obj.te_xpix, ! (t_int)x->x_gui.x_obj.te_ypix, ! gensym("tgl"), x->x_gui.x_w, iem_symargstoint(&x->x_gui.x_isa), ! 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, ! bflcol[0], bflcol[1], bflcol[2], x->x_on, x->x_nonzero); binbuf_addv(b, ";"); } *************** *** 70,74 **** char buf[800]; t_symbol *srl[3]; - iemgui_properties(&x->x_gui, srl); sprintf(buf, "pdtk_iemgui_dialog %%s TOGGLE \ --- 68,71 ---- *************** *** 76,83 **** -----------non-zero-value:----------- %g value: 0.0 empty %g \ -1 lin log %d %d empty %d \ ! %s %s \ ! %s %d %d \ ! %d %d \ ! %d %d %d\n", x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_nonzero, 1.0,/*non_zero-schedule*/ --- 73,77 ---- -----------non-zero-value:----------- %g value: 0.0 empty %g \ -1 lin log %d %d empty %d \ ! %s %s %s %d %d %d %d %d %d %d\n", x->x_gui.x_w, IEM_GUI_MINSIZE, x->x_nonzero, 1.0,/*non_zero-schedule*/ *************** *** 85,100 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); }
static void toggle_bang(t_toggle *x) { x->x_on = (x->x_on==0.0)?x->x_nonzero:0.0; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); ! outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) ! pd_float(x->x_gui.x_snd->s_thing, x->x_on); }
--- 79,98 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); }
+ static void toggle_action(t_toggle *x) { + outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); + if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) + pd_float(x->x_gui.x_snd->s_thing, x->x_on); + } + static void toggle_bang(t_toggle *x) { x->x_on = (x->x_on==0.0)?x->x_nonzero:0.0; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); ! toggle_action(x); }
*************** *** 104,115 **** int a = (int)atom_getintarg(0, argc, argv); float nonzero = (float)atom_getfloatarg(2, argc, argv); - int sr_flags; if(nonzero == 0.0) nonzero = 1.0; x->x_nonzero = nonzero; if(x->x_on != 0.0) x->x_on = x->x_nonzero; ! sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_w = iemgui_clip_size(a); x->x_gui.x_h = x->x_gui.x_w; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } --- 102,112 ---- int a = (int)atom_getintarg(0, argc, argv); float nonzero = (float)atom_getfloatarg(2, argc, argv); if(nonzero == 0.0) nonzero = 1.0; x->x_nonzero = nonzero; if(x->x_on != 0.0) x->x_on = x->x_nonzero; ! iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_w = iemgui_clip_size(a); x->x_gui.x_h = x->x_gui.x_w; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } *************** *** 130,134 **** if(f != 0.0) x->x_nonzero = f; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); }
--- 127,131 ---- if(f != 0.0) x->x_nonzero = f; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
*************** *** 136,145 **** { toggle_set(x, f); ! if(x->x_gui.x_fsf.x_put_in2out) ! { ! outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) ! pd_float(x->x_gui.x_snd->s_thing, x->x_on); ! } }
--- 133,137 ---- { toggle_set(x, f); ! if(x->x_gui.x_put_in2out) toggle_action(x); }
*************** *** 147,153 **** { toggle_set(x, f); ! outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) ! pd_float(x->x_gui.x_snd->s_thing, x->x_on); }
--- 139,143 ---- { toggle_set(x, f); ! toggle_action(x); }
*************** *** 162,166 **** x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; ! iemgui_size((void *)x, &x->x_gui); }
--- 152,156 ---- x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; ! iemgui_size((t_iemgui *)x); }
*************** *** 173,187 **** static void *toggle_new(t_symbol *s, int argc, t_atom *argv) { ! t_toggle *x = (t_toggle *)pd_new(toggle_class); int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE; ! int ldx=0, ldy=-6, isa=0, fstyle=0, fs=8; float on=0.0, nonzero=1.0; t_symbol *srl[3]={0,0,0}; pd_scanargs(argc,argv,"iiaaaiiiiiiii;?", &a,&isa,&srl[0],&srl[1],&srl[2], ! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on); iem_inttosymargs(&x->x_gui.x_isa, isa); ! iem_inttofstyle(&x->x_gui.x_fsf, fstyle); iemgui_new_getnames2(&x->x_gui, 2, srl[0], srl[1], srl[2]); if((argc == 14)&&IS_A_FLOAT(argv,13)) --- 163,177 ---- static void *toggle_new(t_symbol *s, int argc, t_atom *argv) { ! t_toggle *x = (t_toggle *)iemgui_new(toggle_class); int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE; ! int isa=0, fstyle=0, fs=8; float on=0.0, nonzero=1.0; t_symbol *srl[3]={0,0,0}; pd_scanargs(argc,argv,"iiaaaiiiiiiii;?", &a,&isa,&srl[0],&srl[1],&srl[2], ! &x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on); iem_inttosymargs(&x->x_gui.x_isa, isa); ! x->x_gui.x_font_style = fstyle; iemgui_new_getnames2(&x->x_gui, 2, srl[0], srl[1], srl[2]); if((argc == 14)&&IS_A_FLOAT(argv,13)) *************** *** 189,200 **** x->x_gui.x_draw = (t_iemfunptr)toggle_draw; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); x->x_nonzero = (nonzero!=0.0)?nonzero:1.0; x->x_on = x->x_gui.x_isa.x_loadinit ? (on!=0.0)?nonzero:0.0 : 0.0; ! if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); ! x->x_gui.x_ldx = ldx; ! x->x_gui.x_ldy = ldy; x->x_gui.x_fontsize = MAX(fs,4); x->x_gui.x_fontsize = fs; --- 179,188 ---- x->x_gui.x_draw = (t_iemfunptr)toggle_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; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); x->x_nonzero = (nonzero!=0.0)?nonzero:1.0; x->x_on = x->x_gui.x_isa.x_loadinit ? (on!=0.0)?nonzero:0.0 : 0.0; ! 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_fontsize = fs; *************** *** 208,216 **** static void toggle_ff(t_toggle *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); }
void g_toggle_setup(void) { --- 196,205 ---- static void toggle_ff(t_toggle *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 t_widgetbehavior wb; void g_toggle_setup(void) { *************** *** 232,243 **** class_addmethod(c, (t_method)toggle_init, gensym("init"), A_FLOAT, 0); class_addmethod(c, (t_method)toggle_nonzero, gensym("nonzero"), A_FLOAT, 0); ! toggle_widgetbehavior.w_getrectfn = toggle_getrect; ! toggle_widgetbehavior.w_displacefn = iemgui_displace; ! toggle_widgetbehavior.w_selectfn = iemgui_select; ! toggle_widgetbehavior.w_activatefn = NULL; ! toggle_widgetbehavior.w_deletefn = iemgui_delete; ! toggle_widgetbehavior.w_visfn = iemgui_vis; ! toggle_widgetbehavior.w_clickfn = toggle_newclick; ! class_setwidget(c, &toggle_widgetbehavior); class_sethelpsymbol(c, gensym("toggle")); class_setsavefn(c, toggle_save); --- 221,232 ---- class_addmethod(c, (t_method)toggle_init, gensym("init"), A_FLOAT, 0); class_addmethod(c, (t_method)toggle_nonzero, gensym("nonzero"), A_FLOAT, 0); ! wb.w_getrectfn = toggle_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = toggle_newclick; ! class_setwidget(c, &wb); class_sethelpsymbol(c, gensym("toggle")); class_setsavefn(c, toggle_save);
Index: g_hdial.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v retrieving revision 1.1.1.4.2.2.2.11 retrieving revision 1.1.1.4.2.2.2.12 diff -C2 -d -r1.1.1.4.2.2.2.11 -r1.1.1.4.2.2.2.12 *** g_hdial.c 8 Apr 2004 10:48:11 -0000 1.1.1.4.2.2.2.11 --- g_hdial.c 27 Apr 2004 18:09:34 -0000 1.1.1.4.2.2.2.12 *************** *** 2,8 **** * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! ! /* hdial.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
/* name change to hradio by MSP (it's a radio button really) and changed to --- 2,8 ---- * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! /* g_hdial.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ + /* Copyright 2004 by Mathieu Bouchard */
/* name change to hradio by MSP (it's a radio button really) and changed to *************** *** 21,25 **** #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
- t_widgetbehavior hradio_widgetbehavior; static t_class *hradio_class, *hradio_old_class; static t_class *vradio_class, *vradio_old_class; --- 21,24 ---- *************** *** 39,43 **** sys_mgui((t_iemgui *)x,"radio","erase",""); } else if (mode==IEM_GUI_DRAW_MODE_SELECT) { ! sys_mgui((t_iemgui *)x,"radio","select","i",x->x_gui.x_fsf.x_selected); } else { pd_upload((t_gobj *)x,glist); --- 38,42 ---- sys_mgui((t_iemgui *)x,"radio","erase",""); } else if (mode==IEM_GUI_DRAW_MODE_SELECT) { ! sys_mgui((t_iemgui *)x,"radio","select","i",x->x_gui.x_selected); } else { pd_upload((t_gobj *)x,glist); *************** *** 77,81 **** srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[1], bflcol[2], x->x_on); binbuf_addv(b, ";"); --- 76,80 ---- 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, bflcol[0], bflcol[1], bflcol[2], x->x_on); binbuf_addv(b, ";"); *************** *** 98,102 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); --- 97,101 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); *************** *** 109,122 **** int chg = (int)atom_getintarg(4, argc, argv); int num = (int)atom_getintarg(6, argc, argv); - int sr_flags;
if(chg != 0) chg = 1; x->x_change = chg; ! sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_w = iemgui_clip_size(a); x->x_gui.x_h = x->x_gui.x_w; if(x->x_number != num) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE); x->x_number = num; if(x->x_on >= x->x_number) --- 108,120 ---- int chg = (int)atom_getintarg(4, argc, argv); int num = (int)atom_getintarg(6, argc, argv);
if(chg != 0) chg = 1; x->x_change = chg; ! iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_w = iemgui_clip_size(a); x->x_gui.x_h = x->x_gui.x_w; if(x->x_number != num) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE); x->x_number = num; if(x->x_on >= x->x_number) *************** *** 125,135 **** x->x_on_old = x->x_on; } - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); - } - else - { - (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); - canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } }
--- 123,129 ---- x->x_on_old = x->x_on; } } + x->x_gui.x_draw(x, x->x_gui.x_glist, 0); + canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); }
*************** *** 142,149 **** if(x->x_on != x->x_on_old) { - old = x->x_on_old; x->x_on_old = x->x_on; x->x_on = i; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = old; } --- 136,142 ---- if(x->x_on != x->x_on_old) { x->x_on_old = x->x_on; x->x_on = i; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); x->x_on_old = old; } *************** *** 151,155 **** { x->x_on = i; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } --- 144,148 ---- { x->x_on = i; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } } *************** *** 165,169 **** SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } --- 158,162 ---- SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } *************** *** 172,176 **** SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } --- 165,169 ---- SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } *************** *** 178,182 **** { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_on); } --- 171,175 ---- { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_on); } *************** *** 187,211 **** 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)) { SETFLOAT(x->x_at, (float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } ! if(x->x_on != x->x_on_old) ! x->x_on_old = x->x_on; x->x_on = i; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; SETFLOAT(x->x_at, (float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } --- 180,202 ---- 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) { SETFLOAT(x->x_at, (float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } ! x->x_on_old = x->x_on; x->x_on = i; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); x->x_on_old = x->x_on; SETFLOAT(x->x_at, (float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } *************** *** 213,219 **** { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_on); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; } --- 204,210 ---- { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on = i); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_on); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); x->x_on_old = x->x_on; } *************** *** 227,253 **** 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)) { ! if(x->x_gui.x_fsf.x_put_in2out) { SETFLOAT(x->x_at, (float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } } ! if(x->x_on != x->x_on_old) ! x->x_on_old = x->x_on; x->x_on = i; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; ! if(x->x_gui.x_fsf.x_put_in2out) { SETFLOAT(x->x_at, (float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } --- 218,243 ---- 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) { ! if(x->x_gui.x_put_in2out) { SETFLOAT(x->x_at, (float)x->x_on_old); SETFLOAT(x->x_at+1, 0.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } } ! x->x_on_old = x->x_on; x->x_on = i; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); x->x_on_old = x->x_on; ! if(x->x_gui.x_put_in2out) { SETFLOAT(x->x_at, (float)x->x_on); SETFLOAT(x->x_at+1, 1.0); outlet_list(x->x_gui.x_obj.ob_outlet, &s_list, 2, x->x_at); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at); } *************** *** 256,266 **** { x->x_on = i; ! if (x->x_gui.x_fsf.x_put_in2out) { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_on); } ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_on_old = x->x_on; } --- 246,256 ---- { x->x_on = i; ! if (x->x_gui.x_put_in2out) { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_on); } ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); x->x_on_old = x->x_on; } *************** *** 273,277 **** ((int)ypos - (int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist))/x->x_gui.x_h : ((int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))/x->x_gui.x_h; ! hradio_fout(x, (float)(val)); }
--- 263,267 ---- ((int)ypos - (int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist))/x->x_gui.x_h : ((int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))/x->x_gui.x_h; ! hradio_fout(x, (float)val); }
*************** *** 301,305 **** CLAMP(x->x_on,0,x->x_number-1); x->x_on_old = x->x_on; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW); } } --- 291,295 ---- CLAMP(x->x_on,0,x->x_number-1); x->x_on_old = x->x_on; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } } *************** *** 307,313 **** static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av) { ! x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); ! x->x_gui.x_h = x->x_gui.x_w; ! iemgui_size((void *)x, &x->x_gui); }
--- 297,302 ---- static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av) { ! x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); ! iemgui_size((t_iemgui *)x); }
*************** *** 318,347 **** static void hradio_single_change(t_hradio *x) {x->x_change = 0;}
! static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, t_hradio *x) { int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE, on=0; ! int ldx=0, ldy=-6, chg=1, num=8; int fs=8; t_symbol *srl[3]={0,0,0}; int isa,fstyle;
- iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0); - if(pd_scanargs(argc,argv,"iiiiaaaiiiiiiii", &a,&chg,&isa,&num,&srl[0],&srl[1],&srl[2], ! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on)) { iem_inttosymargs(&x->x_gui.x_isa, isa); iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]); - iem_inttofstyle(&x->x_gui.x_fsf, fstyle); } else iemgui_new_getnames(&x->x_gui, 4, 0); x->x_gui.x_draw = (t_iemfunptr)hradio_draw; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); CLAMP(num,1,IEM_RADIO_MAX); x->x_number = num; --- 307,334 ---- 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; ! int chg=1, num=8; int fs=8; t_symbol *srl[3]={0,0,0}; int isa,fstyle;
if(pd_scanargs(argc,argv,"iiiiaaaiiiiiiii", &a,&chg,&isa,&num,&srl[0],&srl[1],&srl[2], ! &x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on)) { iem_inttosymargs(&x->x_gui.x_isa, isa); iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]); } else iemgui_new_getnames(&x->x_gui, 4, 0); + 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; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); CLAMP(num,1,IEM_RADIO_MAX); x->x_number = num; *************** *** 350,360 **** x->x_on_old = x->x_on; x->x_change = !! chg; ! if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; x->x_gui.x_fontsize = MAX(fs,4); ! x->x_gui.x_w = iemgui_clip_size(a); ! x->x_gui.x_h = x->x_gui.x_w; iemgui_verify_snd_ne_rcv(&x->x_gui); iemgui_all_colfromload(&x->x_gui, bflcol); --- 337,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); iemgui_verify_snd_ne_rcv(&x->x_gui); iemgui_all_colfromload(&x->x_gui, bflcol); *************** *** 364,378 ****
static void *hradio_new(t_symbol *s, int argc, t_atom *argv) ! {return hradio_donew(s, argc, argv, (t_hradio *)pd_new(hradio_class));} static void *hdial_new(t_symbol *s, int argc, t_atom *argv) ! {return hradio_donew(s, argc, argv, (t_hradio *)pd_new(hradio_old_class));} static void *vradio_new(t_symbol *s, int argc, t_atom *argv) ! {return hradio_donew(s, argc, argv, (t_hradio *)pd_new(vradio_class));} static void *vdial_new(t_symbol *s, int argc, t_atom *argv) ! {return hradio_donew(s, argc, argv, (t_hradio *)pd_new(vradio_old_class));}
static void hradio_ff(t_hradio *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); --- 348,362 ----
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); *************** *** 407,410 **** --- 391,395 ---- }
+ static t_widgetbehavior wb; void g_hradio_setup(void) { *************** *** 420,433 **** hradio_methods(hradio_class,hradio_old_class); hradio_methods(vradio_class,vradio_old_class); ! hradio_widgetbehavior.w_getrectfn = hradio_getrect; ! hradio_widgetbehavior.w_displacefn = iemgui_displace; ! hradio_widgetbehavior.w_selectfn = iemgui_select; ! hradio_widgetbehavior.w_activatefn = NULL; ! hradio_widgetbehavior.w_deletefn = iemgui_delete; ! hradio_widgetbehavior.w_visfn = iemgui_vis; ! hradio_widgetbehavior.w_clickfn = hradio_newclick;
! class_setwidget(hradio_class, &hradio_widgetbehavior); ! class_setwidget(vradio_class, &hradio_widgetbehavior); class_sethelpsymbol(hradio_class, gensym("hradio")); class_sethelpsymbol(vradio_class, gensym("vradio")); --- 405,418 ---- hradio_methods(hradio_class,hradio_old_class); hradio_methods(vradio_class,vradio_old_class); ! wb.w_getrectfn = hradio_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! 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")); *************** *** 440,445 **** 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, &hradio_widgetbehavior); ! class_setwidget(vradio_old_class, &hradio_widgetbehavior); class_sethelpsymbol(hradio_old_class, gensym("hradio")); class_sethelpsymbol(vradio_old_class, gensym("vradio")); --- 425,430 ---- 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"));
Index: g_template.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_template.c,v retrieving revision 1.1.1.3.2.2.2.1 retrieving revision 1.1.1.3.2.2.2.2 diff -C2 -d -r1.1.1.3.2.2.2.1 -r1.1.1.3.2.2.2.2 *** g_template.c 1 Apr 2004 23:22:02 -0000 1.1.1.3.2.2.2.1 --- g_template.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.2.2.2 *************** *** 809,816 **** for (i = 0, f = x->x_vec; i < n; i++, f += 2) { ! int xloc = glist_xtopixels(glist, ! basex + fielddesc_getfloat(f, template, data, 0)); ! int yloc = glist_ytopixels(glist, ! basey + fielddesc_getfloat(f+1, template, data, 0)); if (xloc < x1) x1 = xloc; if (xloc > x2) x2 = xloc; --- 809,814 ---- for (i = 0, f = x->x_vec; i < n; i++, f += 2) { ! int xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(f, template, data, 0)); ! int yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(f+1, template, data, 0)); if (xloc < x1) x1 = xloc; if (xloc > x2) x2 = xloc; *************** *** 896,903 **** for (i = 0, f = x->x_vec; i < n; i++, f += 2) { ! float xloc = glist_xtopixels(glist, ! basex + fielddesc_getfloat(f, template, data, 1)); ! float yloc = glist_ytopixels(glist, ! basey + fielddesc_getfloat(f+1, template, data, 1)); sys_vgui("%d %d\\n", (int)xloc, (int)yloc); } --- 894,899 ---- for (i = 0, f = x->x_vec; i < n; i++, f += 2) { ! float xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(f, template, data, 1)); ! float yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(f+1, template, data, 1)); sys_vgui("%d %d\\n", (int)xloc, (int)yloc); } *************** *** 971,978 **** for (i = 0, f = x->x_vec; i < n; i++, f += 2) { ! int xloc = glist_xtopixels(glist, ! basex + fielddesc_getfloat(f, template, data, 0)); ! int yloc = glist_ytopixels(glist, ! basey + fielddesc_getfloat(f+1, template, data, 0)); int xerr = xloc - xpix, yerr = yloc - ypix; if (!f->fd_var && !(f+1)->fd_var) --- 967,972 ---- for (i = 0, f = x->x_vec; i < n; i++, f += 2) { ! int xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(f, template, data, 0)); ! int yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(f+1, template, data, 0)); int xerr = xloc - xpix, yerr = yloc - ypix; if (!f->fd_var && !(f+1)->fd_var) *************** *** 996,1003 **** if (doit) { ! curve_motion_xper = glist_pixelstox(glist, 1) ! - glist_pixelstox(glist, 0); ! curve_motion_yper = glist_pixelstoy(glist, 1) ! - glist_pixelstoy(glist, 0); curve_motion_xcumulative = curve_motion_ycumulative = 0; curve_motion_glist = glist; --- 990,995 ---- if (doit) { ! curve_motion_xper = glist_pixelstox(glist, 1) - glist_pixelstox(glist, 0); ! curve_motion_yper = glist_pixelstoy(glist, 1) - glist_pixelstoy(glist, 0); curve_motion_xcumulative = curve_motion_ycumulative = 0; curve_motion_glist = glist; *************** *** 1031,1040 **** (t_method)curve_free, sizeof(t_curve), CLASS_NOINLET, A_GIMME, 0); class_setdrawcommand(curve_class); ! class_addcreator((t_newmethod)curve_new, gensym("drawcurve"), ! A_GIMME, 0); ! class_addcreator((t_newmethod)curve_new, gensym("filledpolygon"), ! A_GIMME, 0); ! class_addcreator((t_newmethod)curve_new, gensym("filledcurve"), ! A_GIMME, 0); class_setparentwidget(curve_class, &curve_widgetbehavior); } --- 1023,1029 ---- (t_method)curve_free, sizeof(t_curve), CLASS_NOINLET, A_GIMME, 0); class_setdrawcommand(curve_class); ! class_addcreator((t_newmethod)curve_new, gensym("drawcurve"), A_GIMME, 0); ! class_addcreator((t_newmethod)curve_new, gensym("filledpolygon"), A_GIMME, 0); ! class_addcreator((t_newmethod)curve_new, gensym("filledcurve"), A_GIMME, 0); class_setparentwidget(curve_class, &curve_widgetbehavior); } *************** *** 1066,1081 **** argc--, argv++; } if (argc) fielddesc_setarrayarg(&x->x_data, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_data, 1); if (argc) fielddesc_setfloatarg(&x->x_outlinecolor, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_outlinecolor, 0); if (argc) fielddesc_setfloatarg(&x->x_width, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_width, 1); if (argc) fielddesc_setfloatarg(&x->x_xloc, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_xloc, 1); if (argc) fielddesc_setfloatarg(&x->x_yloc, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_yloc, 1); if (argc) fielddesc_setfloatarg(&x->x_xinc, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_xinc, 1); x->x_flags = flags; return (x); --- 1055,1070 ---- argc--, argv++; } + FIELDDESC_SETFLOAT(&x->x_data, 1); + FIELDDESC_SETFLOAT(&x->x_outlinecolor, 0); + FIELDDESC_SETFLOAT(&x->x_width, 1); + FIELDDESC_SETFLOAT(&x->x_xloc, 1); + FIELDDESC_SETFLOAT(&x->x_yloc, 1); + FIELDDESC_SETFLOAT(&x->x_xinc, 1); if (argc) fielddesc_setarrayarg(&x->x_data, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_outlinecolor, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_width, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_xloc, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_yloc, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_xinc, argc--, argv++); x->x_flags = flags; return (x); *************** *** 1151,1163 **** } elemsize = elemtemplate->t_n * sizeof(t_word); ! if (!template_find_field(elemtemplate, gensym("y"), &yonset, &type, &dummy) ! || type != DT_FLOAT) ! yonset = -1; ! if (!template_find_field(elemtemplate, gensym("x"), &xonset, &type, &dummy) ! || type != DT_FLOAT) ! xonset = -1; ! if (!template_find_field(elemtemplate, gensym("w"), &wonset, &type, &dummy) ! || type != DT_FLOAT) ! wonset = -1;
/* fill in slots for return values */ --- 1140,1146 ---- } elemsize = elemtemplate->t_n * sizeof(t_word); ! if (!template_find_field(elemtemplate, gensym("y"), &yonset, &type, &dummy) || type != DT_FLOAT) yonset = -1; ! if (!template_find_field(elemtemplate, gensym("x"), &xonset, &type, &dummy) || type != DT_FLOAT) xonset = -1; ! if (!template_find_field(elemtemplate, gensym("w"), &wonset, &type, &dummy) || type != DT_FLOAT) wonset = -1;
/* fill in slots for return values */ *************** *** 1487,1503 **** flags |= DRAW_SYMBOL; x->x_flags = flags; if (argc) fielddesc_setfloatarg(&x->x_value, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_value, 0); if (argc) fielddesc_setfloatarg(&x->x_xloc, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_xloc, 0); if (argc) fielddesc_setfloatarg(&x->x_yloc, argc--, argv++); - else FIELDDESC_SETFLOAT(&x->x_yloc, 0); if (argc) fielddesc_setfloatarg(&x->x_color, argc--, argv++); ! else FIELDDESC_SETFLOAT(&x->x_color, 1); ! if (argc) ! x->x_label = atom_getsymbolarg(0, argc, argv); ! else x->x_label = &s_; ! ! return (x); }
--- 1470,1484 ---- flags |= DRAW_SYMBOL; x->x_flags = flags; + FIELDDESC_SETFLOAT(&x->x_value, 0); + FIELDDESC_SETFLOAT(&x->x_xloc, 0); + FIELDDESC_SETFLOAT(&x->x_yloc, 0); + FIELDDESC_SETFLOAT(&x->x_color, 1); + x->x_label = &s_; if (argc) fielddesc_setfloatarg(&x->x_value, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_xloc, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_yloc, argc--, argv++); if (argc) fielddesc_setfloatarg(&x->x_color, argc--, argv++); ! if (argc) x->x_label = atom_getsymbolarg(0, argc, argv); ! return x; }
*************** *** 1520,1527 **** t_drawnumber *x = (t_drawnumber *)z; t_atom at; ! int xloc = glist_xtopixels(glist, ! basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); ! int yloc = glist_ytopixels(glist, ! basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); int font = glist_getfont(glist); int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); --- 1501,1506 ---- t_drawnumber *x = (t_drawnumber *)z; t_atom at; ! int xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); ! int yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); int font = glist_getfont(glist); int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); *************** *** 1568,1575 **** { t_atom at; ! int xloc = glist_xtopixels(glist, ! basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); ! int yloc = glist_ytopixels(glist, ! basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); char colorstring[20], buf[DRAWNUMBER_BUFSIZE]; numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1), --- 1547,1552 ---- { t_atom at; ! int xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); ! int yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); char colorstring[20], buf[DRAWNUMBER_BUFSIZE]; numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1),
Index: g_canvas.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_canvas.h,v retrieving revision 1.1.1.4.2.4.2.1 retrieving revision 1.1.1.4.2.4.2.2 diff -C2 -d -r1.1.1.4.2.4.2.1 -r1.1.1.4.2.4.2.2 *** g_canvas.h 3 Apr 2004 23:10:25 -0000 1.1.1.4.2.4.2.1 --- g_canvas.h 27 Apr 2004 18:09:35 -0000 1.1.1.4.2.4.2.2 *************** *** 231,237 **** --- 231,239 ---- int tr_nin; int tr_inno; + #ifndef MATJU1 int tr_x11, tr_y11, tr_x12, tr_y12; int tr_x21, tr_y21, tr_x22, tr_y22; int tr_lx1, tr_ly1, tr_lx2, tr_ly2; + #endif t_outconnect *tr_nextoc; int tr_nextoutno;
Index: g_all_guis.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_all_guis.c,v retrieving revision 1.1.1.4.2.4.2.18 retrieving revision 1.1.1.4.2.4.2.19 diff -C2 -d -r1.1.1.4.2.4.2.18 -r1.1.1.4.2.4.2.19 *** g_all_guis.c 8 Apr 2004 10:48:11 -0000 1.1.1.4.2.4.2.18 --- g_all_guis.c 27 Apr 2004 18:09:34 -0000 1.1.1.4.2.4.2.19 *************** *** 3,8 **** * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
--- 3,9 ---- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_all_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ + /* Copyright 2004 by Mathieu Bouchard */
*************** *** 41,63 **** /*------------------ global functions -------------------------*/
- /*!@#$ should move that to Tcl */ - int pd_bluify(int colour) { - int r = (colour>>16) & 0xff; - int g = (colour>>8) & 0xff; - int b = (colour>>0) & 0xff; - r=(r*0xbb)>>8; - g=(g*0xe4)>>8; - return (r<<16)|(g<<8)|(b<<0); - } - - /*!@#$ should move that to Tcl */ - int pd_darker(int colour) { - int r = (colour>>16) & 0xff; - int g = (colour>>8) & 0xff; - int b = (colour>>0) & 0xff; - r=r*3/4; g=g*3/4; b=b*3/4; - return (r<<16)|(g<<8)|(b<<0); - } - void iemgui_set_font_style(t_iemgui *self, int f) { if(f == 1) strcpy(self->x_font, "helvetica"); --- 42,45 ---- *************** *** 67,71 **** strcpy(self->x_font, "courier"); } ! self->x_fsf.x_font_style = f; }
--- 49,53 ---- strcpy(self->x_font, "courier"); } ! self->x_font_style = f; }
*************** *** 93,127 **** t_symbol *iemgui_raute2dollar(t_symbol *s) { ! if (s->s_name[0] == '#') ! { ! char buf[MAXPDSTRING]; ! strncpy(buf, s->s_name, MAXPDSTRING); ! buf[MAXPDSTRING-1] = 0; ! buf[0] = '$'; ! return (gensym(buf)); ! } ! else return (s); }
t_symbol *iemgui_dollar2raute(t_symbol *s) { ! if (s->s_name[0] == '$') ! { ! char buf[MAXPDSTRING]; ! strncpy(buf, s->s_name, MAXPDSTRING); ! buf[MAXPDSTRING-1] = 0; ! buf[0] = '#'; ! return (gensym(buf)); ! } ! else return (s); }
void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui) { ! iemgui->x_fsf.x_put_in2out = 1; ! if(iemgui->x_fsf.x_snd_able && iemgui->x_fsf.x_rcv_able) { ! if(!strcmp(iemgui->x_snd->s_name, iemgui->x_rcv->s_name)) ! iemgui->x_fsf.x_put_in2out = 0; } } --- 75,102 ---- t_symbol *iemgui_raute2dollar(t_symbol *s) { ! char buf[MAXPDSTRING]; ! if (s->s_name[0]!='#') return s; ! strncpy(buf, s->s_name, MAXPDSTRING); ! buf[MAXPDSTRING-1] = 0; ! buf[0] = '$'; ! return gensym(buf); }
t_symbol *iemgui_dollar2raute(t_symbol *s) { ! char buf[MAXPDSTRING]; ! if (s->s_name[0]!='$') return s; ! strncpy(buf, s->s_name, MAXPDSTRING); ! buf[MAXPDSTRING-1] = 0; ! buf[0] = '#'; ! return gensym(buf); }
void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui) { ! iemgui->x_put_in2out = 1; ! if(iemgui->x_snd_able && iemgui->x_rcv_able) { ! iemgui->x_put_in2out = strcmp(iemgui->x_snd->s_name, iemgui->x_rcv->s_name); } } *************** *** 201,210 **** void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym) { ! iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded, ! iemgui->x_binbufindex+1, iemgui->x_snd); ! iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded, ! iemgui->x_binbufindex+2, iemgui->x_rcv); ! iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded, ! iemgui->x_labelbindex, iemgui->x_lab); srlsym[0] = iemgui->x_snd_unexpanded; srlsym[1] = iemgui->x_rcv_unexpanded; --- 176,182 ---- void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym) { ! iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded, iemgui->x_binbufindex+1, iemgui->x_snd); ! iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded, iemgui->x_binbufindex+2, iemgui->x_rcv); ! iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded, iemgui->x_labelbindex, iemgui->x_lab); srlsym[0] = iemgui->x_snd_unexpanded; srlsym[1] = iemgui->x_rcv_unexpanded; *************** *** 212,278 **** }
! void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym) ! { ! /* delete this function */ }
void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol) { ! bflcol[0] = -1 - (((0xfc0000 & iemgui->x_bcol) >> 6)| ! ((0xfc00 & iemgui->x_bcol) >> 4)|((0xfc & iemgui->x_bcol) >> 2)); ! bflcol[1] = -1 - (((0xfc0000 & iemgui->x_fcol) >> 6)| ! ((0xfc00 & iemgui->x_fcol) >> 4)|((0xfc & iemgui->x_fcol) >> 2)); ! bflcol[2] = -1 - (((0xfc0000 & iemgui->x_lcol) >> 6)| ! ((0xfc00 & iemgui->x_lcol) >> 4)|((0xfc & iemgui->x_lcol) >> 2)); }
void iemgui_all_colfromload(t_iemgui *iemgui, int *bflcol) { ! if(bflcol[0] < 0) ! { ! bflcol[0] = -1 - bflcol[0]; ! iemgui->x_bcol = ((bflcol[0] & 0x3f000) << 6)|((bflcol[0] & 0xfc0) << 4)| ! ((bflcol[0] & 0x3f) << 2); ! } ! else ! { ! bflcol[0] = iemgui_modulo_color(bflcol[0]); ! iemgui->x_bcol = iemgui_color_hex[bflcol[0]]; ! } ! if(bflcol[1] < 0) ! { ! bflcol[1] = -1 - bflcol[1]; ! iemgui->x_fcol = ((bflcol[1] & 0x3f000) << 6)|((bflcol[1] & 0xfc0) << 4)| ! ((bflcol[1] & 0x3f) << 2); ! } ! else ! { ! bflcol[1] = iemgui_modulo_color(bflcol[1]); ! iemgui->x_fcol = iemgui_color_hex[bflcol[1]]; ! } ! if(bflcol[2] < 0) ! { ! bflcol[2] = -1 - bflcol[2]; ! iemgui->x_lcol = ((bflcol[2] & 0x3f000) << 6)|((bflcol[2] & 0xfc0) << 4)| ! ((bflcol[2] & 0x3f) << 2); ! } ! else ! { ! bflcol[2] = iemgui_modulo_color(bflcol[2]); ! iemgui->x_lcol = iemgui_color_hex[bflcol[2]]; ! } }
int iemgui_compatible_col(int i) { ! int j; ! ! if(i >= 0) ! { ! j = iemgui_modulo_color(i); ! return(iemgui_color_hex[(j)]); ! } ! else ! return((-1 -i)&0xffffff); }
--- 184,214 ---- }
! static int convert_color2(int x) { ! return ~ (((0xfc0000&x)>>6) | ((0xfc00&x)>>4) | ((0xfc&x)>>2)); }
void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol) { ! bflcol[0] = convert_color2(iemgui->x_bcol); ! bflcol[1] = convert_color2(iemgui->x_fcol); ! bflcol[2] = convert_color2(iemgui->x_lcol); ! } ! ! static int convert_color(int x) { ! if (x>=0) return iemgui_color_hex[iemgui_modulo_color(x)]; ! x=~x; ! return ((x&0x3f000)<<6) | ((x&0xfc0)<<4) | ((x&0x3f)<<2); }
void iemgui_all_colfromload(t_iemgui *iemgui, int *bflcol) { ! iemgui->x_bcol = convert_color(bflcol[0]); ! iemgui->x_fcol = convert_color(bflcol[1]); ! iemgui->x_lcol = convert_color(bflcol[2]); }
int iemgui_compatible_col(int i) { ! return i>=0 ? iemgui_color_hex[iemgui_modulo_color(i)] : (~i)&0xffffff; }
*************** *** 291,302 **** }
! void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s) { t_symbol *snd; - int sndable=1, oldsndrcvable=0; - - if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; - if(iemgui->x_fsf.x_snd_able) oldsndrcvable += IEM_GUI_OLD_SND_FLAG; - if(!strcmp(s->s_name, "empty")) sndable = 0; snd = iemgui_raute2dollar(s); iemgui->x_snd_unexpanded = snd; --- 227,233 ---- }
! void iemgui_send(t_iemgui *iemgui, t_symbol *s) { t_symbol *snd; snd = iemgui_raute2dollar(s); iemgui->x_snd_unexpanded = snd; *************** *** 304,319 **** post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name, iemgui->x_snd->s_name); ! iemgui->x_fsf.x_snd_able = sndable; iemgui_verify_snd_ne_rcv(iemgui); ! (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable); }
! void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s) { t_symbol *rcv; ! int rcvable=1, oldsndrcvable=0; ! ! if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; ! if(iemgui->x_fsf.x_snd_able) oldsndrcvable += IEM_GUI_OLD_SND_FLAG; if(!strcmp(s->s_name, "empty")) rcvable = 0; rcv = iemgui_raute2dollar(s); --- 235,247 ---- post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name, iemgui->x_snd->s_name); ! iemgui->x_snd_able = strcmp(s->s_name, "empty"); iemgui_verify_snd_ne_rcv(iemgui); ! iemgui->x_draw(iemgui, iemgui->x_glist, 0); }
! void iemgui_receive(t_iemgui *iemgui, t_symbol *s) { t_symbol *rcv; ! int rcvable=1; if(!strcmp(s->s_name, "empty")) rcvable = 0; rcv = iemgui_raute2dollar(s); *************** *** 324,328 **** if(strcmp(rcv->s_name, iemgui->x_rcv->s_name)) { ! if(iemgui->x_fsf.x_rcv_able) pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); iemgui->x_rcv = rcv; --- 252,256 ---- if(strcmp(rcv->s_name, iemgui->x_rcv->s_name)) { ! if(iemgui->x_rcv_able) pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); iemgui->x_rcv = rcv; *************** *** 330,355 **** } } ! else if(!rcvable && iemgui->x_fsf.x_rcv_able) { pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); iemgui->x_rcv = rcv; } ! iemgui->x_fsf.x_rcv_able = rcvable; iemgui_verify_snd_ne_rcv(iemgui); ! (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable); }
! void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s) { t_symbol *lab = iemgui_raute2dollar(s); iemgui->x_lab_unexpanded = lab; iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab); ! if(glist_isvisible(iemgui->x_glist)) ! sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n", ! glist_getcanvas(iemgui->x_glist), x, ! strcmp(s->s_name, "empty")?iemgui->x_lab->s_name:""); }
! void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_ldx = (int)atom_getintarg(0, ac, av); --- 258,280 ---- } } ! else if(!rcvable && iemgui->x_rcv_able) { pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); iemgui->x_rcv = rcv; } ! iemgui->x_rcv_able = rcvable; iemgui_verify_snd_ne_rcv(iemgui); ! iemgui->x_draw(iemgui, iemgui->x_glist, 0); }
! void iemgui_label(t_iemgui *iemgui, t_symbol *s) { t_symbol *lab = iemgui_raute2dollar(s); iemgui->x_lab_unexpanded = lab; iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab); ! if(glist_isvisible(iemgui->x_glist)) iemgui->x_draw(iemgui,iemgui->x_glist,0); }
! void iemgui_label_pos(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_ldx = (int)atom_getintarg(0, ac, av); *************** *** 357,386 **** if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c coords %xLABEL %d %d\n", ! glist_getcanvas(iemgui->x_glist), x, iemgui->x_obj.te_xpix+iemgui->x_ldx, iemgui->x_obj.te_ypix+iemgui->x_ldy); }
! void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { ! int f = (int)atom_getintarg(1, ac, av); ! if(f < 4) f = 4; iemgui->x_fontsize = f; iemgui_set_font_style(iemgui, (int)atom_getintarg(0, ac, av)); if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n", ! glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, iemgui->x_fontsize); }
! void iemgui_size(void *x, t_iemgui *iemgui) { if(glist_isvisible(iemgui->x_glist)) { ! (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE); ! canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x); } }
! void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_obj.te_xpix += (int)atom_getintarg(0, ac, av); --- 282,310 ---- if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c coords %xLABEL %d %d\n", ! glist_getcanvas(iemgui->x_glist), iemgui, iemgui->x_obj.te_xpix+iemgui->x_ldx, iemgui->x_obj.te_ypix+iemgui->x_ldy); }
! void iemgui_label_font(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { ! int f = MAX(4,(int)atom_getintarg(1, ac, av)); iemgui->x_fontsize = f; iemgui_set_font_style(iemgui, (int)atom_getintarg(0, ac, av)); if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n", ! glist_getcanvas(iemgui->x_glist), iemgui, iemgui->x_font, iemgui->x_fontsize); }
! void iemgui_size(t_iemgui *iemgui) { if(glist_isvisible(iemgui->x_glist)) { ! iemgui->x_draw(iemgui, iemgui->x_glist, 0); ! canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)iemgui); } }
! void iemgui_delta(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_obj.te_xpix += (int)atom_getintarg(0, ac, av); *************** *** 388,397 **** if(glist_isvisible(iemgui->x_glist)) { ! (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE); ! canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x); } }
! void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av); --- 312,321 ---- if(glist_isvisible(iemgui->x_glist)) { ! iemgui->x_draw(iemgui, iemgui->x_glist, 0); ! canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)iemgui); } }
! void iemgui_pos(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av); *************** *** 399,408 **** if(glist_isvisible(iemgui->x_glist)) { ! (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE); ! canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x); } }
! void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av)); --- 323,332 ---- if(glist_isvisible(iemgui->x_glist)) { ! iemgui->x_draw(iemgui, iemgui->x_glist, 0); ! canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)iemgui); } }
! void iemgui_color(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av)); *************** *** 415,428 **** iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(1, ac, av)); if(glist_isvisible(iemgui->x_glist)) ! (*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_CONFIG); }
void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy) { ! t_iemguidummy *x = (t_iemguidummy *)z; ! ! x->x_gui.x_obj.te_xpix += dx; ! x->x_gui.x_obj.te_ypix += dy; ! (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_MOVE); canvas_fixlinesfor(glist_getcanvas(glist), (t_text *)z); } --- 339,351 ---- iemgui->x_lcol = iemgui_compatible_col(atom_getintarg(1, ac, av)); if(glist_isvisible(iemgui->x_glist)) ! iemgui->x_draw(iemgui, iemgui->x_glist, 0); }
void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy) { ! t_iemgui *x = (t_iemgui *)z; ! x->x_obj.te_xpix += dx; ! x->x_obj.te_ypix += dy; ! x->x_draw((void *)z, glist, 0); canvas_fixlinesfor(glist_getcanvas(glist), (t_text *)z); } *************** *** 430,437 **** void iemgui_select(t_gobj *z, t_glist *glist, int selected) { ! t_iemguidummy *x = (t_iemguidummy *)z; ! ! x->x_gui.x_fsf.x_selected = selected; ! (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT); }
--- 353,359 ---- void iemgui_select(t_gobj *z, t_glist *glist, int selected) { ! t_iemgui *x = (t_iemgui *)z; ! x->x_selected = selected; ! x->x_draw((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT); }
*************** *** 443,452 **** void iemgui_vis(t_gobj *z, t_glist *glist, int vis) { ! t_iemguidummy *x = (t_iemguidummy *)z; ! ! if (vis) ! (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_NEW); ! else ! (*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_ERASE); }
--- 365,369 ---- void iemgui_vis(t_gobj *z, t_glist *glist, int vis) { ! ((t_iemgui *)z)->x_draw(z, glist, vis ? 0 : IEM_GUI_DRAW_MODE_ERASE); }
*************** *** 471,512 **** int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv) { ! char str[144]; ! int init = (int)atom_getintarg(5, argc, argv); ! int ldx = (int)atom_getintarg(10, argc, argv); ! int ldy = (int)atom_getintarg(11, argc, argv); ! int f = (int)atom_getintarg(12, argc, argv); ! int fs = (int)atom_getintarg(13, argc, argv); ! int bcol = (int)atom_getintarg(14, argc, argv); ! int fcol = (int)atom_getintarg(15, argc, argv); ! int lcol = (int)atom_getintarg(16, argc, argv); ! int sndable=1, rcvable=1, oldsndrcvable=0; ! ! if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; ! if(iemgui->x_fsf.x_snd_able) oldsndrcvable += IEM_GUI_OLD_SND_FLAG; ! if(IS_A_SYMBOL(argv,7)) ! srl[0] = atom_getsymbolarg(7, argc, argv); ! else if(IS_A_FLOAT(argv,7)) ! { ! sprintf(str, "%d", (int)atom_getintarg(7, argc, argv)); ! srl[0] = gensym(str); ! } ! if(IS_A_SYMBOL(argv,8)) ! srl[1] = atom_getsymbolarg(8, argc, argv); ! else if(IS_A_FLOAT(argv,8)) ! { ! sprintf(str, "%d", (int)atom_getintarg(8, argc, argv)); ! srl[1] = gensym(str); ! } ! if(IS_A_SYMBOL(argv,9)) ! srl[2] = atom_getsymbolarg(9, argc, argv); ! else if(IS_A_FLOAT(argv,9)) ! { ! sprintf(str, "%d", (int)atom_getintarg(9, argc, argv)); ! srl[2] = gensym(str); ! } ! if(init != 0) init = 1; iemgui->x_isa.x_loadinit = init; ! if(!strcmp(srl[0]->s_name, "empty")) sndable = 0; ! if(!strcmp(srl[1]->s_name, "empty")) rcvable = 0; iemgui_all_raute2dollar(srl); iemgui_all_dollararg2sym(iemgui, srl); --- 388,399 ---- int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv) { ! int init,ldx,ldy,f,fs,bcol,fcol,lcol; ! int sndable, rcvable; ! pd_scanargs(argc,argv,"?????i?aaaiiiiiii;", ! &init,&srl[0],&srl[1],&srl[2],&ldx,&ldy,&f,&fs,&bcol,&fcol,&lcol); ! init = !!init; iemgui->x_isa.x_loadinit = init; ! sndable = strcmp(srl[0]->s_name, "empty"); ! rcvable = strcmp(srl[1]->s_name, "empty"); iemgui_all_raute2dollar(srl); iemgui_all_dollararg2sym(iemgui, srl); *************** *** 515,519 **** if(strcmp(srl[1]->s_name, iemgui->x_rcv->s_name)) { ! if(iemgui->x_fsf.x_rcv_able) pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); iemgui->x_rcv = srl[1]; --- 402,406 ---- if(strcmp(srl[1]->s_name, iemgui->x_rcv->s_name)) { ! if(iemgui->x_rcv_able) pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); iemgui->x_rcv = srl[1]; *************** *** 521,525 **** } } ! else if(!rcvable && iemgui->x_fsf.x_rcv_able) { pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); --- 408,412 ---- } } ! else if(!rcvable && iemgui->x_rcv_able) { pd_unbind(&iemgui->x_obj.ob_pd, iemgui->x_rcv); *************** *** 527,532 **** } iemgui->x_snd = srl[0]; ! iemgui->x_fsf.x_snd_able = sndable; ! iemgui->x_fsf.x_rcv_able = rcvable; iemgui->x_lcol = lcol & 0xffffff; iemgui->x_fcol = fcol & 0xffffff; --- 414,419 ---- } iemgui->x_snd = srl[0]; ! iemgui->x_snd_able = sndable; ! iemgui->x_rcv_able = rcvable; iemgui->x_lcol = lcol & 0xffffff; iemgui->x_fcol = fcol & 0xffffff; *************** *** 536,544 **** iemgui->x_ldy = ldy; iemgui_set_font_style(iemgui, f); ! if(fs < 4) ! fs = 4; iemgui->x_fontsize = fs; iemgui_verify_snd_ne_rcv(iemgui); ! return(oldsndrcvable); }
--- 423,430 ---- iemgui->x_ldy = ldy; iemgui_set_font_style(iemgui, f); ! if (fs<4) fs=4; iemgui->x_fontsize = fs; iemgui_verify_snd_ne_rcv(iemgui); ! return 0; }
*************** *** 546,582 **** { memset(symargp, 0, sizeof(*symargp)); ! symargp->x_loadinit = (n >> 0); ! symargp->x_scale = (n >> 20); symargp->x_flashed = 0; symargp->x_locked = 0; - symargp->x_reverse = 0; - symargp->dummy = 0; }
int iem_symargstoint(t_iem_init_symargs *symargp) { ! return ( ! (((symargp->x_loadinit & 1) << 0) | ! ((symargp->x_scale & 1) << 20))); ! } ! ! void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n) ! { ! memset(fstylep, 0, sizeof(*fstylep)); ! fstylep->x_font_style = (n >> 0); ! fstylep->x_shiftdown = 0; ! fstylep->x_selected = 0; ! fstylep->x_finemoved = 0; ! fstylep->x_put_in2out = 0; ! fstylep->x_change = 0; ! fstylep->x_thick = 0; ! fstylep->x_lin0_log1 = 0; ! fstylep->x_steady = 0; ! fstylep->dummy = 0; ! } ! ! int iem_fstyletoint(t_iem_fstyle_flags *fstylep) ! { ! return ((fstylep->x_font_style << 0) & 63); }
--- 432,446 ---- { memset(symargp, 0, sizeof(*symargp)); ! symargp->x_loadinit = n>>0; ! symargp->x_scale = n>>20; symargp->x_flashed = 0; symargp->x_locked = 0; }
int iem_symargstoint(t_iem_init_symargs *symargp) { ! return ! (((symargp->x_loadinit & 1) << 0) | ! ((symargp->x_scale & 1) << 20)); }
*************** *** 690,695 **** --- 554,563 ---- case 'f': case 'd': i+=snprintf(buf+i,n-i," %f",va_arg(val,double)); break; case 'i': i+=snprintf(buf+i,n-i," %d",va_arg(val,int)); break; + /* case 's': i+=snprintf(buf+i,n-i," "%s"",va_arg(val,t_symbol *)->s_name); break; case 'S': i+=snprintf(buf+i,n-i," "%s"",va_arg(val,const char *)); break; + */ + case 's': i+=snprintf(buf+i,n-i," {%s}",va_arg(val,t_symbol *)->s_name); break; + case 'S': i+=snprintf(buf+i,n-i," {%s}",va_arg(val,const char *)); break; } if (i>=n) goto over; *************** *** 707,732 **** }
- void iemgui2_send(void *x, t_symbol *s) {iemgui_send(x,(t_iemgui *)x,s);} - void iemgui2_receive(void *x, t_symbol *s) {iemgui_receive(x,(t_iemgui *)x,s);} - void iemgui2_label(void *x, t_symbol *s) {iemgui_label(x,(t_iemgui *)x,s);} - void iemgui2_label_pos(void *x, t_symbol *s, int ac, t_atom *av) - {iemgui_label_pos(x,(t_iemgui *)x, s, ac, av);} - void iemgui2_label_font(void *x, t_symbol *s, int ac, t_atom *av) - {iemgui_label_font(x,(t_iemgui *)x, s, ac, av);} - void iemgui2_delta(void *x, t_symbol *s, int ac, t_atom *av) - {iemgui_delta(x,(t_iemgui *)x, s, ac, av);} - void iemgui2_pos(void *x, t_symbol *s, int ac, t_atom *av) - {iemgui_pos(x,(t_iemgui *)x, s, ac, av);} - void iemgui2_color(void *x, t_symbol *s, int ac, t_atom *av) - {iemgui_color(x,(t_iemgui *)x, s, ac, av);} - void iemgui_register_class (t_class *c) { ! class_addmethod(c, (t_method)iemgui2_delta, gensym("delta"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui2_pos, gensym("pos"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui2_color, gensym("color"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui2_send, gensym("send"), A_DEFSYM, 0); ! class_addmethod(c, (t_method)iemgui2_receive, gensym("receive"), A_DEFSYM, 0); ! class_addmethod(c, (t_method)iemgui2_label, gensym("label"), A_DEFSYM, 0); ! class_addmethod(c, (t_method)iemgui2_label_pos, gensym("label_pos"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui2_label_font, gensym("label_font"), A_GIMME, 0); } --- 575,601 ---- }
void iemgui_register_class (t_class *c) { ! class_addmethod(c, (t_method)iemgui_delta, gensym("delta"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui_pos, gensym("pos"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui_color, gensym("color"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui_send, gensym("send"), A_DEFSYM, 0); ! class_addmethod(c, (t_method)iemgui_receive, gensym("receive"), A_DEFSYM, 0); ! class_addmethod(c, (t_method)iemgui_label, gensym("label"), A_DEFSYM, 0); ! class_addmethod(c, (t_method)iemgui_label_pos, gensym("label_pos"), A_GIMME, 0); ! class_addmethod(c, (t_method)iemgui_label_font, gensym("label_font"), A_GIMME, 0); ! } ! ! EXTERN t_iemgui *iemgui_new(t_class *qlass) { ! t_iemgui *self = (t_iemgui *)pd_new(qlass); ! self->x_ldx=0; ! self->x_ldy=-6; ! iem_inttosymargs(&self->x_isa, 0); ! self->x_font_style = 0; ! self->x_selected = 0; ! self->x_finemoved = 0; ! self->x_put_in2out = 0; ! self->x_change = 0; ! self->x_lin0_log1 = 0; ! self->x_steady = 0; ! return self; }
Index: g_mycanvas.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_mycanvas.c,v retrieving revision 1.1.1.3.2.2.2.5 retrieving revision 1.1.1.3.2.2.2.6 diff -C2 -d -r1.1.1.3.2.2.2.5 -r1.1.1.3.2.2.2.6 *** g_mycanvas.c 7 Apr 2004 03:17:40 -0000 1.1.1.3.2.2.2.5 --- g_mycanvas.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.2.2.6 *************** *** 2,9 **** * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! ! /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ !
#include <stdlib.h> --- 2,8 ---- * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! /* g_mycanvas.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ ! /* Copyright 2004 by Mathieu Bouchard */
#include <stdlib.h> *************** *** 25,29 **** /* ---------- cnv my gui-canvas for a window ---------------- */
- t_widgetbehavior my_canvas_widgetbehavior; static t_class *my_canvas_class;
--- 24,27 ---- *************** *** 84,88 **** x->x_gui.x_bcol, x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, ! x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, --- 82,86 ---- x->x_gui.x_bcol, x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, ! x->x_gui.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, *************** *** 94,98 **** t_canvas *canvas=glist_getcanvas(glist);
! if(x->x_gui.x_fsf.x_selected) { sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); --- 92,96 ---- t_canvas *canvas=glist_getcanvas(glist);
! if(x->x_gui.x_selected) { sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); *************** *** 104,114 **** }
! void my_canvas_draw(t_my_canvas *x, t_glist *glist, int mode) ! { ! if(mode == IEM_GUI_DRAW_MODE_MOVE) my_canvas_draw_move(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_NEW) my_canvas_draw_new(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_SELECT) my_canvas_draw_select(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_ERASE) my_canvas_draw_erase(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_CONFIG) my_canvas_draw_config(x, glist); }
--- 102,114 ---- }
! void my_canvas_draw(t_bng *x, t_glist *glist, int mode) { ! /*if (!glist_isvisible(glist_getcanvas(glist))) return; <-- doesn't work */ ! if (mode==IEM_GUI_DRAW_MODE_ERASE) ! sys_mgui((t_iemgui *)x,"cnv","erase",""); ! else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"cnv","select","i",x->x_gui.x_selected); ! else { ! pd_upload((t_gobj *)x,glist); ! sys_mgui((t_iemgui *)x,"cnv","draw","");} }
*************** *** 136,140 **** gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h, srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[2], iem_symargstoint(&x->x_gui.x_isa)); binbuf_addv(b, ";"); --- 136,140 ---- gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h, 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, bflcol[0], bflcol[2], iem_symargstoint(&x->x_gui.x_isa)); binbuf_addv(b, ";"); *************** *** 152,159 **** ------visible_rectangle(pix)(pix):------ %d width: %d height: %d \ %d empty empty %d %d empty %d \ ! %s %s \ ! %s %d %d \ ! %d %d \ ! %d %d %d\n", x->x_gui.x_w, 1, x->x_vis_w, x->x_vis_h, 0,/*no_schedule*/ --- 152,156 ---- ------visible_rectangle(pix)(pix):------ %d width: %d height: %d \ %d empty empty %d %d empty %d \ ! %s %s %s %d %d %d %d %d %d %d\n", x->x_gui.x_w, 1, x->x_vis_w, x->x_vis_h, 0,/*no_schedule*/ *************** *** 161,165 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); --- 158,162 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); *************** *** 168,172 **** static void my_canvas_get_pos(t_my_canvas *x) { ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) { x->x_at[0].a_w.w_float = text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); --- 165,169 ---- static void my_canvas_get_pos(t_my_canvas *x) { ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) { x->x_at[0].a_w.w_float = text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); *************** *** 182,200 **** int w = (int)atom_getintarg(2, argc, argv); int h = (int)atom_getintarg(3, argc, argv); ! /* int sr_flags = */ iemgui_dialog(&x->x_gui, srl, argc, argv); ! x->x_gui.x_isa.x_loadinit = 0; ! if(a < 1) ! a = 1; ! x->x_gui.x_w = a; ! x->x_gui.x_h = x->x_gui.x_w; ! if(w < 1) ! w = 1; ! x->x_vis_w = w; ! if(h < 1) ! h = 1; ! x->x_vis_h = h; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); }
--- 179,188 ---- int w = (int)atom_getintarg(2, argc, argv); int h = (int)atom_getintarg(3, argc, argv); ! iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_isa.x_loadinit = 0; ! x->x_gui.x_h = x->x_gui.x_w = MAX(a,1); ! x->x_vis_w = MAX(w,1); ! x->x_vis_h = MAX(h,1); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
*************** *** 202,254 **** { int i = (int)atom_getintarg(0, ac, av); ! ! if(i < 1) ! i = 1; ! x->x_gui.x_w = i; ! x->x_gui.x_h = i; ! iemgui_size((void *)x, &x->x_gui); }
- static void my_canvas_delta(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) - {iemgui_delta((void *)x, &x->x_gui, s, ac, av);} - - static void my_canvas_pos(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) - {iemgui_pos((void *)x, &x->x_gui, s, ac, av);} - static void my_canvas_vis_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) { ! int i; ! ! i = (int)atom_getintarg(0, ac, av); ! if(i < 1) ! i = 1; ! x->x_vis_w = i; ! if(ac > 1) ! { ! i = (int)atom_getintarg(1, ac, av); ! if(i < 1) ! i = 1; ! } ! x->x_vis_h = i; if(glist_isvisible(x->x_gui.x_glist)) ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); }
- static void my_canvas_color(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) - {iemgui_color((void *)x, &x->x_gui, s, ac, av);} - static void my_canvas_send(t_my_canvas *x, t_symbol *s) - {iemgui_send(x, &x->x_gui, s);} - static void my_canvas_receive(t_my_canvas *x, t_symbol *s) - {iemgui_receive(x, &x->x_gui, s);} - static void my_canvas_label(t_my_canvas *x, t_symbol *s) - {iemgui_label((void *)x, &x->x_gui, s);} - static void my_canvas_label_pos(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) - {iemgui_label_pos((void *)x, &x->x_gui, s, ac, av);} - static void my_canvas_label_font(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) - {iemgui_label_font((void *)x, &x->x_gui, s, ac, av);} - static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) { ! t_my_canvas *x = (t_my_canvas *)pd_new(my_canvas_class); int bflcol[]={-233017, -1, -66577}; int a=IEM_GUI_DEFAULTSIZE, w=100, h=60; --- 190,208 ---- { int i = (int)atom_getintarg(0, ac, av); ! x->x_gui.x_w = x->x_gui.x_h = MAX(i,1); ! iemgui_size((t_iemgui *)x); }
static void my_canvas_vis_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) { ! x->x_vis_h = x->x_vis_w = MAX(1,(int)atom_getintarg(0, ac, av)); ! if(ac > 1) x->x_vis_h = MAX(1,(int)atom_getintarg(1, ac, av)); if(glist_isvisible(x->x_gui.x_glist)) ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) { ! t_my_canvas *x = (t_my_canvas *)iemgui_new(my_canvas_class); int bflcol[]={-233017, -1, -66577}; int a=IEM_GUI_DEFAULTSIZE, w=100, h=60; *************** *** 257,261 ****
iem_inttosymargs(&x->x_gui.x_isa, 0); ! iem_inttofstyle(&x->x_gui.x_fsf, 0);
if(((argc >= 10)&&(argc <= 13)) --- 211,215 ----
iem_inttosymargs(&x->x_gui.x_isa, 0); ! x->x_gui.x_font_style = 0;
if(((argc >= 10)&&(argc <= 13)) *************** *** 284,295 **** &&IS_A_FLOAT(argv,i+9)) { ! /* disastrously, the "label" sits in a different part of the ! message. So we have to track its location separately (in ! the slot x_labelbindex) and initialize it specially here. */ iemgui_new_dogetname(&x->x_gui, i+3, argv); x->x_gui.x_labelbindex = i+3; ldx = (int)atom_getintarg(i+4, argc, argv); ldy = (int)atom_getintarg(i+5, argc, argv); ! iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(i+6, argc, argv)); fs = (int)atom_getintarg(i+7, argc, argv); bflcol[0] = (int)atom_getintarg(i+8, argc, argv); --- 238,249 ---- &&IS_A_FLOAT(argv,i+9)) { ! /* disastrously, the "label" sits in a different part of the ! message. So we have to track its location separately (in ! the slot x_labelbindex) and initialize it specially here. */ iemgui_new_dogetname(&x->x_gui, i+3, argv); x->x_gui.x_labelbindex = i+3; ldx = (int)atom_getintarg(i+4, argc, argv); ldy = (int)atom_getintarg(i+5, argc, argv); ! x->x_gui.x_font_style = atom_getintarg(i+6, argc, argv); fs = (int)atom_getintarg(i+7, argc, argv); bflcol[0] = (int)atom_getintarg(i+8, argc, argv); *************** *** 302,312 **** x->x_gui.x_draw = (t_iemfunptr)my_canvas_draw; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; x->x_gui.x_h = x->x_gui.x_w = MAX(a,1); x->x_vis_w = MAX(w,1); x->x_vis_h = MAX(h,1); ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); ! if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; --- 256,266 ---- x->x_gui.x_draw = (t_iemfunptr)my_canvas_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; x->x_gui.x_h = x->x_gui.x_w = MAX(a,1); x->x_vis_w = MAX(w,1); x->x_vis_h = MAX(h,1); ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); ! 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_ldx = ldx; *************** *** 322,356 **** static void my_canvas_ff(t_my_canvas *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); }
void g_mycanvas_setup(void) { t_class *c = my_canvas_class = class_new(gensym("cnv"), (t_newmethod)my_canvas_new, ! (t_method)my_canvas_ff, sizeof(t_my_canvas), CLASS_NOINLET, A_GIMME, 0); class_addcreator((t_newmethod)my_canvas_new, gensym("my_canvas"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_dialog, gensym("dialog"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_size, gensym("size"), A_GIMME, 0); - class_addmethod(c, (t_method)my_canvas_delta, gensym("delta"), A_GIMME, 0); - class_addmethod(c, (t_method)my_canvas_pos, gensym("pos"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_vis_size, gensym("vis_size"), A_GIMME, 0); - class_addmethod(c, (t_method)my_canvas_color, gensym("color"), A_GIMME, 0); - class_addmethod(c, (t_method)my_canvas_send, gensym("send"), A_DEFSYM, 0); - class_addmethod(c, (t_method)my_canvas_receive, gensym("receive"), A_DEFSYM, 0); - class_addmethod(c, (t_method)my_canvas_label, gensym("label"), A_DEFSYM, 0); - class_addmethod(c, (t_method)my_canvas_label_pos, gensym("label_pos"), A_GIMME, 0); - class_addmethod(c, (t_method)my_canvas_label_font, gensym("label_font"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_get_pos, gensym("get_pos"), 0); ! ! my_canvas_widgetbehavior.w_getrectfn = my_canvas_getrect; ! my_canvas_widgetbehavior.w_displacefn = iemgui_displace; ! my_canvas_widgetbehavior.w_selectfn = iemgui_select; ! my_canvas_widgetbehavior.w_activatefn = NULL; ! my_canvas_widgetbehavior.w_deletefn = iemgui_delete; ! my_canvas_widgetbehavior.w_visfn = iemgui_vis; ! my_canvas_widgetbehavior.w_clickfn = NULL; ! class_setwidget(c, &my_canvas_widgetbehavior); class_sethelpsymbol(c, gensym("my_canvas")); class_setsavefn(c, my_canvas_save); --- 276,303 ---- static void my_canvas_ff(t_my_canvas *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 t_widgetbehavior wb; void g_mycanvas_setup(void) { t_class *c = my_canvas_class = class_new(gensym("cnv"), (t_newmethod)my_canvas_new, ! (t_method)my_canvas_ff, sizeof(t_my_canvas), CLASS_NOINLET, A_GIMME, 0); class_addcreator((t_newmethod)my_canvas_new, gensym("my_canvas"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_dialog, gensym("dialog"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_size, gensym("size"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_vis_size, gensym("vis_size"), A_GIMME, 0); class_addmethod(c, (t_method)my_canvas_get_pos, gensym("get_pos"), 0); ! iemgui_register_class(c); ! wb.w_getrectfn = my_canvas_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = NULL; ! class_setwidget(c, &wb); class_sethelpsymbol(c, gensym("my_canvas")); class_setsavefn(c, my_canvas_save);
Index: g_all_guis.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_all_guis.h,v retrieving revision 1.1.1.4.2.2.2.13 retrieving revision 1.1.1.4.2.2.2.14 diff -C2 -d -r1.1.1.4.2.2.2.13 -r1.1.1.4.2.2.2.14 *** g_all_guis.h 27 Apr 2004 17:14:12 -0000 1.1.1.4.2.2.2.13 --- g_all_guis.h 27 Apr 2004 18:09:35 -0000 1.1.1.4.2.2.2.14 *************** *** 2,45 **** * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! /* g_7_guis.h written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ ! ! ! #define IEM_GUI_COLNR_WHITE 0 ! #define IEM_GUI_COLNR_ML_GREY 1 ! #define IEM_GUI_COLNR_D_GREY 2 ! #define IEM_GUI_COLNR_L_RED 3 ! #define IEM_GUI_COLNR_L_ORANGE 4 ! #define IEM_GUI_COLNR_L_YELLOW 5 ! #define IEM_GUI_COLNR_L_GREEN 6 ! #define IEM_GUI_COLNR_L_CYAN 7 ! #define IEM_GUI_COLNR_L_BLUE 8 ! #define IEM_GUI_COLNR_L_MAGENTA 9 ! ! #define IEM_GUI_COLNR_LL_GREY 10 ! #define IEM_GUI_COLNR_M_GREY 11 ! #define IEM_GUI_COLNR_DD_GREY 12 ! #define IEM_GUI_COLNR_RED 13 ! #define IEM_GUI_COLNR_ORANGE 14 ! #define IEM_GUI_COLNR_YELLOW 15 ! #define IEM_GUI_COLNR_GREEN 16 ! #define IEM_GUI_COLNR_CYAN 17 ! #define IEM_GUI_COLNR_BLUE 18 ! #define IEM_GUI_COLNR_MAGENTA 19 ! ! #define IEM_GUI_COLNR_L_GREY 20 ! #define IEM_GUI_COLNR_MD_GREY 21 ! #define IEM_GUI_COLNR_BLACK 22 ! #define IEM_GUI_COLNR_D_RED 23 ! #define IEM_GUI_COLNR_D_ORANGE 24 ! #define IEM_GUI_COLNR_D_YELLOW 25 ! #define IEM_GUI_COLNR_D_GREEN 26 ! #define IEM_GUI_COLNR_D_CYAN 27 ! #define IEM_GUI_COLNR_D_BLUE 28 ! #define IEM_GUI_COLNR_D_MAGENTA 29 ! ! #define IEM_GUI_COLOR_SELECTED 255 ! #define IEM_GUI_COLOR_NORMAL 0
! #define IEM_GUI_MAX_COLOR 30
#define IEM_GUI_DEFAULTSIZE 15 --- 2,11 ---- * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! /* g_all_guis.h written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000-2001 */ ! /* Copyright 2004 by Mathieu Bouchard */
! #define IEM_GUI_COLOR_SELECTED 255 ! #define IEM_GUI_COLOR_NORMAL 0 ! #define IEM_GUI_MAX_COLOR 30
#define IEM_GUI_DEFAULTSIZE 15 *************** *** 55,90 **** #define IEM_BNG_MINBREAKFLASHTIME 10
- #define IEM_VU_DEFAULTSIZE 3 - #define IEM_VU_LARGESMALL 2 - #define IEM_VU_MINSIZE 2 - #define IEM_VU_MAXSIZE 25 - #define IEM_VU_STEPS 40 - - #define IEM_VU_MINDB -99.9 - #define IEM_VU_MAXDB 12.0 - #define IEM_VU_OFFSET 100.0 - #define IEM_RADIO_MAX 128 - - #define IEM_SYM_UNIQUE_SND (1<<8) - #define IEM_SYM_UNIQUE_RCV (1<<9) - #define IEM_SYM_UNIQUE_LAB (1<<10) - #define IEM_SYM_UNIQUE_ALL ((1<<10)|(1<<9)|(1<<8)) #define IEM_FONT_STYLE_ALL 255 - #define IEM_MAX_SYM_LEN 127
- #define IEM_GUI_DRAW_MODE_UPDATE 0 - #define IEM_GUI_DRAW_MODE_MOVE 1 - #define IEM_GUI_DRAW_MODE_NEW 2 #define IEM_GUI_DRAW_MODE_SELECT 3 #define IEM_GUI_DRAW_MODE_ERASE 4 - #define IEM_GUI_DRAW_MODE_CONFIG 5 - #define IEM_GUI_DRAW_MODE_IO 6
#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER) ! #define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) ! #define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) ! #define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR) #define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
--- 21,35 ---- #define IEM_BNG_MINBREAKFLASHTIME 10
#define IEM_RADIO_MAX 128 #define IEM_FONT_STYLE_ALL 255 #define IEM_MAX_SYM_LEN 127
#define IEM_GUI_DRAW_MODE_SELECT 3 #define IEM_GUI_DRAW_MODE_ERASE 4
#define IS_A_POINTER(atom,index) ((atom+index)->a_type == A_POINTER) ! #define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) ! #define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) ! #define IS_A_DOLLAR(atom,index) ((atom+index)->a_type == A_DOLLAR) #define IS_A_DOLLSYM(atom,index) ((atom+index)->a_type == A_DOLLSYM)
*************** *** 94,119 **** #define IEM_GUI_OLD_SND_FLAG 1 #define IEM_GUI_OLD_RCV_FLAG 2 - #define IEM_GUI_COLOR_EDITED 0xFF0000 #define IEMGUI_MAX_NUM_LEN 32
typedef struct _iem_fstyle_flags { - unsigned int x_font_style:6; - unsigned int x_rcv_able:1; - unsigned int x_snd_able:1; - unsigned int x_lab_is_unique:1; - unsigned int x_rcv_is_unique:1; - unsigned int x_snd_is_unique:1; - unsigned int x_lab_arg_tail_len:6; - unsigned int x_lab_is_arg_num:6; - unsigned int x_shiftdown:1; - unsigned int x_selected:1; - unsigned int x_finemoved:1; - unsigned int x_put_in2out:1; - unsigned int x_change:1; - unsigned int x_thick:1; - unsigned int x_lin0_log1:1; - unsigned int x_steady:1; - unsigned int dummy:1; } t_iem_fstyle_flags;
--- 39,46 ---- *************** *** 121,133 **** { unsigned int x_loadinit:1; - unsigned int x_rcv_arg_tail_len:6; - unsigned int x_snd_arg_tail_len:6; - unsigned int x_rcv_is_arg_num:6; - unsigned int x_snd_is_arg_num:6; unsigned int x_scale:1; unsigned int x_flashed:1; unsigned int x_locked:1; - unsigned int x_reverse:1; /* bugfix */ - unsigned int dummy:3; } t_iem_init_symargs;
--- 48,54 ---- *************** *** 136,171 **** typedef struct _iemgui { ! t_object x_obj; ! t_glist *x_glist; ! t_iemfunptr x_draw; ! int x_h; ! int x_w; ! int x_ldx; ! int x_ldy; ! char x_font[16]; ! t_iem_fstyle_flags x_fsf; ! int x_fontsize; t_iem_init_symargs x_isa; ! int x_fcol; ! int x_bcol; ! int x_lcol; ! t_symbol *x_snd; /* send symbol */ ! t_symbol *x_rcv; /* receive */ ! t_symbol *x_lab; /* label */ ! t_symbol *x_snd_unexpanded; /* same 3, with '$' unexpanded */ ! t_symbol *x_rcv_unexpanded; ! t_symbol *x_lab_unexpanded; ! int x_binbufindex; /* where in binbuf to find these */ ! int x_labelbindex; /* where in binbuf to find label */ } t_iemgui;
- typedef struct _iemguidummy - { - t_iemgui x_gui; - int x_dum1; - int x_dum2; - int x_dum3; - } t_iemguidummy; - typedef struct _bng { --- 57,80 ---- typedef struct _iemgui { ! t_object x_obj; ! t_glist *x_glist; ! t_iemfunptr x_draw; ! int x_h, x_w; ! int x_ldx, x_ldy; ! char x_font[16]; ! /* formerly x_fsf: */ ! unsigned int x_rcv_able:1, x_snd_able:1, x_selected:1, x_finemoved:1, ! x_put_in2out:1, x_change:1, x_lin0_log1:1, x_steady:1; ! int x_font_style; ! int x_fontsize; t_iem_init_symargs x_isa; ! int x_fcol, x_bcol, x_lcol; /* foreground, background, label colors */ ! t_symbol *x_snd, *x_rcv, *x_lab; /* send, receive, label symbols */ ! /* same 3, with '$' unexpanded */ ! t_symbol *x_snd_unexpanded, *x_rcv_unexpanded, *x_lab_unexpanded; ! int x_binbufindex; /* where in binbuf to find snd/rcv/lab */ ! int x_labelbindex; /* where in binbuf to find label */ } t_iemgui;
typedef struct _bng { *************** *** 184,189 **** int x_pos; int x_val; - int x_center; /* unused in vslider */ - int x_thick; /* unused in vslider */ int x_lin0_log1; int x_steady; --- 93,96 ---- *************** *** 191,195 **** double x_max; double x_k; ! } t_hslider /*, t_vslider */;
typedef struct _hdial --- 98,102 ---- double x_max; double x_k; ! } t_hslider;
typedef struct _hdial *************** *** 201,205 **** int x_number; t_atom x_at[2]; ! } t_hdial /*, t_vdial */;
typedef struct _toggle --- 108,112 ---- int x_number; t_atom x_at[2]; ! } t_hradio;
typedef struct _toggle *************** *** 252,263 **** } t_my_numbox;
- #define t_vradio t_vdial - #define t_hradio t_hdial - extern int sys_noloadbang; extern int iemgui_color_hex[];
- EXTERN int pd_bluify(int colour); - EXTERN int pd_darker(int colour); EXTERN int iemgui_clip_size(int size); EXTERN int iemgui_clip_font(int size); --- 159,165 ---- *************** *** 279,283 **** EXTERN void iemgui_new_getnames2(t_iemgui *iemgui, int i, t_symbol *snd, t_symbol *rcv, t_symbol *lab); EXTERN void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym); - EXTERN void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym); EXTERN void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol); EXTERN void iemgui_all_colfromload(t_iemgui *iemgui, int *bflcol); --- 181,184 ---- *************** *** 286,307 **** EXTERN void iemgui_all_raute2dollar(t_symbol **srlsym);
! EXTERN void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s); ! EXTERN void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s); ! EXTERN void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s); ! EXTERN void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_size(void *x, t_iemgui *iemgui); ! EXTERN void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! ! EXTERN void iemgui2_send(void *x, t_symbol *s); ! EXTERN void iemgui2_receive(void *x, t_symbol *s); ! EXTERN void iemgui2_label(void *x, t_symbol *s); ! EXTERN void iemgui2_label_pos(void *x, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui2_label_font(void *x, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui2_delta(void *x, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui2_pos(void *x, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui2_color(void *x, t_symbol *s, int ac, t_atom *av); EXTERN void iemgui_register_class (t_class *c);
--- 187,199 ---- EXTERN void iemgui_all_raute2dollar(t_symbol **srlsym);
! EXTERN void iemgui_send(t_iemgui *iemgui, t_symbol *s); ! EXTERN void iemgui_receive(t_iemgui *iemgui, t_symbol *s); ! EXTERN void iemgui_label(t_iemgui *iemgui, t_symbol *s); ! EXTERN void iemgui_label_pos(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_label_font(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_size(t_iemgui *iemgui); ! EXTERN void iemgui_delta(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_pos(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); ! EXTERN void iemgui_color(t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av); EXTERN void iemgui_register_class (t_class *c);
*************** *** 320,325 **** EXTERN void iem_inttosymargs(t_iem_init_symargs *symargp, int n); EXTERN int iem_symargstoint(t_iem_init_symargs *symargp); - EXTERN void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n); - EXTERN int iem_fstyletoint(t_iem_fstyle_flags *fstylep);
EXTERN int pd_scanargs(int argc, t_atom *argv, char *format, ...); --- 212,215 ---- *************** *** 329,330 **** --- 219,221 ---- #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)>(b)?(a):(b)) + EXTERN t_iemgui *iemgui_new(t_class *qlass);
Index: u_object.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v retrieving revision 1.1.2.25 retrieving revision 1.1.2.26 diff -C2 -d -r1.1.2.25 -r1.1.2.26 *** u_object.tk 27 Apr 2004 16:47:32 -0000 1.1.2.25 --- u_object.tk 27 Apr 2004 18:09:35 -0000 1.1.2.26 *************** *** 52,56 **** set fields(hdl) $fields(hradio) set fields(vdl) $fields(hradio) ! set fields(vu) [eval list $fields1 w h rcv lab ldx ldy fstyle fs bcol lcol scale isa] set fields(dropper) [eval list $fields1 w isa $fields2]
--- 52,57 ---- set fields(hdl) $fields(hradio) set fields(vdl) $fields(hradio) ! set fields(vu) [eval list $fields1 w h rcv lab ldx ldy fstyle fs bcol lcol scale isa] ! set fields(cnv) [eval list $fields1 hh w h snd rcv lab ldx ldy fstyle fs bcol lcol isa] set fields(dropper) [eval list $fields1 w isa $fields2]
*************** *** 804,807 **** --- 805,813 ---- }
+ catch { + package require tkdnd + dnd bindtarget . text/uri-list <Drop> {open_file %D} + } + proc dropper_draw {self canvas} { global _ *************** *** 831,834 **** proc dropper_erase {self canvas} { bluebox_erase $self $canvas ! destroy $canvas.${self}DROP } --- 837,862 ---- proc dropper_erase {self canvas} { bluebox_erase $self $canvas ! destroy $canvas.${self}DROP ! } ! ! proc cnv_draw {self canvas} { ! global _ ! foreach {x1 y1} [object_xy $self $canvas] {} ! set xs $_($self:w) ! set ys $_($self:h) ! set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] ! if {$isnew} { ! $canvas create rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] \ ! -tags ${self}BASE -fill [parse_color $_($self:bcol)] ! } { ! $canvas coords ${self}BASE $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] ! } ! } ! ! proc cnv_select {self canvas v} { ! bluebox_select $self $canvas $v ! } ! ! proc cnv_erase {self canvas} { ! $canvas delete ${self}BASE }
Index: g_graph.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_graph.c,v retrieving revision 1.1.1.3.2.3.2.6 retrieving revision 1.1.1.3.2.3.2.7 diff -C2 -d -r1.1.1.3.2.3.2.6 -r1.1.1.3.2.3.2.7 *** g_graph.c 1 Apr 2004 23:22:01 -0000 1.1.1.3.2.3.2.6 --- g_graph.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.3.2.7 *************** *** 599,605 **** linetraverser_start(&t, x); while (oc = linetraverser_next(&t)) ! sys_vgui(".x%x.c coords l%x %d %d %d %d\n", ! glist_getcanvas(x), oc, ! t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2); } if (x->gl_owner) --- 599,605 ---- linetraverser_start(&t, x); while (oc = linetraverser_next(&t)) ! /*sys_vgui(".x%x.c coords l%x %d %d %d %d\n", ! glist_getcanvas(x), oc, t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);*/ ! sys_vgui("wire_draw2 l%x .x%x.c\n",oc,glist_getcanvas(x)); } if (x->gl_owner)
Index: g_vumeter.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_vumeter.c,v retrieving revision 1.1.1.3.2.2.2.9 retrieving revision 1.1.1.3.2.2.2.10 diff -C2 -d -r1.1.1.3.2.2.2.9 -r1.1.1.3.2.2.2.10 *** g_vumeter.c 8 Apr 2004 10:48:12 -0000 1.1.1.3.2.2.2.9 --- g_vumeter.c 27 Apr 2004 18:09:35 -0000 1.1.1.3.2.2.2.10 *************** *** 2,8 **** * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! ! /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
--- 2,8 ---- * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ ! /* g_vumeter.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ + /* Copyright 2004 by Mathieu Bouchard */
*************** *** 23,26 **** --- 23,35 ---- #endif
+ #define IEM_VU_DEFAULTSIZE 3 + #define IEM_VU_LARGESMALL 2 + #define IEM_VU_MINSIZE 2 + #define IEM_VU_MAXSIZE 25 + #define IEM_VU_STEPS 40 + #define IEM_VU_MINDB -99.9 + #define IEM_VU_MAXDB 12.0 + #define IEM_VU_OFFSET 100.0 + static int iemgui_vu_db2i[]= { *************** *** 41,45 **** /* ----- vu gui-peak- & rms- vu-meter-display ---------- */
- t_widgetbehavior vu_widgetbehavior; static t_class *vu_class;
--- 50,53 ---- *************** *** 62,66 **** { if(mode == IEM_GUI_DRAW_MODE_SELECT) { ! sys_mgui((t_iemgui *)x,"vu","select","i",x->x_gui.x_fsf.x_selected); } else if(mode == IEM_GUI_DRAW_MODE_ERASE) { sys_mgui((t_iemgui *)x,"vu","erase",""); --- 70,74 ---- { if(mode == IEM_GUI_DRAW_MODE_SELECT) { ! sys_mgui((t_iemgui *)x,"vu","select","i",x->x_gui.x_selected); } else if(mode == IEM_GUI_DRAW_MODE_ERASE) { sys_mgui((t_iemgui *)x,"vu","erase",""); *************** *** 98,102 **** srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[2], x->x_scale, iem_symargstoint(&x->x_gui.x_isa)); --- 106,110 ---- 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, bflcol[0], bflcol[2], x->x_scale, iem_symargstoint(&x->x_gui.x_isa)); *************** *** 133,137 **** "nosndno", srl[1]->s_name,/*no send*/ srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); --- 141,145 ---- "nosndno", srl[1]->s_name,/*no send*/ srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); *************** *** 144,158 **** int h = (int)atom_getintarg(1, argc, argv); int scale = (int)atom_getintarg(4, argc, argv); - int sr_flags; srl[0] = gensym("empty"); ! sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); ! x->x_gui.x_fsf.x_snd_able = 0; x->x_gui.x_isa.x_loadinit = 0; x->x_gui.x_w = iemgui_clip_size(w); vu_check_height(x, h); vu_scale(x, (float)!!scale); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } --- 152,163 ---- int h = (int)atom_getintarg(1, argc, argv); int scale = (int)atom_getintarg(4, argc, argv); srl[0] = gensym("empty"); ! iemgui_dialog(&x->x_gui, srl, argc, argv); ! x->x_gui.x_snd_able = 0; x->x_gui.x_isa.x_loadinit = 0; x->x_gui.x_w = iemgui_clip_size(w); vu_check_height(x, h); vu_scale(x, (float)!!scale); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } *************** *** 165,170 **** if(glist_isvisible(x->x_gui.x_glist)) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } --- 170,174 ---- if(glist_isvisible(x->x_gui.x_glist)) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } *************** *** 212,221 **** int ldx=-1, ldy=-8, fs=8, scale=1; iem_inttosymargs(&x->x_gui.x_isa, 0); ! iem_inttofstyle(&x->x_gui.x_fsf, 0); if(pd_scanargs(argc,argv,"ii??ii?iiii*", &w,&h,&ldx,&ldy,&fs,&bflcol[0],&bflcol[2],&scale)) { iemgui_new_getnames(&x->x_gui, 1, argv); /*???*/ ! iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(6, argc, argv)); } else iemgui_new_getnames(&x->x_gui, 1, 0); --- 216,225 ---- int ldx=-1, ldy=-8, fs=8, scale=1; iem_inttosymargs(&x->x_gui.x_isa, 0); ! x->x_gui.x_font_style=0; if(pd_scanargs(argc,argv,"ii??ii?iiii*", &w,&h,&ldx,&ldy,&fs,&bflcol[0],&bflcol[2],&scale)) { iemgui_new_getnames(&x->x_gui, 1, argv); /*???*/ ! x->x_gui.x_font_style = atom_getintarg(6, argc, argv); } else iemgui_new_getnames(&x->x_gui, 1, 0); *************** *** 224,232 **** x->x_gui.x_draw = (t_iemfunptr)vu_draw;
! x->x_gui.x_fsf.x_snd_able = 0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); ! if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; --- 228,236 ---- x->x_gui.x_draw = (t_iemfunptr)vu_draw;
! x->x_gui.x_snd_able = 0; ! x->x_gui.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); ! 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_ldx = ldx; *************** *** 251,259 **** static void vu_free(t_vu *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); }
void g_vumeter_setup(void) { --- 255,264 ---- static void vu_free(t_vu *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 t_widgetbehavior wb; void g_vumeter_setup(void) { *************** *** 267,278 **** class_addmethod(c, (t_method)vu_scale, gensym("scale"), A_DEFFLOAT, 0); iemgui_register_class(c); ! vu_widgetbehavior.w_getrectfn = vu_getrect; ! vu_widgetbehavior.w_displacefn = iemgui_displace; ! vu_widgetbehavior.w_selectfn = iemgui_select; ! vu_widgetbehavior.w_activatefn = NULL; ! vu_widgetbehavior.w_deletefn = iemgui_delete; ! vu_widgetbehavior.w_visfn = iemgui_vis; ! vu_widgetbehavior.w_clickfn = NULL; ! class_setwidget(c,&vu_widgetbehavior); class_sethelpsymbol(c, gensym("vu")); class_setsavefn(c, vu_save); --- 272,283 ---- class_addmethod(c, (t_method)vu_scale, gensym("scale"), A_DEFFLOAT, 0); iemgui_register_class(c); ! wb.w_getrectfn = vu_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = NULL; ! class_setwidget(c,&wb); class_sethelpsymbol(c, gensym("vu")); class_setsavefn(c, vu_save);
Index: g_hslider.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v retrieving revision 1.1.1.3.2.2.2.14 retrieving revision 1.1.1.3.2.2.2.15 diff -C2 -d -r1.1.1.3.2.2.2.14 -r1.1.1.3.2.2.2.15 *** g_hslider.c 8 Apr 2004 10:48:11 -0000 1.1.1.3.2.2.2.14 --- g_hslider.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.2.2.15 *************** *** 3,8 **** * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
--- 3,9 ---- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_hslider.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ + /* Copyright 2004 by Mathieu Bouchard */
*************** *** 25,29 **** #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; }
- t_widgetbehavior hslider_widgetbehavior; static t_class *hslider_class; static t_class *vslider_class; --- 26,29 ---- *************** *** 43,47 **** sys_mgui((t_iemgui *)x,"slider","erase",""); } else if (mode==IEM_GUI_DRAW_MODE_SELECT) { ! sys_mgui((t_iemgui *)x,"slider","select","i",x->x_gui.x_fsf.x_selected); } else { pd_upload((t_gobj *)x,glist); --- 43,47 ---- sys_mgui((t_iemgui *)x,"slider","erase",""); } else if (mode==IEM_GUI_DRAW_MODE_SELECT) { ! sys_mgui((t_iemgui *)x,"slider","select","i",x->x_gui.x_selected); } else { pd_upload((t_gobj *)x,glist); *************** *** 74,82 **** (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, isvert(x) ? gensym("vsl") : gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h, ! (float)x->x_min, (float)x->x_max, ! x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), ! srl[0], srl[1], srl[2], ! x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[1], bflcol[2], x->x_val, x->x_steady); --- 74,80 ---- (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, isvert(x) ? gensym("vsl") : gensym("hsl"), x->x_gui.x_w, x->x_gui.x_h, ! (float)x->x_min, (float)x->x_max, x->x_lin0_log1, iem_symargstoint(&x->x_gui.x_isa), ! 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, bflcol[0], bflcol[1], bflcol[2], x->x_val, x->x_steady); *************** *** 86,116 **** static void hslider_check_width(t_hslider *x, int w) { ! if (isvert(x)) { ! if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE; ! x->x_gui.x_h = w; ! ! if(x->x_val > (x->x_gui.x_h*100 - 100)) ! { ! x->x_pos = x->x_gui.x_h*100 - 100; ! x->x_val = x->x_pos; ! } ! if(x->x_lin0_log1) ! x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_h - 1); ! else ! x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_h - 1); ! } else { if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE; ! x->x_gui.x_w = w; ! x->x_center = (x->x_gui.x_w-1)*50; ! if(x->x_val > (x->x_gui.x_w*100 - 100)) ! { ! x->x_pos = x->x_gui.x_w*100 - 100; ! x->x_val = x->x_pos; } ! if(x->x_lin0_log1) ! x->x_k = log(x->x_max/x->x_min)/(double)(x->x_gui.x_w - 1); ! else ! x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); ! }}
static void hslider_check_minmax(t_hslider *x, double min, double max) --- 84,99 ---- static void hslider_check_width(t_hslider *x, int w) { ! double l = (double)(isvert(x) ? x->x_gui.x_h : x->x_gui.x_w)-1; ! int m = isvert(x) ? x->x_gui.x_h*100 - 100 : x->x_gui.x_w*100 - 100; ! double span = x->x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max - x->x_min); if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE; ! if (isvert(x)) { ! x->x_gui.x_h = w; ! } else { ! x->x_gui.x_w = w; } ! if(x->x_val > m) {x->x_pos = m; x->x_val = x->x_pos;} ! x->x_k = span/l; ! }
static void hslider_check_minmax(t_hslider *x, double min, double max) *************** *** 120,132 **** { if(min == 0.0 && max == 0.0) max = 1.0; ! if(max > 0.0) { ! if(min <= 0.0) min = 0.01*max; ! } else { ! if(min > 0.0) max = 0.01*min; ! } } x->x_min = min; x->x_max = max; - x->x_gui.x_isa.x_reverse = x->x_min > x->x_max; diff = x->x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max - x->x_min); x->x_k = isvert(x) ? --- 103,111 ---- { if(min == 0.0 && max == 0.0) max = 1.0; ! if(max > 0.0) { if (min<=0.0) min = 0.01*max; } ! else { if(min > 0.0) max = 0.01*min; } } x->x_min = min; x->x_max = max; diff = x->x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max - x->x_min); x->x_k = isvert(x) ? *************** *** 152,156 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); --- 131,135 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); *************** *** 160,171 **** { double g; ! if(x->x_gui.x_isa.x_reverse) { CLAMP(f,x->x_max,x->x_min); } ! else { CLAMP(f,x->x_min,x->x_max); } g = (x->x_lin0_log1 ? log(f/x->x_min) : (f-x->x_min)) / x->x_k; x->x_val = (int)(100.0*g + 0.49999); x->x_pos = x->x_val; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); }
--- 139,150 ---- { double g; ! if(x->x_min > x->x_max) { /* reverse */ CLAMP(f,x->x_max,x->x_min); } ! else { /* normal */ CLAMP(f,x->x_min,x->x_max); } g = (x->x_lin0_log1 ? log(f/x->x_min) : (f-x->x_min)) / x->x_k; x->x_val = (int)(100.0*g + 0.49999); x->x_pos = x->x_val; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
*************** *** 177,181 **** if (fabs(out) < 1.0e-10) out = 0.0; outlet_float(x->x_gui.x_obj.ob_outlet, out); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, out); } --- 156,160 ---- if (fabs(out) < 1.0e-10) out = 0.0; outlet_float(x->x_gui.x_obj.ob_outlet, out); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, out); } *************** *** 190,213 **** int lilo = (int)atom_getintarg(4, argc, argv); int steady = (int)atom_getintarg(17, argc, argv); ! int sr_flags; ! ! if(lilo != 0) lilo = 1; ! x->x_lin0_log1 = lilo; ! if(steady) ! x->x_steady = 1; ! else ! x->x_steady = 0; ! sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); ! if (isvert(x)) { ! x->x_gui.x_w = iemgui_clip_size(w); ! hslider_check_width(x, h); ! } else { ! x->x_gui.x_h = iemgui_clip_size(h); ! hslider_check_width(x, w); ! } ! hslider_check_minmax(x, min, max); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } --- 169,182 ---- int lilo = (int)atom_getintarg(4, argc, argv); int steady = (int)atom_getintarg(17, argc, argv); ! x->x_lin0_log1 = !!lilo; ! x->x_steady = !!steady; ! iemgui_dialog(&x->x_gui, srl, argc, argv); ! if (isvert(x)) { ! x->x_gui.x_w = iemgui_clip_size(w); hslider_check_width(x, h); ! } else { ! x->x_gui.x_h = iemgui_clip_size(h); hslider_check_width(x, w); ! } ! hslider_check_minmax(x, min, max); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } *************** *** 216,253 **** { int old = x->x_val; ! if (isvert(x)) { ! if(x->x_gui.x_fsf.x_finemoved) ! x->x_pos -= (int)dy; ! else ! x->x_pos -= 100*(int)dy; ! x->x_val = x->x_pos; ! if(x->x_val > 100*x->x_gui.x_h-100) ! { ! x->x_val = 100*x->x_gui.x_h-100; ! x->x_pos += 50; ! x->x_pos -= x->x_pos%100; ! } ! }else{ ! if(x->x_gui.x_fsf.x_finemoved) ! x->x_pos += (int)dx; ! else ! x->x_pos += 100*(int)dx; x->x_val = x->x_pos; ! if(x->x_val > (100*x->x_gui.x_w-100)) ! { ! x->x_val = 100*x->x_gui.x_w-100; ! x->x_pos += 50; ! x->x_pos -= x->x_pos%100; ! } ! } ! if(x->x_val < 0) ! { ! x->x_val = 0; ! x->x_pos -= 50; ! x->x_pos -= x->x_pos%100; ! } if(old != x->x_val) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); hslider_bang(x); } --- 185,197 ---- { int old = x->x_val; ! int m = (isvert(x) ? x->x_gui.x_h : x->x_gui.x_w)*100 - 100; ! x->x_pos += (x->x_gui.x_finemoved ? 1 : 100) ! * (int)(isvert(x) ? dy : dx); x->x_val = x->x_pos; ! if(x->x_val > m) {x->x_val = m; x->x_pos += 50; x->x_pos -= x->x_pos%100;} ! if(x->x_val < 0) {x->x_val = 0; x->x_pos -= 50; x->x_pos -= x->x_pos%100;} if(old != x->x_val) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); hslider_bang(x); } *************** *** 258,273 **** { int max = isvert(x) ? 100*x->x_gui.x_h-100 : 100*x->x_gui.x_w-100; ! if (isvert(x)) { ! if(!x->x_steady) ! x->x_val = (int)(100.0 * (x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos)); ! if(x->x_val > max) x->x_val = max; ! }else{ ! if(!x->x_steady) ! x->x_val = (int)(100.0 * (xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))); ! if(x->x_val > max) x->x_val = max; ! } ! if(x->x_val < 0) x->x_val = 0; x->x_pos = x->x_val; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); hslider_bang(x); glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)hslider_motion, --- 202,214 ---- { int max = isvert(x) ? 100*x->x_gui.x_h-100 : 100*x->x_gui.x_w-100; ! if(!x->x_steady) { ! int l = isvert(x) ? ! x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos : ! xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); ! x->x_val = (int)(100.0*l); ! } ! CLAMP(x->x_val,0,max); x->x_pos = x->x_val; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); hslider_bang(x); glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)hslider_motion, *************** *** 283,287 **** hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); ! x->x_gui.x_fsf.x_finemoved = !!shift; } return (1); --- 224,228 ---- hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); ! x->x_gui.x_finemoved = !!shift; } return (1); *************** *** 293,301 **** x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); if(ac > 1) hslider_check_width(x, (int)atom_getintarg(1, ac, av)); ! iemgui_size((void *)x, &x->x_gui); }else{ hslider_check_width(x, (int)atom_getintarg(0, ac, av)); if(ac > 1) x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av)); ! iemgui_size((void *)x, &x->x_gui); }}
--- 234,242 ---- x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); if(ac > 1) hslider_check_width(x, (int)atom_getintarg(1, ac, av)); ! iemgui_size((t_iemgui *)x); }else{ hslider_check_width(x, (int)atom_getintarg(0, ac, av)); if(ac > 1) x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av)); ! iemgui_size((t_iemgui *)x); }}
*************** *** 315,319 **** { x->x_lin0_log1 = 0; ! x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); }
--- 256,260 ---- { x->x_lin0_log1 = 0; ! x->x_k = (x->x_max - x->x_min)/(double)(x->x_gui.x_w - 1); /*!@#$ what about x_h? */ }
*************** *** 326,357 **** static void hslider_float(t_hslider *x, t_floatarg f) { - double out; - hslider_set(x, f); ! out = x->x_lin0_log1 ? ! x->x_min*exp(x->x_k*(double)(x->x_val)*0.01) : ! (double)(x->x_val)*0.01*x->x_k + x->x_min; ! if (fabs(out) < 1.0e-10) out = 0.0; ! if(x->x_gui.x_fsf.x_put_in2out) { outlet_float(x->x_gui.x_obj.ob_outlet, out); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, out); } }
- /* VSlider's - static void hslider_float(t_hslider *x, t_floatarg f) - { - hslider_set(x, f); - if(x->x_gui.x_fsf.x_put_in2out) - hslider_bang(x); - } - */ - static void hslider_loadbang(t_hslider *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); hslider_bang(x); } --- 267,287 ---- static void hslider_float(t_hslider *x, t_floatarg f) { hslider_set(x, f); ! if(x->x_gui.x_put_in2out) { ! double out = x->x_lin0_log1 ? ! x->x_min*exp(x->x_k*(double)(x->x_val)*0.01) : ! (double)(x->x_val)*0.01*x->x_k + x->x_min; ! if (fabs(out) < 1.0e-10) out = 0.0; outlet_float(x->x_gui.x_obj.ob_outlet, out); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, out); } }
static void hslider_loadbang(t_hslider *x) { if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); hslider_bang(x); } *************** *** 368,388 **** t_symbol *srl[3]={0,0,0}; if (s==gensym("hsl") || s==gensym("hslider")) { ! x = (t_hslider *)pd_new(hslider_class); } else if (s==gensym("vsl") || s==gensym("vslider")) { ! x = (t_hslider *)pd_new(vslider_class); } else abort(); if (isvert(x)) w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE; - iem_inttosymargs(&x->x_gui.x_isa, 0); - iem_inttofstyle(&x->x_gui.x_fsf, 0);
- /*post("vslider before min=%f max=%f &min=%08x &max=%08x",min,max,&min,&max);*/ if(pd_scanargs(argc,argv,"iiddiiaaaiiiiiiii;?", &w,&h,&min,&max,&lilo,&isa,&srl[0],&srl[1],&srl[2], &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v)) { - /*post("vslider after min=%f max=%f",min,max);*/ iem_inttosymargs(&x->x_gui.x_isa, isa); iemgui_new_getnames2(&x->x_gui, 6, srl[0], srl[1], srl[2]); - iem_inttofstyle(&x->x_gui.x_fsf, fstyle); } else { --- 298,313 ---- t_symbol *srl[3]={0,0,0}; if (s==gensym("hsl") || s==gensym("hslider")) { ! x = (t_hslider *)iemgui_new(hslider_class); } else if (s==gensym("vsl") || s==gensym("vslider")) { ! x = (t_hslider *)iemgui_new(vslider_class); } else abort(); if (isvert(x)) w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
if(pd_scanargs(argc,argv,"iiddiiaaaiiiiiiii;?", &w,&h,&min,&max,&lilo,&isa,&srl[0],&srl[1],&srl[2], &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v)) { iem_inttosymargs(&x->x_gui.x_isa, isa); iemgui_new_getnames2(&x->x_gui, 6, srl[0], srl[1], srl[2]); } else { *************** *** 390,393 **** --- 315,319 ---- iemgui_new_getnames(&x->x_gui, 6, 0); } + x->x_gui.x_font_style = fstyle; if((argc == 18)&&IS_A_FLOAT(argv,17)) steady=!!(int)atom_getintarg(17,argc,argv); x->x_gui.x_draw = (t_iemfunptr)hslider_draw; *************** *** 397,426 **** x->x_lin0_log1 = !!lilo; x->x_steady = steady; ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); ! if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); x->x_gui.x_ldx = ldx; x->x_gui.x_ldy = ldy; x->x_gui.x_fontsize = MAX(fs,4); ! if (isvert(x)) { ! x->x_gui.x_w = iemgui_clip_size(w); ! hslider_check_width(x, h); ! hslider_check_minmax(x, min, max); ! }else{ ! x->x_gui.x_h = iemgui_clip_size(h); ! hslider_check_width(x, w); ! hslider_check_minmax(x, min, max); ! } iemgui_all_colfromload(&x->x_gui, bflcol); - x->x_thick = 0; iemgui_verify_snd_ne_rcv(&x->x_gui); outlet_new(&x->x_gui.x_obj, &s_float); ! return (x); }
static void hslider_free(t_hslider *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); gfxstub_deleteforkey(x); --- 323,345 ---- x->x_lin0_log1 = !!lilo; x->x_steady = steady; ! 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; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); ! 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_ldx = ldx; x->x_gui.x_ldy = ldy; x->x_gui.x_fontsize = MAX(fs,4); ! if (isvert(x)) {x->x_gui.x_w = iemgui_clip_size(w); hslider_check_width(x, h);} ! else {x->x_gui.x_h = iemgui_clip_size(h); hslider_check_width(x, w);} ! hslider_check_minmax(x, min, max); iemgui_all_colfromload(&x->x_gui, bflcol); iemgui_verify_snd_ne_rcv(&x->x_gui); outlet_new(&x->x_gui.x_obj, &s_float); ! return x; }
static void hslider_free(t_hslider *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); *************** *** 443,446 **** --- 362,366 ---- }
+ static t_widgetbehavior wb; void g_hslider_setup(void) { *************** *** 456,469 **** hslider_methods(hslider_class); hslider_methods(vslider_class); ! hslider_widgetbehavior.w_getrectfn = hslider_getrect; ! hslider_widgetbehavior.w_displacefn = iemgui_displace; ! hslider_widgetbehavior.w_selectfn = iemgui_select; ! hslider_widgetbehavior.w_activatefn = NULL; ! hslider_widgetbehavior.w_deletefn = iemgui_delete; ! hslider_widgetbehavior.w_visfn = iemgui_vis; ! hslider_widgetbehavior.w_clickfn = hslider_newclick;
! class_setwidget(hslider_class, &hslider_widgetbehavior); ! class_setwidget(vslider_class, &hslider_widgetbehavior); class_sethelpsymbol(hslider_class, gensym("hslider")); class_sethelpsymbol(vslider_class, gensym("vslider")); --- 376,389 ---- hslider_methods(hslider_class); hslider_methods(vslider_class); ! wb.w_getrectfn = hslider_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = hslider_newclick;
! class_setwidget(hslider_class, &wb); ! class_setwidget(vslider_class, &wb); class_sethelpsymbol(hslider_class, gensym("hslider")); class_sethelpsymbol(vslider_class, gensym("vslider"));
Index: g_dropper.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/g_dropper.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** g_dropper.c 27 Apr 2004 17:14:13 -0000 1.1.2.4 --- g_dropper.c 27 Apr 2004 18:09:34 -0000 1.1.2.5 *************** *** 28,32 **** 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_fsf.x_selected); else { pd_upload((t_gobj *)x,glist); --- 28,32 ---- 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); *************** *** 68,72 **** srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[1], bflcol[2]); binbuf_addv(b, ";"); --- 68,72 ---- 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, bflcol[0], bflcol[1], bflcol[2]); binbuf_addv(b, ";"); *************** *** 89,93 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); --- 89,93 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); *************** *** 111,115 **** &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2]); iem_inttosymargs(&x->x_gui.x_isa, isa); ! iem_inttofstyle(&x->x_gui.x_fsf, fstyle); iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]); x->x_gui.x_draw = (t_iemfunptr)dropper_draw; --- 111,115 ---- &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2]); iem_inttosymargs(&x->x_gui.x_isa, isa); ! x->x_gui.x_font_style = fstyle; iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]); x->x_gui.x_draw = (t_iemfunptr)dropper_draw; *************** *** 117,124 **** x->x_gui.x_ldx=ldx; x->x_gui.x_ldy=ldy; ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); ! if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); sprintf(buf, "d%x", (int)x); --- 117,124 ---- 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; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); ! 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); *************** *** 131,140 **** 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_fsf.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); --- 131,140 ---- 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);
Index: g_bang.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_bang.c,v retrieving revision 1.1.1.3.2.2.2.14 retrieving revision 1.1.1.3.2.2.2.15 diff -C2 -d -r1.1.1.3.2.2.2.14 -r1.1.1.3.2.2.2.15 *** g_bang.c 8 Apr 2004 10:48:11 -0000 1.1.1.3.2.2.2.14 --- g_bang.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.2.2.15 *************** *** 3,8 **** * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */
--- 3,9 ---- * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
! /* g_bang.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ + /* Copyright 2004 by Mathieu Bouchard */
*************** *** 23,34 **** #endif
- t_widgetbehavior bng_widgetbehavior; static t_class *bng_class;
void bng_draw(t_bng *x, t_glist *glist, int mode) { if (mode==IEM_GUI_DRAW_MODE_ERASE) sys_mgui((t_iemgui *)x,"bang","erase",""); else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"bang","select","i",x->x_gui.x_fsf.x_selected); else { pd_upload((t_gobj *)x,glist); --- 24,35 ---- #endif
static t_class *bng_class;
void bng_draw(t_bng *x, t_glist *glist, int mode) { + /*if (!glist_isvisible(glist_getcanvas(glist))) return; <-- doesn't work */ if (mode==IEM_GUI_DRAW_MODE_ERASE) sys_mgui((t_iemgui *)x,"bang","erase",""); else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"bang","select","i",x->x_gui.x_selected); else { pd_upload((t_gobj *)x,glist); *************** *** 56,65 **** binbuf_addv(b, "ssiisiiiisssiiiiiii", gensym("#X"),gensym("obj"), (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, ! gensym("bng"), x->x_gui.x_w, ! x->x_flashtime_hold, x->x_flashtime_break, ! iem_symargstoint(&x->x_gui.x_isa), ! srl[0], srl[1], srl[2], ! x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[1], bflcol[2]); binbuf_addv(b, ";"); --- 57,63 ---- binbuf_addv(b, "ssiisiiiisssiiiiiii", gensym("#X"),gensym("obj"), (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix, ! gensym("bng"), x->x_gui.x_w, x->x_flashtime_hold, x->x_flashtime_break, ! iem_symargstoint(&x->x_gui.x_isa), 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, bflcol[0], bflcol[1], bflcol[2]); binbuf_addv(b, ";"); *************** *** 97,101 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); --- 95,99 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); *************** *** 109,113 **** clock_delay(x->x_clock_brk, x->x_flashtime_break); } else { ! sys_mgui((t_iemgui *)x,"bang","bang",""); } x->x_flashed = 1; --- 107,113 ---- clock_delay(x->x_clock_brk, x->x_flashtime_break); } else { ! t_canvas *glist = ((t_iemgui *)x)->x_glist; ! if (glist_isvisible(glist_getcanvas(glist))) ! sys_mgui((t_iemgui *)x,"bang","bang",""); } x->x_flashed = 1; *************** *** 117,124 **** static void bng_bout2(t_bng *x) { ! if(!x->x_gui.x_fsf.x_put_in2out) {x->x_gui.x_isa.x_locked = 1; clock_delay(x->x_clock_lck, 2);} outlet_bang(x->x_gui.x_obj.ob_outlet); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_bang(x->x_gui.x_snd->s_thing); } --- 117,124 ---- static void bng_bout2(t_bng *x) { ! if(!x->x_gui.x_put_in2out) {x->x_gui.x_isa.x_locked = 1; clock_delay(x->x_clock_lck, 2);} outlet_bang(x->x_gui.x_obj.ob_outlet); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_bang(x->x_gui.x_snd->s_thing); } *************** *** 128,135 **** if(x->x_gui.x_isa.x_locked) return; bng_set(x); ! if(!x->x_gui.x_fsf.x_put_in2out) {x->x_gui.x_isa.x_locked = 1; clock_delay(x->x_clock_lck, 2);} outlet_bang(x->x_gui.x_obj.ob_outlet); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing && x->x_gui.x_fsf.x_put_in2out) pd_bang(x->x_gui.x_snd->s_thing); } --- 128,135 ---- if(x->x_gui.x_isa.x_locked) return; bng_set(x); ! if(!x->x_gui.x_put_in2out) {x->x_gui.x_isa.x_locked = 1; clock_delay(x->x_clock_lck, 2);} outlet_bang(x->x_gui.x_obj.ob_outlet); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing && x->x_gui.x_put_in2out) pd_bang(x->x_gui.x_snd->s_thing); } *************** *** 146,150 **** int fthold = (int)atom_getintarg(2, argc, argv); int ftbreak = (int)atom_getintarg(3, argc, argv); ! /* int sr_flags = */ iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a); bng_check_minmax(x, ftbreak, fthold); --- 146,150 ---- int fthold = (int)atom_getintarg(2, argc, argv); int ftbreak = (int)atom_getintarg(3, argc, argv); ! iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_h = x->x_gui.x_w = iemgui_clip_size(a); bng_check_minmax(x, ftbreak, fthold); *************** *** 176,180 **** x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; ! iemgui_size((void *)x, &x->x_gui); }
--- 176,180 ---- x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; ! iemgui_size((t_iemgui *)x); }
*************** *** 193,200 **** static void *bng_new(t_symbol *s, int argc, t_atom *argv) { ! t_bng *x = (t_bng *)pd_new(bng_class); int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE; ! int ldx=0, ldy=-6, isa=0, fstyle=0, fs=8; int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold= IEM_BNG_DEFAULTHOLDFLASHTIME; --- 193,200 ---- static void *bng_new(t_symbol *s, int argc, t_atom *argv) { ! t_bng *x = (t_bng *)iemgui_new(bng_class); int bflcol[]={-262144, -1, -1}; int a=IEM_GUI_DEFAULTSIZE; ! int isa=0, fstyle=0, fs=8; int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold= IEM_BNG_DEFAULTHOLDFLASHTIME; *************** *** 202,218 **** pd_scanargs(argc,argv,"iiiiaaaiiiiiii", &a,&fthold,&ftbreak,&isa,&srl[0],&srl[1],&srl[2], ! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2]); iem_inttosymargs(&x->x_gui.x_isa, isa); ! iem_inttofstyle(&x->x_gui.x_fsf, fstyle); iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]); x->x_gui.x_draw = (t_iemfunptr)bng_draw; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); - x->x_gui.x_ldx=ldx; - x->x_gui.x_ldy=ldy; x->x_flashed = 0; ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); ! if (x->x_gui.x_fsf.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); --- 202,216 ---- pd_scanargs(argc,argv,"iiiiaaaiiiiiii", &a,&fthold,&ftbreak,&isa,&srl[0],&srl[1],&srl[2], ! &x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2]); iem_inttosymargs(&x->x_gui.x_isa, isa); ! x->x_gui.x_font_style = fstyle; iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]); x->x_gui.x_draw = (t_iemfunptr)bng_draw; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); x->x_flashed = 0; ! 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; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); ! 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); *************** *** 231,235 **** static void bng_ff(t_bng *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_lck); --- 229,233 ---- static void bng_ff(t_bng *x) { ! if(x->x_gui.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_lck); *************** *** 239,242 **** --- 237,241 ---- }
+ static t_widgetbehavior wb; void g_bang_setup(void) { *************** *** 257,268 **** class_addmethod(c, (t_method)bng_init, gensym("init"), A_FLOAT, 0); iemgui_register_class(c); ! bng_widgetbehavior.w_getrectfn = bng_getrect; ! bng_widgetbehavior.w_displacefn = iemgui_displace; ! bng_widgetbehavior.w_selectfn = iemgui_select; ! bng_widgetbehavior.w_activatefn = NULL; ! bng_widgetbehavior.w_deletefn = iemgui_delete; ! bng_widgetbehavior.w_visfn = iemgui_vis; ! bng_widgetbehavior.w_clickfn = bng_newclick; ! class_setwidget(bng_class, &bng_widgetbehavior); class_sethelpsymbol(bng_class, gensym("bng")); class_setsavefn(bng_class, bng_save); --- 256,267 ---- class_addmethod(c, (t_method)bng_init, gensym("init"), A_FLOAT, 0); iemgui_register_class(c); ! wb.w_getrectfn = bng_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = bng_newclick; ! class_setwidget(bng_class, &wb); class_sethelpsymbol(bng_class, gensym("bng")); class_setsavefn(bng_class, bng_save);
Index: g_numbox.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_numbox.c,v retrieving revision 1.1.1.4.2.2.2.10 retrieving revision 1.1.1.4.2.2.2.11 diff -C2 -d -r1.1.1.4.2.2.2.10 -r1.1.1.4.2.2.2.11 *** g_numbox.c 8 Apr 2004 10:48:11 -0000 1.1.1.4.2.2.2.10 --- g_numbox.c 27 Apr 2004 18:09:34 -0000 1.1.1.4.2.2.2.11 *************** *** 21,28 **** #endif
! #define CH post("%d: change=%d", __LINE__, (int)x->x_gui.x_fsf.x_change);
static void my_numbox_key(void *z, t_floatarg fkey); - t_widgetbehavior my_numbox_widgetbehavior; static t_class *my_numbox_class;
--- 21,27 ---- #endif
! #define CH post("%d: change=%d", __LINE__, (int)x->x_gui.x_change);
static void my_numbox_key(void *z, t_floatarg fkey); static t_class *my_numbox_class;
*************** *** 31,39 **** static void my_numbox_tick_reset(t_my_numbox *x) { ! if(x->x_gui.x_fsf.x_change) { ! x->x_gui.x_fsf.x_change = 0; CH glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } --- 30,38 ---- static void my_numbox_tick_reset(t_my_numbox *x) { ! if(x->x_gui.x_change) { ! x->x_gui.x_change = 0; CH glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } } *************** *** 41,45 **** static void my_numbox_tick_wait(t_my_numbox *x) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); }
--- 40,44 ---- static void my_numbox_tick_wait(t_my_numbox *x) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
*************** *** 53,58 **** { int w, f=31; ! if(x->x_gui.x_fsf.x_font_style == 1) f = 27; ! else if(x->x_gui.x_fsf.x_font_style == 2) f = 25; w = x->x_gui.x_fontsize * f * x->x_gui.x_w; w /= 36; --- 52,57 ---- { int w, f=31; ! if(x->x_gui.x_font_style == 1) f = 27; ! else if(x->x_gui.x_font_style == 2) f = 25; w = x->x_gui.x_fontsize * f * x->x_gui.x_w; w /= 36; *************** *** 118,122 **** else if (mode==IEM_GUI_DRAW_MODE_SELECT) sys_mgui((t_iemgui *)x,"numbox","select","i", ! (int)x->x_gui.x_fsf.x_selected + 2*(int)x->x_gui.x_fsf.x_change); else { pd_upload((t_gobj *)x,glist); --- 117,121 ---- else if (mode==IEM_GUI_DRAW_MODE_SELECT) sys_mgui((t_iemgui *)x,"numbox","select","i", ! (int)x->x_gui.x_selected + 2*(int)x->x_gui.x_change); else { pd_upload((t_gobj *)x,glist); *************** *** 124,128 **** sys_mgui((t_iemgui *)x,"numbox","draw",""); sys_mgui((t_iemgui *)x,"numbox","select","i", ! (int)x->x_gui.x_fsf.x_selected + 2*(int)x->x_gui.x_fsf.x_change);} }
--- 123,127 ---- sys_mgui((t_iemgui *)x,"numbox","draw",""); sys_mgui((t_iemgui *)x,"numbox","select","i", ! (int)x->x_gui.x_selected + 2*(int)x->x_gui.x_change);} }
*************** *** 147,155 **** iemgui_save(&x->x_gui, srl, bflcol); /* ! if(x->x_gui.x_fsf.x_change) { ! x->x_gui.x_fsf.x_change = 0; CH clock_unset(x->x_clock_reset); glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
} --- 146,154 ---- iemgui_save(&x->x_gui, srl, bflcol); /* ! if(x->x_gui.x_change) { ! x->x_gui.x_change = 0; CH clock_unset(x->x_clock_reset); glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
} *************** *** 162,166 **** srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy, ! iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize, bflcol[0], bflcol[1], bflcol[2], x->x_val, x->x_log_height); --- 161,165 ---- 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, bflcol[0], bflcol[1], bflcol[2], x->x_val, x->x_log_height); *************** *** 185,193 **** if(x->x_val < x->x_min) { x->x_val = x->x_min; ret = 1; } if(x->x_val > x->x_max) { x->x_val = x->x_max; ret = 1; } ! if(x->x_lin0_log1) ! x->x_k = exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)); ! else ! x->x_k = 1.0; ! return(ret); }
--- 184,189 ---- if(x->x_val < x->x_min) { x->x_val = x->x_min; ret = 1; } if(x->x_val > x->x_max) { x->x_val = x->x_max; ret = 1; } ! x->x_k = x->x_lin0_log1 ? exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)) : 1.0; ! return ret; }
*************** *** 199,208 ****
iemgui_properties(&x->x_gui, srl); ! if(x->x_gui.x_fsf.x_change) { ! x->x_gui.x_fsf.x_change = 0; CH clock_unset(x->x_clock_reset); glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
} --- 195,204 ----
iemgui_properties(&x->x_gui, srl); ! if(x->x_gui.x_change) { ! x->x_gui.x_change = 0; CH clock_unset(x->x_clock_reset); glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0);
} *************** *** 221,225 **** srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); --- 217,221 ---- srl[0]->s_name, srl[1]->s_name, srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy, ! x->x_gui.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); *************** *** 230,234 **** { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_val); ! if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_val); } --- 226,230 ---- { outlet_float(x->x_gui.x_obj.ob_outlet, x->x_val); ! if(x->x_gui.x_snd_able && x->x_gui.x_snd->s_thing) pd_float(x->x_gui.x_snd->s_thing, x->x_val); } *************** *** 244,267 **** int lilo = (int)atom_getintarg(4, argc, argv); int log_height = (int)atom_getintarg(6, argc, argv); ! int sr_flags; ! ! if(lilo != 0) lilo = 1; ! x->x_lin0_log1 = lilo; ! sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); ! if(w < 1) ! w = 1; ! x->x_gui.x_w = w; ! if(h < 8) ! h = 8; ! x->x_gui.x_h = h; ! if(log_height < 10) ! log_height = 10; ! x->x_log_height = log_height; my_numbox_calc_fontwidth(x); my_numbox_check_minmax(x, min, max); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } --- 240,251 ---- int lilo = (int)atom_getintarg(4, argc, argv); int log_height = (int)atom_getintarg(6, argc, argv); ! x->x_lin0_log1 = !!lilo; ! iemgui_dialog(&x->x_gui, srl, argc, argv); ! x->x_gui.x_w = MAX(w,1); ! x->x_gui.x_h = MAX(h,8); ! x->x_log_height = MAX(log_height,10); my_numbox_calc_fontwidth(x); my_numbox_check_minmax(x, min, max); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x); } *************** *** 269,273 **** static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) { ! double k2= x->x_gui.x_fsf.x_finemoved ? 0.01 : 1.0; if(x->x_lin0_log1) x->x_val *= pow(x->x_k, -k2*dy); --- 253,257 ---- static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) { ! double k2= x->x_gui.x_finemoved ? 0.01 : 1.0; if(x->x_lin0_log1) x->x_val *= pow(x->x_k, -k2*dy); *************** *** 275,279 **** x->x_val -= k2*dy; my_numbox_clip(x); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); my_numbox_bang(x); clock_unset(x->x_clock_reset); --- 259,263 ---- x->x_val -= k2*dy; my_numbox_clip(x); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); my_numbox_bang(x); clock_unset(x->x_clock_reset); *************** *** 295,303 **** my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); ! x->x_gui.x_fsf.x_finemoved = !! shift; ! if(!x->x_gui.x_fsf.x_change) { clock_delay(x->x_clock_wait, 50); ! x->x_gui.x_fsf.x_change = 1; CH clock_delay(x->x_clock_reset, 3000); x->x_buf[0] = 0; --- 279,287 ---- my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); ! x->x_gui.x_finemoved = !! shift; ! if(!x->x_gui.x_change) { clock_delay(x->x_clock_wait, 50); ! x->x_gui.x_change = 1; CH clock_delay(x->x_clock_reset, 3000); x->x_buf[0] = 0; *************** *** 305,313 **** else { ! x->x_gui.x_fsf.x_change = 0; CH clock_unset(x->x_clock_reset); glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); x->x_buf[0] = 0; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } --- 289,297 ---- else { ! x->x_gui.x_change = 0; CH clock_unset(x->x_clock_reset); glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0); x->x_buf[0] = 0; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } } *************** *** 319,323 **** x->x_val = f; my_numbox_clip(x); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); }
--- 303,307 ---- x->x_val = f; my_numbox_clip(x); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
*************** *** 326,333 **** if(lh < 10.0) lh = 10.0; x->x_log_height = (int)lh; ! if(x->x_lin0_log1) ! x->x_k = exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)); ! else ! x->x_k = 1.0;
} --- 310,314 ---- if(lh < 10.0) lh = 10.0; x->x_log_height = (int)lh; ! x->x_k = x->x_lin0_log1 ? exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)) : 1.0;
} *************** *** 336,340 **** { my_numbox_set(x, f); ! if(x->x_gui.x_fsf.x_put_in2out) my_numbox_bang(x); } --- 317,321 ---- { my_numbox_set(x, f); ! if(x->x_gui.x_put_in2out) my_numbox_bang(x); } *************** *** 342,367 **** static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { ! int h, w; ! ! w = (int)atom_getintarg(0, ac, av); ! if(w < 1) w = 1; ! x->x_gui.x_w = w; ! if(ac > 1) ! { ! h = (int)atom_getintarg(1, ac, av); ! if(h < 8) h = 8; ! x->x_gui.x_h = h; ! } my_numbox_calc_fontwidth(x); ! iemgui_size((void *)x, &x->x_gui); }
static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { ! if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av), ! (double)atom_getfloatarg(1, ac, av))) ! { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); ! } }
--- 323,338 ---- static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { ! x->x_gui.x_w = MAX(1,(int)atom_getintarg(0, ac, av)); ! if(ac > 1) x->x_gui.x_h = MAX(8,(int)atom_getintarg(1, ac, av)); my_numbox_calc_fontwidth(x); ! iemgui_size((t_iemgui *)x); }
static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { ! if(my_numbox_check_minmax(x, ! (double)atom_getfloatarg(0, ac, av), ! (double)atom_getfloatarg(1, ac, av))) ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); }
*************** *** 371,375 **** if(my_numbox_check_minmax(x, x->x_min, x->x_max)) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } --- 342,346 ---- if(my_numbox_check_minmax(x, x->x_min, x->x_max)) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } } *************** *** 389,393 **** if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) { ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); my_numbox_bang(x); } --- 360,364 ---- if(!sys_noloadbang && x->x_gui.x_isa.x_loadinit) { ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); my_numbox_bang(x); } *************** *** 403,409 **** if (c == 0) { ! x->x_gui.x_fsf.x_change = 0; CH clock_unset(x->x_clock_reset); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); return; } --- 374,380 ---- if (c == 0) { ! x->x_gui.x_change = 0; CH clock_unset(x->x_clock_reset); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); return; } *************** *** 415,419 **** buf[0] = c; strcat(x->x_buf, buf); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } } --- 386,390 ---- buf[0] = c; strcat(x->x_buf, buf); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } } *************** *** 424,428 **** if(sl < 0) sl = 0; x->x_buf[sl] = 0; ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } else if((c=='\n')||(c==13)) --- 395,399 ---- if(sl < 0) sl = 0; x->x_buf[sl] = 0; ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } else if((c=='\n')||(c==13)) *************** *** 430,438 **** x->x_val = atof(x->x_buf); x->x_buf[0] = 0; ! x->x_gui.x_fsf.x_change = 0; CH clock_unset(x->x_clock_reset); my_numbox_clip(x); my_numbox_bang(x); ! (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); } clock_delay(x->x_clock_reset, 3000); --- 401,409 ---- x->x_val = atof(x->x_buf); x->x_buf[0] = 0; ! x->x_gui.x_change = 0; CH clock_unset(x->x_clock_reset); my_numbox_clip(x); my_numbox_bang(x); ! x->x_gui.x_draw(x, x->x_gui.x_glist, 0); } clock_delay(x->x_clock_reset, 3000); *************** *** 453,457 **** int bflcol[]={-262144, -1, -1}; int w=5, h=14; ! int ldx=0, ldy=-6, isa=0, fstyle=0, fs=10; int lilo=0; int log_height=256; --- 424,428 ---- int bflcol[]={-262144, -1, -1}; int w=5, h=14; ! int isa=0, fstyle=0, fs=10; int lilo=0; int log_height=256; *************** *** 461,469 **** if(pd_scanargs(argc,argv,"iiddiiaaaiiiiiiid*", &w,&h,&min,&max,&lilo,&isa,&srl[0],&srl[1],&srl[2], ! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v)) { iem_inttosymargs(&x->x_gui.x_isa, isa); iemgui_new_getnames2(&x->x_gui, 6, srl[0], srl[1], srl[2]); - iem_inttofstyle(&x->x_gui.x_fsf, fstyle); } else iemgui_new_getnames(&x->x_gui, 6, 0); --- 432,439 ---- if(pd_scanargs(argc,argv,"iiddiiaaaiiiiiiid*", &w,&h,&min,&max,&lilo,&isa,&srl[0],&srl[1],&srl[2], ! &x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v)) { iem_inttosymargs(&x->x_gui.x_isa, isa); iemgui_new_getnames2(&x->x_gui, 6, srl[0], srl[1], srl[2]); } else iemgui_new_getnames(&x->x_gui, 6, 0); *************** *** 472,475 **** --- 442,446 ---- log_height = (int)atom_getintarg(17, argc, argv); } + x->x_gui.x_font_style = fstyle; x->x_gui.x_draw = (t_iemfunptr)my_numbox_draw; x->x_gui.x_glist = (t_glist *)canvas_getcurrent(); *************** *** 477,487 **** x->x_lin0_log1 = !!lilo; x->x_log_height = MAX(log_height,10); ! x->x_gui.x_fsf.x_snd_able = strcmp(x->x_gui.x_snd->s_name, "empty")!=0; ! x->x_gui.x_fsf.x_rcv_able = strcmp(x->x_gui.x_rcv->s_name, "empty")!=0; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_fsf.x_font_style); ! if (x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); - x->x_gui.x_ldx = ldx; - x->x_gui.x_ldy = ldy; x->x_gui.x_fontsize = MAX(fs,4); x->x_gui.x_w = MAX(w,1); --- 448,456 ---- x->x_lin0_log1 = !!lilo; x->x_log_height = MAX(log_height,10); ! 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; ! iemgui_set_font_style((t_iemgui *)x, x->x_gui.x_font_style); ! 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_w = MAX(w,1); *************** *** 494,498 **** x->x_clock_reset = clock_new(x, (t_method)my_numbox_tick_reset); x->x_clock_wait = clock_new(x, (t_method)my_numbox_tick_wait); ! x->x_gui.x_fsf.x_change = 0; CH outlet_new(&x->x_gui.x_obj, &s_float); return (x); --- 463,467 ---- x->x_clock_reset = clock_new(x, (t_method)my_numbox_tick_reset); x->x_clock_wait = clock_new(x, (t_method)my_numbox_tick_wait); ! x->x_gui.x_change = 0; CH outlet_new(&x->x_gui.x_obj, &s_float); return (x); *************** *** 501,505 **** static void my_numbox_free(t_my_numbox *x) { ! if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_reset); --- 470,474 ---- static void my_numbox_free(t_my_numbox *x) { ! if(x->x_gui.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_reset); *************** *** 508,511 **** --- 477,481 ---- }
+ static t_widgetbehavior wb; void g_numbox_setup(void) { *************** *** 531,542 **** class_addmethod(c, (t_method)my_numbox_init, gensym("init"), A_FLOAT, 0); class_addmethod(c, (t_method)my_numbox_log_height, gensym("log_height"), A_FLOAT, 0); ! my_numbox_widgetbehavior.w_getrectfn = my_numbox_getrect; ! my_numbox_widgetbehavior.w_displacefn = iemgui_displace; ! my_numbox_widgetbehavior.w_selectfn = iemgui_select; ! my_numbox_widgetbehavior.w_activatefn = NULL; ! my_numbox_widgetbehavior.w_deletefn = iemgui_delete; ! my_numbox_widgetbehavior.w_visfn = iemgui_vis; ! my_numbox_widgetbehavior.w_clickfn = my_numbox_newclick; ! class_setwidget(c, &my_numbox_widgetbehavior); class_sethelpsymbol(c, gensym("numbox2")); class_setsavefn(c, my_numbox_save); --- 501,512 ---- class_addmethod(c, (t_method)my_numbox_init, gensym("init"), A_FLOAT, 0); class_addmethod(c, (t_method)my_numbox_log_height, gensym("log_height"), A_FLOAT, 0); ! wb.w_getrectfn = my_numbox_getrect; ! wb.w_displacefn = iemgui_displace; ! wb.w_selectfn = iemgui_select; ! wb.w_activatefn = NULL; ! wb.w_deletefn = iemgui_delete; ! wb.w_visfn = iemgui_vis; ! wb.w_clickfn = my_numbox_newclick; ! class_setwidget(c, &wb); class_sethelpsymbol(c, gensym("numbox2")); class_setsavefn(c, my_numbox_save);
Index: u_main.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v retrieving revision 1.1.1.4.2.7.4.50 retrieving revision 1.1.1.4.2.7.4.51 diff -C2 -d -r1.1.1.4.2.7.4.50 -r1.1.1.4.2.7.4.51 *** u_main.tk 27 Apr 2004 16:47:32 -0000 1.1.1.4.2.7.4.50 --- u_main.tk 27 Apr 2004 18:09:35 -0000 1.1.1.4.2.7.4.51 *************** *** 88,93 **** }
- package require tkdnd - # it's unfortunate but we seem to have to turn off global bindings # for Text objects to get control-s and control-t to do what we want for --- 88,91 ---- *************** *** 260,265 **** }
- dnd bindtarget . text/uri-list <Drop> {open_file %D} - proc menu_send {} { toplevel .sendpanel --- 258,261 ----