Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31929
Modified Files: Tag: impd_0_37 g_bang.c g_toggle.c u_object.tk Log Message: TCLified bng & tgl
Index: g_bang.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_bang.c,v retrieving revision 1.1.1.3.2.2.2.3 retrieving revision 1.1.1.3.2.2.2.4 diff -C2 -d -r1.1.1.3.2.2.2.3 -r1.1.1.3.2.2.2.4 *** g_bang.c 7 Mar 2004 19:38:13 -0000 1.1.1.3.2.2.2.3 --- g_bang.c 8 Mar 2004 02:28:00 -0000 1.1.1.3.2.2.2.4 *************** *** 23,132 **** #endif
- - /* --------------- bng gui-bang ------------------------- */ - t_widgetbehavior bng_widgetbehavior; static t_class *bng_class;
! /* widget helper functions */ ! ! ! void bng_draw_update(t_bng *x, t_glist *glist) ! { ! if(glist_isvisible(glist)) ! { sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", glist_getcanvas(glist), x, ! pd_bluify(x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol)); ! } ! } ! ! void bng_draw_new(t_bng *x, t_glist *glist) ! { ! 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("bang_draw .x%x.c %x %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 oval %d %d %d %d -fill #%6.6x -tags %xBUT\n", ! canvas, xpos+2, ypos+2, ! xpos + x->x_gui.x_w-2, ypos + x->x_gui.x_h-2, ! pd_bluify(x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol), x); ! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ ! -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", ! canvas, xpos+x->x_gui.x_ldx, ! ypos+x->x_gui.x_ldy, ! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", ! x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x); ! } ! ! void bng_draw_move(t_bng *x, t_glist *glist) ! { ! 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("bang_draw .x%x.c %x %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 %xBUT %d %d %d %d\n", ! canvas, x, xpos+2,ypos+2, ! xpos + x->x_gui.x_w-2, ypos + x->x_gui.x_h-2); ! sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", canvas, x, ! pd_bluify(x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol)); ! sys_vgui(".x%x.c coords %xLABEL %d %d\n", ! canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); ! } ! ! void bng_draw_erase(t_bng* x, t_glist* glist) ! { ! t_canvas *canvas=glist_getcanvas(glist); ! sys_vgui("bang_erase .x%x.c %x\n", canvas, x); ! sys_vgui(".x%x.c delete %xBUT\n", canvas, x); ! sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); ! } ! ! void bng_draw_config(t_bng* x, t_glist* glist) ! { ! 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 %xBASE -fill #%6.6x\n", canvas, x, pd_bluify(x->x_gui.x_bcol)); ! sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", canvas, x, ! pd_bluify(x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol)); ! } ! ! void bng_draw_select(t_bng* x, t_glist* glist) ! { ! 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 %xBUT -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 %xBUT -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); ! } ! } ! ! void bng_draw(t_bng *x, t_glist *glist, int mode) ! { ! if (mode == IEM_GUI_DRAW_MODE_UPDATE) bng_draw_update(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_MOVE) bng_draw_move(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_NEW) bng_draw_new(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_SELECT) bng_draw_select(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_ERASE) bng_draw_erase(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_CONFIG) bng_draw_config(x, glist); ! else if(mode >= IEM_GUI_DRAW_MODE_IO) bng_draw_move(x, glist); ! }
/* ------------------------ bng widgetbehaviour----------------------------- */ --- 23,52 ---- #endif
t_widgetbehavior bng_widgetbehavior; static t_class *bng_class;
! void bng_draw(t_bng *x, t_glist *glist, int mode) { ! t_canvas *canvas=glist_getcanvas(glist); ! switch(mode) { ! case IEM_GUI_DRAW_MODE_UPDATE: ! if(glist_isvisible(glist)) sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", glist_getcanvas(glist), x, ! pd_bluify(x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol)); ! break; ! case IEM_GUI_DRAW_MODE_ERASE: ! sys_vgui("bang_erase .x%x.c %x\n", canvas, x); ! break; ! case IEM_GUI_DRAW_MODE_SELECT: ! sys_vgui("bang_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected); ! break; ! default:{ ! int xpos=text_xpix(&x->x_gui.x_obj, glist); ! int ypos=text_ypix(&x->x_gui.x_obj, glist); ! sys_vgui("bang_draw .x%x.c %x %d %d %d %d %d %d #%6.6x {%s} %d %d {%s %d bold} #%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, ! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", ! x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol); ! }}}
/* ------------------------ bng widgetbehaviour----------------------------- */
Index: g_toggle.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_toggle.c,v retrieving revision 1.1.1.3.2.2.2.2 retrieving revision 1.1.1.3.2.2.2.3 diff -C2 -d -r1.1.1.3.2.2.2.2 -r1.1.1.3.2.2.2.3 *** g_toggle.c 7 Mar 2004 19:38:13 -0000 1.1.1.3.2.2.2.2 --- g_toggle.c 8 Mar 2004 02:28:00 -0000 1.1.1.3.2.2.2.3 *************** *** 23,169 **** #endif
- /* --------------- tgl gui-toggle ------------------------- */ - t_widgetbehavior toggle_widgetbehavior; static t_class *toggle_class;
! /* widget helper functions */ ! ! void toggle_draw_update(t_toggle *x, t_glist *glist) ! { ! if(glist_isvisible(glist)) ! { ! t_canvas *canvas=glist_getcanvas(glist); ! ! sys_vgui(".x%x.c itemconfigure %xX1 -fill #%6.6x\n", canvas, x, ! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol)); ! sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, ! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol)); ! } ! } ! ! void toggle_draw_new(t_toggle *x, t_glist *glist) ! { ! t_canvas *canvas=glist_getcanvas(glist); ! int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); ! int x1=xx,y1=yy,x2=xx+x->x_gui.x_w,y2=yy+x->x_gui.x_h; ! if(x->x_gui.x_w >= 30) ! w = 2; ! if(x->x_gui.x_w >= 60) ! w = 3; ! sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", ! canvas,x, x1,y1,x2,y2, ! !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 %d -fill #%6.6x -tags %xX1\n", ! canvas, xx+w+3, yy+w+3, xx + x->x_gui.x_w-w-1, yy + x->x_gui.x_h-w-1, w, ! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol), x); ! sys_vgui(".x%x.c create line %d %d %d %d -width %d -fill #%6.6x -tags %xX2\n", ! canvas, xx+w+3, yy + x->x_gui.x_h-w-2, xx + x->x_gui.x_w-w-1, yy+w+2, w, ! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol), x); ! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \ ! -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n", ! canvas, xx+x->x_gui.x_ldx, ! yy+x->x_gui.x_ldy, ! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", ! x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x); ! } ! ! void toggle_draw_move(t_toggle *x, t_glist *glist) ! { ! t_canvas *canvas=glist_getcanvas(glist); ! int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); ! int x1=xx,y1=yy,x2=xx+x->x_gui.x_w,y2=yy+x->x_gui.x_h; ! ! if(x->x_gui.x_w >= 30) ! w = 2; ! ! if(x->x_gui.x_w >= 60) ! w = 3; ! sys_vgui("bluebox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x\n", ! canvas,x, x1,y1,x2,y2, ! !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 itemconfigure %xX1 -width %d\n", canvas, x, w); ! sys_vgui(".x%x.c coords %xX1 %d %d %d %d\n", ! canvas, x, xx+w+1, yy+w+1, xx + x->x_gui.x_w-w, yy + x->x_gui.x_h-w); ! sys_vgui(".x%x.c itemconfigure %xX2 -width %d\n", canvas, x, w); ! sys_vgui(".x%x.c coords %xX2 %d %d %d %d\n", ! canvas, x, xx+w+1, yy + x->x_gui.x_h-w-1, xx + x->x_gui.x_w-w, yy+w); ! sys_vgui(".x%x.c coords %xLABEL %d %d\n", ! canvas, x, xx+x->x_gui.x_ldx, yy+x->x_gui.x_ldy); ! } ! ! void toggle_draw_erase(t_toggle* x, t_glist* glist) ! { ! t_canvas *canvas=glist_getcanvas(glist); ! ! sys_vgui("bluebox_erase .x%x.c %xBASE\n", canvas, x); ! sys_vgui(".x%x.c delete %xX1\n", canvas, x); ! sys_vgui(".x%x.c delete %xX2\n", canvas, x); ! sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); ! } ! ! void toggle_draw_config(t_toggle* x, t_glist* glist) ! { ! 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 %xBASE -fill #%6.6x\n", canvas, x, ! x->x_gui.x_bcol); ! sys_vgui(".x%x.c itemconfigure %xX1 -fill #%6.6x\n", canvas, x, ! x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); ! sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, ! x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); ! } ! ! void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags) ! { ! 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); ! ! if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able) ! sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xOUT%d\n", ! canvas, xpos, ! ypos + x->x_gui.x_h-1, xpos + IOWIDTH, ! ypos + x->x_gui.x_h, x, 0); ! if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able) ! sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); ! if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able) ! sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", ! canvas, xpos, ypos, ! xpos + IOWIDTH, ypos+1, x, 0); ! if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) ! sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); ! } ! ! void toggle_draw_select(t_toggle* x, t_glist* glist) ! { ! 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); ! } ! } ! ! void toggle_draw(t_toggle *x, t_glist *glist, int mode) ! { ! if (mode == IEM_GUI_DRAW_MODE_UPDATE) toggle_draw_update(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_MOVE) toggle_draw_move(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_NEW) toggle_draw_new(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_SELECT) toggle_draw_select(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_ERASE) toggle_draw_erase(x, glist); ! else if(mode == IEM_GUI_DRAW_MODE_CONFIG) toggle_draw_config(x, glist); ! else if(mode >= IEM_GUI_DRAW_MODE_IO) toggle_draw_io(x, glist, mode - IEM_GUI_DRAW_MODE_IO); ! }
/* ------------------------ tgl widgetbehaviour----------------------------- */ --- 23,55 ---- #endif
t_widgetbehavior toggle_widgetbehavior; static t_class *toggle_class;
! void toggle_draw(t_toggle *x, t_glist *glist, int mode) { ! t_canvas *canvas=glist_getcanvas(glist); ! switch(mode) { ! case IEM_GUI_DRAW_MODE_UPDATE: ! if(glist_isvisible(glist)) { ! sys_vgui(".x%x.c itemconfigure %xX1 -fill #%6.6x\n", canvas, x, ! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol)); ! sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, ! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol)); ! } ! break; ! case IEM_GUI_DRAW_MODE_ERASE: ! sys_vgui("toggle_erase .x%x.c %x\n", canvas, x); ! break; ! case IEM_GUI_DRAW_MODE_SELECT: ! sys_vgui("toggle_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected); ! break; ! default:{ ! int xpos=text_xpix(&x->x_gui.x_obj, glist); ! int ypos=text_ypix(&x->x_gui.x_obj, glist); ! sys_vgui("toggle_draw .x%x.c %x %d %d %d %d %d %d #%6.6x {%s} %d %d {%s %d bold} #%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, ! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", ! x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol); ! }}}
/* ------------------------ tgl widgetbehaviour----------------------------- */
Index: u_object.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** u_object.tk 6 Mar 2004 22:14:39 -0000 1.1.2.4 --- u_object.tk 8 Mar 2004 02:28:00 -0000 1.1.2.5 *************** *** 25,28 **** --- 25,29 ---- global look set xys [list $x1 $y1 $x2 $y2] + if {[llength [$canvas gettags $tag]] != 0} { eval "$canvas coords $tag $xys" *************** *** 160,164 ****
proc atom_select {canvas tag flag} { ! if {$flag} {set colour #0000ff} {set colour #000000} $canvas itemconfigure $tag -outline $colour } --- 161,166 ----
proc atom_select {canvas tag flag} { ! global look ! if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)} $canvas itemconfigure $tag -outline $colour } *************** *** 193,197 ****
proc bluebox_select {canvas tag flag} { ! if {$flag} {set colour #0000ff} {set colour #000000} $canvas itemconfigure $tag -outline $colour } --- 195,200 ----
proc bluebox_select {canvas tag flag} { ! global look ! if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)} $canvas itemconfigure $tag -outline $colour } *************** *** 203,207 ****
proc slider_select {canvas tag flag} { ! if {$flag} {set colour #0000ff} {set colour #000000} $canvas itemconfigure $tag -outline $colour } --- 206,211 ----
proc slider_select {canvas tag flag} { ! global look ! if {$flag} {set colour $look(objectframe4)} {set colour $look(objectframe3)} $canvas itemconfigure $tag -outline $colour } *************** *** 237,241 ****
proc radio_set {canvas tag value} { - post_to_gui "radio_set: $value\n" $canvas itemconfigure ${tag}BUT -fill #ffffff $canvas itemconfigure ${tag}BUT$value -fill #000000 --- 241,244 ---- *************** *** 258,262 ****
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] --- 261,264 ---- *************** *** 280,283 **** --- 282,289 ---- }
+ proc slider_select {canvas tag v} { + bluebox_select $canvas ${tag}BASE $v + } + proc slider_erase {canvas tag} { bluebox_erase $canvas ${tag}BASE *************** *** 285,291 **** }
! proc bang_draw {canvas tag x1 y1 x2 y2 ins outs colour} { bluebox_draw $canvas ${tag}BASE $x1 $y1 $x2 $y2 $ins $outs $colour io_draw $canvas $tag $x1 $y1 $x2 $y2 $ins $outs }
--- 291,315 ---- }
! proc bang_draw {canvas tag x1 y1 x2 y2 ins outs colour label ldx ldy lfont lcolor} { ! set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0] bluebox_draw $canvas ${tag}BASE $x1 $y1 $x2 $y2 $ins $outs $colour io_draw $canvas $tag $x1 $y1 $x2 $y2 $ins $outs + if {$isnew} { + $canvas create oval \ + [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \ + -fill [bluify $colour] -tags ${tag}BUT + $canvas create text [expr $x1+$ldx] [expr $y1+$ldy] -text $label -anchor w \ + -font $lfont -fill $lcolor -tags ${tag}LABEL + } { + $canvas coords ${tag}BUT \ + [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] + $canvas coords ${tag}LABEL [expr $x1+$ldx] [expr $y1+$ldy] + $canvas itemconfigure ${tag}LABEL -text $label -anchor w \ + -font $lfont -fill $lcolor + } + } + + proc bang_select {canvas tag v} { + bluebox_select $canvas ${tag}BASE $v }
*************** *** 293,295 **** --- 317,352 ---- bluebox_erase $canvas ${tag}BASE io_erase $canvas $tag + $canvas delete ${tag}BUT ${tag}LABEL + } + + proc toggle_draw {canvas tag x1 y1 x2 y2 ins outs colour label ldx ldy lfont lcolor} { + set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0] + bluebox_draw $canvas ${tag}BASE $x1 $y1 $x2 $y2 $ins $outs $colour + io_draw $canvas $tag $x1 $y1 $x2 $y2 $ins $outs + set w 1 + set on 0 + if {$x2-$x1 >= 30} {set w 2} + if {$x2-$x1 >= 60} {set w 3} + if {$on} {set fill #ffff00} {set fill [bluify $colour]} + set x3 [expr $x1+$w+2] + set y3 [expr $y1+$w+2] + set x4 [expr $x2-$w-2] + set y4 [expr $y2-$w-2] + if {$isnew} { + $canvas create line $x3 $y3 [expr $x4+1] [expr $y4+1] -width $w -fill $fill -tags ${tag}X1 + $canvas create line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill -tags ${tag}X2 + } { + $canvas coords ${tag}X1 $x3 $y3 $x4 $y4 + $canvas coords ${tag}X2 $x3 $y4 $x4 $y3 + } + } + + proc toggle_select {canvas tag v} { + bluebox_select $canvas ${tag}BASE $v + } + + proc toggle_erase {canvas tag} { + bluebox_erase $canvas ${tag}BASE + io_erase $canvas $tag + $canvas delete ${tag}BUT ${tag}LABEL }