Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19172
Modified Files: Tag: impd_0_37 g_all_guis.h g_all_guis.c g_hslider.c g_numbox.c Log Message: removing t_iemgui's x_lin0_log1
Index: g_hslider.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v retrieving revision 1.1.1.3.2.2.2.29 retrieving revision 1.1.1.3.2.2.2.30 diff -C2 -d -r1.1.1.3.2.2.2.29 -r1.1.1.3.2.2.2.30 *** g_hslider.c 12 May 2004 09:20:26 -0000 1.1.1.3.2.2.2.29 --- g_hslider.c 12 May 2004 10:06:58 -0000 1.1.1.3.2.2.2.30 *************** *** 45,49 **** double l = (double)(isvert(x) ? x->x_gui.x_h : x->x_gui.x_w)-1; int m = l*100; ! double span = x->x_gui.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;} --- 45,49 ---- double l = (double)(isvert(x) ? x->x_gui.x_h : x->x_gui.x_w)-1; int m = l*100; ! double span = x->x_is_log ? 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;} *************** *** 56,60 **** double min=x->x_min, max=x->x_max; double diff; ! if(x->x_gui.x_lin0_log1) { if(min == 0.0 && max == 0.0) max = 1.0; if(max > 0.0) { if (min<=0.0) min = 0.01*max; } --- 56,60 ---- double min=x->x_min, max=x->x_max; double diff; ! if(x->x_is_log) { if(min == 0.0 && max == 0.0) max = 1.0; if(max > 0.0) { if (min<=0.0) min = 0.01*max; } *************** *** 63,67 **** x->x_min = min; x->x_max = max; ! diff = x->x_gui.x_lin0_log1 ? log(x->x_max/x->x_min) : (x->x_max-x->x_min); x->x_k = isvert(x) ? diff/(double)(x->x_gui.x_h-1) : --- 63,67 ---- x->x_min = min; x->x_max = max; ! diff = x->x_is_log ? log(x->x_max/x->x_min) : (x->x_max-x->x_min); x->x_k = isvert(x) ? diff/(double)(x->x_gui.x_h-1) : *************** *** 76,80 **** else { /* normal */ CLAMP(f,x->x_min,x->x_max); } ! g = (x->x_gui.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; --- 76,80 ---- else { /* normal */ CLAMP(f,x->x_min,x->x_max); } ! g = (x->x_is_log ? 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; *************** *** 84,88 **** static void slider_bang(t_slider *x) { ! double out = x->x_gui.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; --- 84,88 ---- static void slider_bang(t_slider *x) { ! double out = x->x_is_log ? 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; *************** *** 107,112 **** static void slider_range(t_slider *x, t_float min, t_float max) {x->x_min = min; x->x_max = max; slider_check_minmax(x);} ! static void slider_lin(t_slider *x) {x->x_gui.x_lin0_log1 = 0; x->x_k = (x->x_max-x->x_min)/(double)((isvert(x)?x->x_gui.x_h:x->x_gui.x_w)-1);} ! static void slider_log(t_slider *x) {x->x_gui.x_lin0_log1 = 1; slider_check_minmax(x);} static void slider_steady(t_slider *x, t_floatarg f) {x->x_steady = !!f;} static void slider_float(t_slider *x, t_floatarg f) --- 107,112 ---- static void slider_range(t_slider *x, t_float min, t_float max) {x->x_min = min; x->x_max = max; slider_check_minmax(x);} ! static void slider_lin(t_slider *x) {x->x_is_log=0; x->x_k = (x->x_max-x->x_min)/(double)((isvert(x)?x->x_gui.x_h:x->x_gui.x_w)-1);} ! static void slider_log(t_slider *x) {x->x_is_log=1; slider_check_minmax(x);} static void slider_steady(t_slider *x, t_floatarg f) {x->x_steady = !!f;} static void slider_float(t_slider *x, t_floatarg f) *************** *** 118,130 **** { t_iemgui *y = (t_iemgui *)x; ! int v,lilo; binbuf_update(y,gensym(isvert(x)?"vsl":"hsl"),argc,argv); if(!pd_scanargs(argc,argv,"iiddbiaaaiiiiccci;b", ! &y->x_w,&y->x_h,&x->x_min,&x->x_max,&lilo,&y->x_isa, &y->x_snd,&y->x_rcv,&y->x_lab, &y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize, &y->x_bcol,&y->x_fcol,&y->x_lcol,&v,&x->x_steady)) return; x->x_pos = x->x_val = y->x_isa&1 ? v : 0; - y->x_lin0_log1 = lilo; iemgui_constrain(y); slider_check_minmax(x); --- 118,129 ---- { t_iemgui *y = (t_iemgui *)x; ! int v; binbuf_update(y,gensym(isvert(x)?"vsl":"hsl"),argc,argv); if(!pd_scanargs(argc,argv,"iiddbiaaaiiiiccci;b", ! &y->x_w,&y->x_h,&x->x_min,&x->x_max,&x->x_is_log,&y->x_isa, &y->x_snd,&y->x_rcv,&y->x_lab, &y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize, &y->x_bcol,&y->x_fcol,&y->x_lcol,&v,&x->x_steady)) return; x->x_pos = x->x_val = y->x_isa&1 ? v : 0; iemgui_constrain(y); slider_check_minmax(x); *************** *** 140,143 **** --- 139,143 ---- t_slider *x = (t_slider *)y; x->x_flavor=s; + x->x_is_log=0; x->x_min=0.0; x->x_steady=0;
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.29 retrieving revision 1.1.1.4.2.2.2.30 diff -C2 -d -r1.1.1.4.2.2.2.29 -r1.1.1.4.2.2.2.30 *** g_all_guis.h 12 May 2004 09:58:11 -0000 1.1.1.4.2.2.2.29 --- g_all_guis.h 12 May 2004 10:06:58 -0000 1.1.1.4.2.2.2.30 *************** *** 22,26 **** int x_ldx, x_ldy; int x_isa; /* bit 0: loadinit; bit 20: scale */ ! unsigned x_put_in2out:1,x_lin0_log1:1; int x_font_style, x_fontsize; int x_fcol, x_bcol, x_lcol; /* foreground, background, label colors */ --- 22,26 ---- int x_ldx, x_ldy; int x_isa; /* bit 0: loadinit; bit 20: scale */ ! unsigned x_put_in2out:1; int x_font_style, x_fontsize; int x_fcol, x_bcol, x_lcol; /* foreground, background, label colors */ *************** *** 50,53 **** --- 50,54 ---- double x_k; int x_steady; + int x_is_log; } t_slider;
*************** *** 112,115 **** --- 113,117 ---- int x_finemoved; int x_change; + int x_is_log; } t_my_numbox;
Index: g_numbox.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_numbox.c,v retrieving revision 1.1.1.4.2.2.2.24 retrieving revision 1.1.1.4.2.2.2.25 diff -C2 -d -r1.1.1.4.2.2.2.24 -r1.1.1.4.2.2.2.25 *** g_numbox.c 12 May 2004 09:20:26 -0000 1.1.1.4.2.2.2.24 --- g_numbox.c 12 May 2004 10:06:58 -0000 1.1.1.4.2.2.2.25 *************** *** 56,60 **** double min=x->x_min, max=x->x_max; int val=x->x_val; ! if(x->x_gui.x_lin0_log1) { if(min==0.0 && max==0.0) max = 1.0; if(max>0.0 && min<=0.0) min = 0.01*max; --- 56,60 ---- double min=x->x_min, max=x->x_max; int val=x->x_val; ! if(x->x_is_log) { if(min==0.0 && max==0.0) max = 1.0; if(max>0.0 && min<=0.0) min = 0.01*max; *************** *** 64,68 **** x->x_max = max; CLAMP(x->x_val,x->x_min,x->x_max); ! x->x_k = x->x_gui.x_lin0_log1 ? exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)) : 1.0; return x->x_val!=val; } --- 64,68 ---- x->x_max = max; CLAMP(x->x_val,x->x_min,x->x_max); ! x->x_k = x->x_is_log ? exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)) : 1.0; return x->x_val!=val; } *************** *** 78,82 **** { double k2= x->x_finemoved ? 0.01 : 1.0; ! if(x->x_gui.x_lin0_log1) x->x_val *= pow(x->x_k, -k2*dy); else x->x_val -= k2*dy; my_numbox_clip(x); iemgui_dodraw((t_iemgui *)x); --- 78,82 ---- { double k2= x->x_finemoved ? 0.01 : 1.0; ! if(x->x_is_log) x->x_val *= pow(x->x_k, -k2*dy); else x->x_val -= k2*dy; my_numbox_clip(x); iemgui_dodraw((t_iemgui *)x); *************** *** 91,95 **** { x->x_log_height = MAX(10.0,(int)lh); ! x->x_k = x->x_gui.x_lin0_log1 ? exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)) : 1.0; }
--- 91,95 ---- { x->x_log_height = MAX(10.0,(int)lh); ! x->x_k = x->x_is_log ? exp(log(x->x_max/x->x_min)/(double)(x->x_log_height)) : 1.0; }
*************** *** 109,114 **** if(my_numbox_check_minmax(x)) iemgui_dodraw((t_iemgui *)x);}
! static void my_numbox_lin(t_my_numbox *x) {x->x_gui.x_lin0_log1 = 0;} ! static void my_numbox_log(t_my_numbox *x) {x->x_gui.x_lin0_log1 = 1; if(my_numbox_check_minmax(x)) iemgui_dodraw((t_iemgui *)x);}
--- 109,114 ---- if(my_numbox_check_minmax(x)) iemgui_dodraw((t_iemgui *)x);}
! static void my_numbox_lin(t_my_numbox *x) {x->x_is_log=0;} ! static void my_numbox_log(t_my_numbox *x) {x->x_is_log=1; if(my_numbox_check_minmax(x)) iemgui_dodraw((t_iemgui *)x);}
*************** *** 126,136 **** { t_iemgui *y = (t_iemgui *)x; ! int lilo=0, w; binbuf_update(y,gensym("nbx"),argc,argv); if(!pd_scanargs(argc,argv,"iiddbiaaaiiiicccd;i", ! &y->x_w,&y->x_h,&x->x_min,&x->x_max,&lilo,&y->x_isa,&y->x_snd,&y->x_rcv,&y->x_lab, &y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize, &y->x_bcol,&y->x_fcol,&y->x_lcol,&x->x_val,&x->x_log_height)) return; - y->x_lin0_log1 = lilo; if (!y->x_isa&1) x->x_val=0.0; w=y->x_w; --- 126,135 ---- { t_iemgui *y = (t_iemgui *)x; ! int w; binbuf_update(y,gensym("nbx"),argc,argv); if(!pd_scanargs(argc,argv,"iiddbiaaaiiiicccd;i", ! &y->x_w,&y->x_h,&x->x_min,&x->x_max,&x->x_is_log,&y->x_isa,&y->x_snd,&y->x_rcv,&y->x_lab, &y->x_ldx,&y->x_ldy,&y->x_font_style,&y->x_fontsize, &y->x_bcol,&y->x_fcol,&y->x_lcol,&x->x_val,&x->x_log_height)) return; if (!y->x_isa&1) x->x_val=0.0; w=y->x_w; *************** *** 149,152 **** --- 148,152 ---- t_my_numbox *x = (t_my_numbox *)y; x->x_log_height = 256; + x->x_is_log = 0; y->x_w=5; y->x_h=14;
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.34 retrieving revision 1.1.1.4.2.4.2.35 diff -C2 -d -r1.1.1.4.2.4.2.34 -r1.1.1.4.2.4.2.35 *** g_all_guis.c 12 May 2004 09:58:11 -0000 1.1.1.4.2.4.2.34 --- g_all_guis.c 12 May 2004 10:06:58 -0000 1.1.1.4.2.4.2.35 *************** *** 351,355 **** x->x_fontsize = 8; x->x_put_in2out = 1; - x->x_lin0_log1 = 0; x->x_snd = 0; x->x_rcv = 0; --- 351,354 ---- *************** *** 358,362 **** x->x_fcol = 0x000000; x->x_lcol = 0x000000; - x->x_lin0_log1 = 0; return x; } --- 357,360 ----