[PD-cvs] pd/src desire.c,1.1.2.217.2.77,1.1.2.217.2.78
Mathieu Bouchard
matju at users.sourceforge.net
Tue Dec 19 07:04:41 CET 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5878
Modified Files:
Tag: desiredata
desire.c
Log Message:
replaced "flavor" field in sliders by "orient" and in radios by "orient" and "oldstyle"
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.77
retrieving revision 1.1.2.217.2.78
diff -C2 -d -r1.1.2.217.2.77 -r1.1.2.217.2.78
*** desire.c 19 Dec 2006 03:29:15 -0000 1.1.2.217.2.77
--- desire.c 19 Dec 2006 06:04:36 -0000 1.1.2.217.2.78
***************
*** 5756,5760 ****
struct t_slider : t_iemgui {
- t_symbol *flavor;
int pos;
int val;
--- 5756,5759 ----
***************
*** 5763,5774 ****
int steady;
int is_log;
};
struct t_radio : t_iemgui {
- t_symbol *flavor;
int on, on_old;
int change;
int number;
t_atom at[2];
};
--- 5762,5775 ----
int steady;
int is_log;
+ int orient;
};
struct t_radio : t_iemgui {
int on, on_old;
int change;
int number;
t_atom at[2];
+ int orient;
+ int oldstyle;
};
***************
*** 5811,5815 ****
static t_class *radio_class, *slider_class;
! static t_symbol *sym_hdl, *sym_vdl, *sym_vradio, *sym_vsl, *sym_vslider;
t_class *dummy_class;
--- 5812,5816 ----
static t_class *radio_class, *slider_class;
! static t_symbol *sym_hdl, *sym_hradio, *sym_vdl, *sym_vradio, *sym_vsl, *sym_vslider;
t_class *dummy_class;
***************
*** 6741,6750 ****
}
- static int isvert(void /* t_slider or t_radio */ *x_) {
- t_slider *x = (t_slider *)x_;
- return x->flavor == sym_vdl || x->flavor == sym_vradio ||
- x->flavor == sym_vsl || x->flavor == sym_vslider;
- }
-
static void radio_set(t_radio *x, t_floatarg f) {
int i=(int)f;
--- 6742,6745 ----
***************
*** 6769,6774 ****
static void radio_bang(t_radio *x) {
! /* compatibility with earlier "hdial" behavior */
! if (x->flavor == sym_vdl || x->flavor == sym_hdl) {
if(x->change && x->on!=x->on_old) radio_send2(x,x->on_old,0.0);
SET(on_old,x->on);
--- 6764,6768 ----
static void radio_bang(t_radio *x) {
! if (x->oldstyle) {
if(x->change && x->on!=x->on_old) radio_send2(x,x->on_old,0.0);
SET(on_old,x->on);
***************
*** 6780,6787 ****
static void radio_fout2(t_radio *x, t_floatarg f, int forwardonly) {
- int isdial = x->flavor == sym_vdl || x->flavor == sym_hdl;
int i=(int)f;
CLAMP(i,0,x->number-1);
! if (isdial) {
/* compatibility with earlier "hdial" behavior */
if(x->change && i!=x->on_old && (!forwardonly || iemgui_forward(x))) radio_send2(x,x->on_old,0.0);
--- 6774,6780 ----
static void radio_fout2(t_radio *x, t_floatarg f, int forwardonly) {
int i=(int)f;
CLAMP(i,0,x->number-1);
! if (x->oldstyle) {
/* compatibility with earlier "hdial" behavior */
if(x->change && i!=x->on_old && (!forwardonly || iemgui_forward(x))) radio_send2(x,x->on_old,0.0);
***************
*** 6825,6836 ****
}
static void radio_savefn(t_radio *x, t_binbuf *b) {
t_foo foo = {0,0,b}; if (!b) return;
! pd_savehead(b,x,x->flavor->s_name); radio_pickle(x,&foo);
}
static void radio_reload(t_radio *x, t_symbol *s, int argc, t_atom *argv) {
t_foo foo = { argc, argv, 0 };
! binbuf_update(x,x->flavor,argc,argv);
if (!radio_pickle(x,&foo)) return;
iemgui_constrain(x);
--- 6818,6834 ----
}
+ static t_symbol *radio_flavor(t_radio *x) {
+ return x->orient?x->oldstyle?sym_vdl:sym_vradio:x->oldstyle?sym_hdl:sym_hradio;
+ }
+
static void radio_savefn(t_radio *x, t_binbuf *b) {
t_foo foo = {0,0,b}; if (!b) return;
! pd_savehead(b,x,radio_flavor(x)->s_name);
! radio_pickle(x,&foo);
}
static void radio_reload(t_radio *x, t_symbol *s, int argc, t_atom *argv) {
t_foo foo = { argc, argv, 0 };
! binbuf_update(x,radio_flavor(x),argc,argv);
if (!radio_pickle(x,&foo)) return;
iemgui_constrain(x);
***************
*** 6845,6849 ****
SET(number,8);
SET(change,1);
! SET(flavor,s);
SET(on,x->isa&1 ? x->on : 0);
SET(on_old,x->on);
--- 6843,6850 ----
SET(number,8);
SET(change,1);
! if (s==sym_hdl) {SET(orient,0); SET(oldstyle,0);} else
! if (s==sym_vdl) {SET(orient,1); SET(oldstyle,0);} else
! if (s==sym_hradio) {SET(orient,0); SET(oldstyle,1);} else
! if (s==sym_vradio) {SET(orient,1); SET(oldstyle,1);}
SET(on,x->isa&1 ? x->on : 0);
SET(on_old,x->on);
***************
*** 6857,6865 ****
static void slider_check_width(t_slider *x, int w) {
! double l = (double)(isvert(x) ? x->h : x->w)-1;
int m = (int)(l*100);
double span = x->is_log ? log(x->max/x->min) : (x->max - x->min);
if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE;
! if (isvert(x)) SET(h,w); else SET(w,w);
if(x->val > m) {SET(pos,m); SET(val,x->pos);}
SET(k,span/l);
--- 6858,6866 ----
static void slider_check_width(t_slider *x, int w) {
! double l = (double)(x->orient ? x->h : x->w)-1;
int m = (int)(l*100);
double span = x->is_log ? log(x->max/x->min) : (x->max - x->min);
if(w < IEM_SL_MINSIZE) w = IEM_SL_MINSIZE;
! if (x->orient) SET(h,w); else SET(w,w);
if(x->val > m) {SET(pos,m); SET(val,x->pos);}
SET(k,span/l);
***************
*** 6876,6880 ****
SET(max,max);
double diff = x->is_log ? log(x->max/x->min) : (x->max-x->min);
! SET(k,diff / (double)(isvert(x) ? (x->h-1) : (x->w-1)));
}
--- 6877,6881 ----
SET(max,max);
double diff = x->is_log ? log(x->max/x->min) : (x->max-x->min);
! SET(k,diff / (double)(x->orient ? (x->h-1) : (x->w-1)));
}
***************
*** 6901,6905 ****
int a = atom_getintarg(0,ac,av);
int b = ac>1 ? atom_getintarg(1,ac,av) : 0;
! if (isvert(x)) {
SET(w,iemgui_clip_size(a));
if(ac>1) slider_check_width(x,b);
--- 6902,6906 ----
int a = atom_getintarg(0,ac,av);
int b = ac>1 ? atom_getintarg(1,ac,av) : 0;
! if (x->orient) {
SET(w,iemgui_clip_size(a));
if(ac>1) slider_check_width(x,b);
***************
*** 6926,6935 ****
static void slider_savefn(t_slider *x, t_binbuf *b) {
t_foo foo = {0,0,b}; if (!b) return;
! pd_savehead(b,x,(char *)(isvert(x)?"vsl":"hsl")); slider_pickle(x,&foo);
}
static void slider_reload(t_slider *x, t_symbol *s, int argc, t_atom *argv) {
t_foo foo = { argc, argv, 0 };
! binbuf_update(x,gensym((char *)(isvert(x)?"vsl":"hsl")),argc,argv);
if (!slider_pickle(x,&foo)) return;
// fprintf(stderr,"STEADY=%d\n",x->steady);
--- 6927,6936 ----
static void slider_savefn(t_slider *x, t_binbuf *b) {
t_foo foo = {0,0,b}; if (!b) return;
! pd_savehead(b,x,(char *)(x->orient?"vsl":"hsl")); slider_pickle(x,&foo);
}
static void slider_reload(t_slider *x, t_symbol *s, int argc, t_atom *argv) {
t_foo foo = { argc, argv, 0 };
! binbuf_update(x,gensym((char *)(x->orient?"vsl":"hsl")),argc,argv);
if (!slider_pickle(x,&foo)) return;
// fprintf(stderr,"STEADY=%d\n",x->steady);
***************
*** 6940,6944 ****
iemgui_constrain(x);
slider_check_minmax(x);
! slider_check_width(x, isvert(x) ? x->h : x->w);
if(x->rcv) pd_bind(x,x->rcv);
gobj_changed(x,0);
--- 6941,6945 ----
iemgui_constrain(x);
slider_check_minmax(x);
! slider_check_width(x, x->orient ? x->h : x->w);
if(x->rcv) pd_bind(x,x->rcv);
gobj_changed(x,0);
***************
*** 6947,6956 ****
static void *slider_new(t_symbol *s, int argc, t_atom *argv) {
t_slider *x = (t_slider *)iemgui_new(slider_class);
! SET(flavor,s);
SET(is_log,0);
SET(min,0.0);
SET(steady,1);
SET(max,(double)(IEM_SL_DEFAULTSIZE-1));
! if (isvert(x)) SET(h,IEM_SL_DEFAULTSIZE); else SET(w,IEM_SL_DEFAULTSIZE);
outlet_new(x, &s_float);
slider_reload(x,0,argc,argv);
--- 6948,6957 ----
static void *slider_new(t_symbol *s, int argc, t_atom *argv) {
t_slider *x = (t_slider *)iemgui_new(slider_class);
! SET(orient,s==sym_vslider||s==sym_vsl);
SET(is_log,0);
SET(min,0.0);
SET(steady,1);
SET(max,(double)(IEM_SL_DEFAULTSIZE-1));
! if (x->orient) SET(h,IEM_SL_DEFAULTSIZE); else SET(w,IEM_SL_DEFAULTSIZE);
outlet_new(x, &s_float);
slider_reload(x,0,argc,argv);
***************
*** 7613,7619 ****
class_addmethod3(c,radio_single_change, "single_change","");
class_addmethod3(c,radio_double_change, "double_change","");
! sym_hdl = gensym("hdl");
! sym_vdl = gensym("vdl");
! sym_vradio = gensym("vradio");
class_setsavefn(c,(t_savefn)radio_savefn);
class_sethelpsymbol(c, gensym("hradio"));
--- 7614,7619 ----
class_addmethod3(c,radio_single_change, "single_change","");
class_addmethod3(c,radio_double_change, "double_change","");
! sym_hdl = gensym("hdl"); sym_hradio = gensym("hradio");
! sym_vdl = gensym("vdl"); sym_vradio = gensym("vradio");
class_setsavefn(c,(t_savefn)radio_savefn);
class_sethelpsymbol(c, gensym("hradio"));
More information about the Pd-cvs
mailing list