[PD-dev] Radio button bug in devel_0.37
musil at iem.at
musil at iem.at
Sat Aug 7 14:52:45 CEST 2004
hi list
here is a bugfix of Vradio and Hradio:
the source is from miller's pd-0.37-2
I exchanged only the sequence of pd_float and DRAW_UPDATE
I also changed the properties-window, there was an old feature
which we don't need today (new&old).
the changes of vdial.c and hdial.c are attached,
any changed line is labeled with /*tm*/
cheers, Thomas Musil.
-------------- next part --------------
static void vradio_properties(t_gobj *z, t_glist *owner)
{
t_vradio *x = (t_vradio *)z;
char buf[800];
t_symbol *srl[3];
int hchange=-1;/*tm*/
iemgui_properties(&x->x_gui, srl);
if(pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)/*tm*/
hchange = x->x_change;/*tm*/
sprintf(buf, "pdtk_iemgui_dialog %%s vradio \
----------dimensions(pix):----------- %d %d size: 0 0 empty \
empty 0.0 empty 0.0 empty %d \
%d new-only new&old %d %d number: %d \
%s %s \
%s %d %d \
%d %d \
%d %d %d\n",
x->x_gui.x_w, IEM_GUI_MINSIZE,
0,/*no_schedule*/
hchange, x->x_gui.x_isa.x_loadinit, -1, x->x_number,
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);/*tm*/
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
}
static void vradio_fout(t_vradio *x, t_floatarg f)
{
int i=(int)f;
if(i < 0)
i = 0;
if(i >= x->x_number)
i = x->x_number-1;
if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_old_class)
{
/* compatibility with earlier "vdial" 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);
}
else
{
x->x_on_old = x->x_on;
x->x_on = i;/*tm*/
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);/*tm*/
outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);/*tm*/
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);
}
}
static void vradio_float(t_vradio *x, t_floatarg f)
{
int i=(int)f;
if(i < 0)
i = 0;
if(i >= x->x_number)
i = x->x_number-1;
if (pd_class(&x->x_gui.x_obj.ob_pd) == vradio_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);
}
}
else
{
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);/*tm*/
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);
}
}
}
-------------- next part --------------
static void hradio_properties(t_gobj *z, t_glist *owner)
{
t_hradio *x = (t_hradio *)z;
char buf[800];
t_symbol *srl[3];
int hchange=-1;/*tm*/
iemgui_properties(&x->x_gui, srl);
if(pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)/*tm*/
hchange = x->x_change;/*tm*/
sprintf(buf, "pdtk_iemgui_dialog %%s hradio \
----------dimensions(pix):----------- %d %d size: 0 0 empty \
empty 0.0 empty 0.0 empty %d \
%d new-only new&old %d %d number: %d \
%s %s \
%s %d %d \
%d %d \
%d %d %d\n",
x->x_gui.x_w, IEM_GUI_MINSIZE,
0,/*no_schedule*/
hchange, x->x_gui.x_isa.x_loadinit, -1, x->x_number,
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);/*tm*/
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
}
static void hradio_fout(t_hradio *x, t_floatarg f)
{
int i=(int)f;
if(i < 0)
i = 0;
if(i >= x->x_number)
i = x->x_number-1;
if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
{
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);
}
else
{
x->x_on_old = x->x_on;
x->x_on = i;/*tm*/
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);/*tm*/
outlet_float(x->x_gui.x_obj.ob_outlet, x->x_on);/*tm*/
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);
}
}
static void hradio_float(t_hradio *x, t_floatarg f)
{
int i=(int)f;
if(i < 0)
i = 0;
if(i >= x->x_number)
i = x->x_number-1;
if (pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class)
{
/* compatibility with earlier "vdial" behavior */
if((x->x_change)&&(i != x->x_on_old))
{
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);
}
}
else
{
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);/*tm*/
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);
}
}
}
More information about the Pd-dev
mailing list