Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24471
Modified Files: Tag: impd_0_37 g_hslider.c g_vslider.c u_object.tk Log Message: moving some slider code to Tcl
Index: g_hslider.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_hslider.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_hslider.c 5 Mar 2004 19:27:52 -0000 1.1.1.3.2.2.2.1 --- g_hslider.c 6 Mar 2004 22:14:39 -0000 1.1.1.3.2.2.2.2 *************** *** 34,61 **** { t_canvas *canvas=glist_getcanvas(glist); - int ypos=text_ypix(&x->x_gui.x_obj, glist); - if (glist_isvisible(glist)) { ! int r = text_xpix(&x->x_gui.x_obj, glist) + (x->x_val + 50)/100; ! sys_vgui(".x%x.c coords %xKNOB %d %d %d %d\n", ! canvas, x, r, ypos+1, ! r, ypos + x->x_gui.x_h); ! if(x->x_val == x->x_center) ! { ! if(!x->x_thick) ! { ! sys_vgui(".x%x.c itemconfigure %xKNOB -width 7\n", canvas, x); ! x->x_thick = 1; ! } ! } ! else ! { ! if(x->x_thick) ! { ! sys_vgui(".x%x.c itemconfigure %xKNOB -width 3\n", canvas, x); ! x->x_thick = 0; ! } ! } } } --- 34,40 ---- { t_canvas *canvas=glist_getcanvas(glist); if (glist_isvisible(glist)) { ! sys_vgui("slider_set .x%x.c %x %d 0 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); } } *************** *** 65,77 **** int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); - int r = xpos + (x->x_val + 50)/100; t_canvas *canvas=glist_getcanvas(glist); ! ! sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui(".x%x.c create line %d %d %d %d -width 3 -fill #%6.6x -tags %xKNOB\n", ! canvas, r, ypos+1, r, ! ypos + x->x_gui.x_h, x->x_gui.x_fcol, x); sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", --- 44,52 ---- int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_draw .x%x.c %x %d %d %d %d %d %d 0 #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui("slider_set .x%x.c %x %d 0 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", *************** *** 86,98 **** int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); - int r = xpos + (x->x_val + 50)/100; t_canvas *canvas=glist_getcanvas(glist); ! ! sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui(".x%x.c coords %xKNOB %d %d %d %d\n", ! canvas, x, r, ypos+1, ! r, ypos + x->x_gui.x_h); sys_vgui(".x%x.c coords %xLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); --- 61,69 ---- int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_draw .x%x.c %x %d %d %d %d %d %d 0 #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui("slider_set .x%x.c %x %d 0 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); sys_vgui(".x%x.c coords %xLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); *************** *** 102,108 **** { t_canvas *canvas=glist_getcanvas(glist); ! ! sys_vgui("bluebox_erase .x%x.c %xBASE\n", canvas, x); ! sys_vgui(".x%x.c delete %xKNOB\n", canvas, x); sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); } --- 73,77 ---- { t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_erase .x%x.c %x\n", canvas, x); sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); } *************** *** 111,120 **** { t_canvas *canvas=glist_getcanvas(glist); ! 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_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); ! sys_vgui(".x%x.c itemconfigure %xKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); sys_vgui("slider_select .x%x.c %xBASE %d\n", canvas, x, x->x_gui.x_fsf.x_selected); } --- 80,89 ---- { t_canvas *canvas=glist_getcanvas(glist); ! int xpos=text_xpix(&x->x_gui.x_obj, glist); 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_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); ! sys_vgui("slider_set .x%x.c %x %d 0 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); sys_vgui("slider_select .x%x.c %xBASE %d\n", canvas, x, x->x_gui.x_fsf.x_selected); } *************** *** 123,137 **** { t_canvas *canvas=glist_getcanvas(glist); ! ! if(x->x_gui.x_fsf.x_selected) ! { ! sys_vgui("slider_select .x%x.c %xBASE %d\n", canvas, x, x->x_gui.x_fsf.x_selected); ! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); ! } ! else ! { ! sys_vgui("slider_select .x%x.c %xBASE %d\n", canvas, x, x->x_gui.x_fsf.x_selected); ! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); ! } }
--- 92,98 ---- { t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected); ! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, ! x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol); }
*************** *** 201,215 **** if(x->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; ! } ! else ! { ! if(min > 0.0) ! max = 0.01*min; } } --- 162,170 ---- if(x->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; ! } else { ! if(min > 0.0) max = 0.01*min; } } *************** *** 257,271 **** if(x->x_gui.x_isa.x_reverse) /* bugfix */ { ! if(f > x->x_min) ! f = x->x_min; ! if(f < x->x_max) ! f = x->x_max; } else { ! if(f > x->x_max) ! f = x->x_max; ! if(f < x->x_min) ! f = x->x_min; } if(x->x_lin0_log1) --- 212,222 ---- if(x->x_gui.x_isa.x_reverse) /* bugfix */ { ! if(f > x->x_min) f = x->x_min; ! if(f < x->x_max) f = x->x_max; } else { ! if(f > x->x_max) f = x->x_max; ! if(f < x->x_min) f = x->x_min; } if(x->x_lin0_log1)
Index: g_vslider.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_vslider.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_vslider.c 5 Mar 2004 19:27:52 -0000 1.1.1.3.2.2.2.1 --- g_vslider.c 6 Mar 2004 22:14:39 -0000 1.1.1.3.2.2.2.2 *************** *** 33,44 **** static void vslider_draw_update(t_vslider *x, t_glist *glist) { if (glist_isvisible(glist)) { ! int r = text_ypix(&x->x_gui.x_obj, glist) + x->x_gui.x_h - (x->x_val + 50)/100; ! int xpos=text_xpix(&x->x_gui.x_obj, glist); ! ! sys_vgui(".x%x.c coords %xKNOB %d %d %d %d\n", ! glist_getcanvas(glist), x, xpos+1, r, ! xpos + x->x_gui.x_w, r); } } --- 33,40 ---- static void vslider_draw_update(t_vslider *x, t_glist *glist) { + t_canvas *canvas=glist_getcanvas(glist); if (glist_isvisible(glist)) { ! sys_vgui("slider_set .x%x.c %x %d 1 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); } } *************** *** 52,62 **** t_canvas *canvas=glist_getcanvas(glist);
! sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! ! sys_vgui(".x%x.c create line %d %d %d %d -width 3 -fill #%6.6x -tags %xKNOB\n", ! canvas, xpos+1, r, ! xpos + x->x_gui.x_w, r, x->x_gui.x_fcol, x); sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", --- 48,55 ---- t_canvas *canvas=glist_getcanvas(glist);
! sys_vgui("slider_draw .x%x.c %x %d %d %d %d %d %d 1 #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui("slider_set .x%x.c %x %d 1 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", *************** *** 72,81 **** int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui(".x%x.c coords %xKNOB %d %d %d %d\n", ! canvas, x, xpos+1, r, ! xpos + x->x_gui.x_w, r); sys_vgui(".x%x.c coords %xLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); --- 65,72 ---- int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_draw .x%x.c %x %d %d %d %d %d %d 1 #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,x->x_gui.x_bcol); ! sys_vgui("slider_set .x%x.c %x %d 1 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); sys_vgui(".x%x.c coords %xLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); *************** *** 85,91 **** { t_canvas *canvas=glist_getcanvas(glist); ! ! sys_vgui("bluebox_erase .x%x.c %xBASE\n", canvas, x); ! sys_vgui(".x%x.c delete %xKNOB\n", canvas, x); sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); } --- 76,80 ---- { t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_erase .x%x.c %x\n", canvas, x); sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); } *************** *** 101,106 **** x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); ! sys_vgui(".x%x.c itemconfigure %xKNOB -fill #%6.6x\n", canvas, ! x, x->x_gui.x_fcol); sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, --- 90,94 ---- x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); ! sys_vgui("slider_set .x%x.c %x %d 1 #%6.6x\n", canvas, x, x->x_val, x->x_gui.x_fcol); sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h, *************** *** 111,125 **** { 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); ! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED); ! } ! else ! { ! sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); ! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); ! } }
--- 99,105 ---- { t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("slider_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected); ! sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, ! x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_lcol); }
Index: u_object.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** u_object.tk 6 Mar 2004 20:56:29 -0000 1.1.2.3 --- u_object.tk 6 Mar 2004 22:14:39 -0000 1.1.2.4 *************** *** 247,250 **** --- 247,288 ---- }
+ proc slider_draw {canvas tag x1 y1 x2 y2 ins outs orient colour} { + set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0] + bluebox_draw $canvas ${tag}BASE $x1 $y1 $x2 $y2 $ins $outs $colour + if {$isnew} { + set color [bluify #ffffff] + $canvas create rectangle $x1 $y1 $x1 $y1 -tags ${tag}KNOB \ + -outline #000000 -fill [darker $color] + } + } + + proc slider_set {canvas tag value orient colour} { + post_to_gui "slider_set: $value $orient\n" + set pos [$canvas coords ${tag}BASE] + set x1 [lindex $pos 0] + set y1 [lindex $pos 1] + if {$orient} { + set size [expr [lindex $pos 2]-$x1] + set y1 [expr [lindex $pos 3]-($value+50)/100] + set y2 [expr $y1+2] + $canvas coords ${tag}KNOB \ + [expr $x1+2] $y1 \ + [expr $x1+$size-2] $y2 + } { + set size [expr [lindex $pos 3]-$y1] + set x1 [expr $x1+($value+50)/100] + set x2 [expr $x1+2] + set y2 [expr $y1+$size] + $canvas coords ${tag}KNOB \ + $x1 [expr $y1+2] \ + $x2 [expr $y1+$size-2] + } + } + + proc slider_erase {canvas tag} { + bluebox_erase $canvas ${tag}BASE + $canvas delete ${tag}KNOB + } + proc bang_draw {canvas tag x1 y1 x2 y2 ins outs colour} { bluebox_draw $canvas ${tag}BASE $x1 $y1 $x2 $y2 $ins $outs $colour