Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26926
Modified Files: Tag: devel_0_39 desire.tk Log Message: canvas item creation and update now goes to a proc called "item".
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.38 retrieving revision 1.1.2.39 diff -C2 -d -r1.1.2.38 -r1.1.2.39 *** desire.tk 10 Sep 2005 10:21:11 -0000 1.1.2.38 --- desire.tk 10 Sep 2005 18:18:27 -0000 1.1.2.39 *************** *** 1192,1217 **** set xyd [list [expr $x1+4] [expr $y1+4] [expr $x2+4] [expr $y2+4]] #shadow_draw $self $canvas $xya ! if {[llength [$canvas gettags ${self}BASE]] != 0} { ! $canvas coords ${self}BASE $xya ! $canvas coords ${self}BASE2 $xyb ! $canvas coords ${self}BASE3 $xyc ! } { ! $canvas create rectangle $xya -tag ${self}BASE -fill ${look(objectbg)} ! $canvas create line $xyb -tag ${self}BASE2 -fill ${look(objectframe3)} ! $canvas create line $xyc -tag ${self}BASE3 -fill ${look(objectframe3)} ! } io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs #set @clickeditevent objectbox_clickedit #set @clickevent objectbox_click if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} - - #if {[expr $@isnew == 0]} { - #if {[expr $@isselected == 1]} {set frcol $look(objectframe4)} \ - #{set frcol $look(objectframe3)} - #} {set frcol $look(objectframe3)} - $canvas itemconfigure ${self}BASE -outline $frcol - #$canvas itemconfigure ${self}BASE -outline $look(objectframe3) - if {$@isnew} { $canvas itemconfigure ${self}BASE -dash {8 8 8 8} --- 1192,1203 ---- set xyd [list [expr $x1+4] [expr $y1+4] [expr $x2+4] [expr $y2+4]] #shadow_draw $self $canvas $xya ! item $self $canvas BASE rectangle $xya -fill $look(objectbg) ! item $self $canvas BASE2 line $xyb -fill $look(objectframe2) ! item $self $canvas BASE3 line $xyc -fill $look(objectframe3) io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs #set @clickeditevent objectbox_clickedit #set @clickevent objectbox_click if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} $canvas itemconfigure ${self}BASE -outline $frcol if {$@isnew} { $canvas itemconfigure ${self}BASE -dash {8 8 8 8} *************** *** 1237,1241 **** def objectbox erase {canvas} { puts "objectbox_erase:: $self $canvas" ! $canvas delete ${self}BASE ${self}BASE2 ${self}BASE3 io_erase $self $canvas } --- 1223,1227 ---- def objectbox erase {canvas} { puts "objectbox_erase:: $self $canvas" ! $canvas delete ${self} io_erase $self $canvas } *************** *** 1263,1267 **** set points [list [expr $onset+$fx] [expr $y1-$fy] \ [expr $onset-$fx+$look(iowidth)] [expr $y1-$fy+$look(extrapix)]] ! if {[llength [$canvas gettags ${self}i$i]] != 0} { $canvas coords ${self}i$i $points } { --- 1249,1254 ---- set points [list [expr $onset+$fx] [expr $y1-$fy] \ [expr $onset-$fx+$look(iowidth)] [expr $y1-$fy+$look(extrapix)]] ! # will update this code when proc item deals with mult.tags ! if {[llength [$canvas gettags ${self}i$i]] != 0} { $canvas coords ${self}i$i $points } { *************** *** 1274,1277 **** --- 1261,1265 ---- set points [list [expr $onset+$fx] [expr $y2-1+$fy] \ [expr $onset-$fx+$look(iowidth)] [expr $y2+$fy]] + # will update this code when proc item deals with mult.tags if {[llength [$canvas gettags ${self}o$i]] != 0} { $canvas coords ${self}o$i $points *************** *** 1491,1497 **** set canvas_id [canvastosym $canvas] foreach obj $_($canvas_id:selection) { ! $canvas delete ${obj}BASE ${obj}BASE2 ${obj}BASE3 ! $canvas delete ${obj}i ${obj}o ! $canvas delete ${obj}TEXT ${obj}text destroy ${canvas}.${obj}text } --- 1479,1486 ---- set canvas_id [canvastosym $canvas] foreach obj $_($canvas_id:selection) { ! objectbox_delete $obj $canvas ! #$canvas delete ${obj}BASE ${obj}BASE2 ${obj}BASE3 ! #$canvas delete ${obj}i ${obj}o ! #$canvas delete ${obj}TEXT ${obj}text destroy ${canvas}.${obj}text } *************** *** 1503,1508 **** set _($canvas_id:obj_in_edit) 0 set _($canvas_id:selection) 0 - #$canvas delete ${self}BASE ${self}BASE2 ${self}BASE3 - #$canvas delete ${self}i ${self}o #$canvas delete ${self}TEXT ${self}text #destroy ${canvas}.${self}text --- 1492,1495 ---- *************** *** 2330,2342 **** if {$arrowsize < 5} {set arrow none} {set arrow last} set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]] ! ! if {[llength [$canvas gettags $self]] != 0} { ! $canvas coords $self $xys ! $canvas itemconfigure -arrow $arrow -arrowshape $arrowshape ! } { ! $canvas create line $xys -tags $self -width $thick \ ! -arrow $arrow -arrowshape $arrowshape -fill $look(wirefg) ! # -smooth yes ! } }
--- 2317,2323 ---- if {$arrowsize < 5} {set arrow none} {set arrow last} set arrowshape [list $arrowsize [expr $arrowsize*4/5] [expr $arrowsize/3]] ! item $self $canvas "" line $xys -width $thick \ ! -arrow $arrow -arrowshape $arrowshape -fill $look(wirefg) ! # -smooth yes }
*************** *** 2491,2494 **** --- 2472,2476 ---- } { eval [concat [list $canvas itemconfigure ${self}$suffix] $args] + eval [concat [list $canvas coords ${self}$suffix] $coords] } } *************** *** 2498,2507 **** set light [darker ${look(objectbg)}] set dark [darker $light] ! if {[llength [$canvas gettags ${self}SHAD]] != 0} { ! $canvas coords ${self}SHAD $coords ! } { ! $canvas create rectangle $coords -tag ${self}SHAD \ ! -fill $dark -outline $light -width 2 ! } $canvas move ${self}SHAD 4 4 } --- 2480,2485 ---- set light [darker ${look(objectbg)}] set dark [darker $light] ! item $self $canvas SHAD rectangle $coords \ ! -fill $dark -outline $light -width 2 $canvas move ${self}SHAD 4 4 } *************** *** 2515,2523 **** [expr $x2+4] $y2 $x1 $y2 $x2 $y2 $x1 $y2] #shadow_draw $self $canvas $points ! if {[llength [$canvas gettags ${self}BASE]] != 0} { ! $canvas coords ${self}BASE $points ! } { ! $canvas create polygon $points -tag ${self}BASE -fill $look(objectbg) -outline $look(objectframe3) ! } io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} --- 2493,2497 ---- [expr $x2+4] $y2 $x1 $y2 $x2 $y2 $x1 $y2] #shadow_draw $self $canvas $points ! item $self $canvas BASE polygon $points -fill $look(objectbg) -outline $look(objectframe3) io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} *************** *** 2550,2558 **** return } ! if {[llength [$canvas gettags ${self}BASE]] != 0} { ! $canvas coords ${self}BASE $points ! } { ! $canvas create polygon $points -tag ${self}BASE -fill $look(objectbg) -outline $look(objectframe3) ! } io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} --- 2524,2528 ---- return } ! item $self $canvas BASE polygon $points -tag -fill $look(objectbg) -outline $look(objectframe3) io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} *************** *** 2583,2601 **** set points2 [list $x1 $y1 [expr $x1+$ys/2] [expr $y1+$ys/2] $x1 $y2] puts "numbox_draw $self $canvas" ! if {$isnew} { ! $canvas create polygon $points -tag ${self}BASE ! $canvas create polygon $points2 -tag ${self}BASE4 ! $canvas create text $xt $yt -anchor w -tags ${self}NUMBER ! set @clicking 0 ! } { ! $canvas coords ${self}BASE $points ! $canvas coords ${self}BASE4 $points2 ! $canvas coords ${self}NUMBER $xt $yt ! } set grabbed [expr ![string compare $self [canvas_grabber $canvas]]] if {$grabbed} {set color4 #00ff00} {set color4 $look(objectbg)} - $canvas itemconfigure ${self}BASE -fill [parse_color $@bcol] -outline $look(objectframe3) - $canvas itemconfigure ${self}BASE4 -fill $color4 -outline $look(objectframe3) - $canvas itemconfigure ${self}NUMBER -text [numbox_ftoa $self] -font [list $font $@fs bold] -fill [parse_color $@fcol] $canvas delete ${self}CURS if {[string length $@buf]>0} { --- 2553,2562 ---- set points2 [list $x1 $y1 [expr $x1+$ys/2] [expr $y1+$ys/2] $x1 $y2] puts "numbox_draw $self $canvas" ! if {$isnew} {set @clicking 0} ! item $self $canvas BASE polygon $points -fill [parse_color $@bcol] -outline $look(objectframe3) ! item $self $canvas BASE4 polygon $points2 -fill $color4 -outline $look(objectframe3) ! item $self $canvas NUMBER text $xt $yt -anchor w -text [numbox_ftoa $self] -font [list $font $@fs bold] -fill [parse_color $@fcol] set grabbed [expr ![string compare $self [canvas_grabber $canvas]]] if {$grabbed} {set color4 #00ff00} {set color4 $look(objectbg)} $canvas delete ${self}CURS if {[string length $@buf]>0} { *************** *** 2729,2744 **** set xyb [list [expr $x2-1] [expr $y1+1] [expr $x1+1] [expr $y1+1] [expr $x1+1] [expr $y2-1]] set xyc [list [expr $x2-1] [expr $y1+1] [expr $x2-1] [expr $y2-1] [expr $x1+1] [expr $y2-1]] - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] #puts "bluebox: [parse_color $@bcol] [parse_color $@fcol] [parse_color $@lcol]" set color [bluify [parse_color $@bcol]] ! if {$isnew} { ! $canvas create rectangle $xya -tag ${self}BASE -fill $color ! $canvas create line $xyb -tag ${self}BASE2 -fill #ffffff ! $canvas create line $xyc -tag ${self}BASE3 -fill [darker $color] ! } { ! $canvas coords ${self}BASE $xya; $canvas itemconfigure ${self}BASE -fill $color ! $canvas coords ${self}BASE2 $xyb; $canvas itemconfigure ${self}BASE2 -fill #ffffff ! $canvas coords ${self}BASE3 $xyc; $canvas itemconfigure ${self}BASE3 -fill [darker $color] ! } io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} --- 2690,2698 ---- set xyb [list [expr $x2-1] [expr $y1+1] [expr $x1+1] [expr $y1+1] [expr $x1+1] [expr $y2-1]] set xyc [list [expr $x2-1] [expr $y1+1] [expr $x2-1] [expr $y2-1] [expr $x1+1] [expr $y2-1]] #puts "bluebox: [parse_color $@bcol] [parse_color $@fcol] [parse_color $@lcol]" set color [bluify [parse_color $@bcol]] ! item $self $canvas BASE rectangle $xya -fill $color ! item $self $canvas BASE2 line $xyb -fill #ffffff ! item $self $canvas BASE3 line $xyc -fill [darker $color] io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {[canvas_isselected $canvas $self]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)} *************** *** 2761,2765 ****
def radio draw {canvas} { - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] set orient [radio_orient $self] foreach {x1 y1} [object_xy $self $canvas] {} --- 2715,2718 ---- *************** *** 2775,2788 **** set size [expr $size/$n] for {set i 0} {$i<$n} {incr i} { ! if {$isnew} { ! $canvas create rectangle \ ! [expr $x1+3] [expr $y1+3] \ ! [expr $x1+$size-3] [expr $y1+$size-3] \ ! -fill #ffffff -outline #000000 -tags "${self}BUT ${self}BUT$i" ! } else { ! $canvas coords ${self}BUT$i \ ! [expr $x1+3] [expr $y1+3] \ ! [expr $x1+$size-3] [expr $y1+$size-3] ! } if {$orient} {set y1 [expr $y1+$size]} {set x1 [expr $x1+$size]} } --- 2728,2736 ---- set size [expr $size/$n] for {set i 0} {$i<$n} {incr i} { ! #fixme: item doesn't support multiple tags yet ! item $self $canvas "BUT$i BUT" rectangle \ ! [expr $x1+3] [expr $y1+3] \ ! [expr $x1+$size-3] [expr $y1+$size-3] \ ! -fill #ffffff -outline #000000 if {$orient} {set y1 [expr $y1+$size]} {set x1 [expr $x1+$size]} } *************** *** 2825,2829 ****
def slider draw {canvas} { - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] global look foreach {x1 y1} [object_xy $self $canvas] {} --- 2773,2776 ---- *************** *** 2838,2846 **** bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {![info exists @clicking]} {set @clicking 0} ! if {$isnew} { ! set color [bluify #ffffff] ! $canvas create rectangle $x1 $y1 $x1 $y1 -tags ${self}KNOB \ -outline #000000 -fill [darker $color] - } label_draw $self $canvas set @clickevent slider_click --- 2785,2791 ---- bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs if {![info exists @clicking]} {set @clicking 0} ! set color [bluify #ffffff] ! item $self $canvas KNOB rectangle $x1 $y1 $x1 $y1 \ -outline #000000 -fill [darker $color] label_draw $self $canvas set @clickevent slider_click *************** *** 2926,2930 ****
def label draw {canvas} { - set isnew [expr [llength [$canvas gettags ${self}LABEL]] == 0] foreach {x1 y1} [object_xy $self $canvas] {} set lx [expr $x1+$@ldx] --- 2871,2874 ---- *************** *** 2935,2946 **** $@fs bold] set lcolor [parse_color $@lcol] ! if {$isnew} { ! $canvas create text $lx $ly -text $label -anchor w \ ! -font $lfont -fill $lcolor -tags ${self}LABEL ! } { ! $canvas coords ${self}LABEL $lx $ly ! $canvas itemconfigure ${self}LABEL -text $label -anchor w \ ! -font $lfont -fill $lcolor ! } }
--- 2879,2884 ---- $@fs bold] set lcolor [parse_color $@lcol] ! item $self $canvas LABEL text $lx $ly -text $label -anchor w \ ! -font $lfont -fill $lcolor }
*************** *** 2975,2979 **** #-----------------------------------------------------------------------------------# def bang draw {canvas} { - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] foreach {x1 y1} [object_xy $self $canvas] {} set xs $@w --- 2913,2916 ---- *************** *** 2986,2997 **** bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs ! if {$isnew} { ! $canvas create oval \ ! [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \ ! -fill [bluify $colour] -tags ${self}BUT ! } { ! $canvas coords ${self}BUT \ ! [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] ! } label_draw $self $canvas set @clickevent bang_click --- 2923,2929 ---- bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs ! item $self $canvas BUT oval \ ! [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \ ! -fill [bluify $colour] -tags ${self}BUT label_draw $self $canvas set @clickevent bang_click *************** *** 3021,3025 **** set ins [expr [string compare $@rcv empty]==0] set outs [expr [string compare $@snd empty]==0] - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] set colour [parse_color $@bcol] bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs --- 2953,2956 ---- *************** *** 3033,3043 **** 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 ${self}X1 - $canvas create line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill -tags ${self}X2 - } { - $canvas coords ${self}X1 $x3 $y3 [expr $x4+1] [expr $y4+1] - $canvas coords ${self}X2 $x3 $y4 [expr $x4+1] [expr $y3-1] - } label_draw $self $canvas if {$@on} { --- 2964,2967 ---- *************** *** 3046,3052 **** set fill [bluify [parse_color $@bcol]] } ! $canvas itemconfigure ${self}X1 -fill $fill ! $canvas itemconfigure ${self}X2 -fill $fill ! set @clickevent toggle_click } --- 2970,2975 ---- set fill [bluify [parse_color $@bcol]] } ! item $self $canvas X1 line $x3 $y3 [expr $x4+1] [expr $y4+1] -width $w -fill $fill ! item $self $canvas X2 line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill set @clickevent toggle_click } *************** *** 3075,3079 ****
def vu draw {canvas} { - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] foreach {x1 y1} [object_xy $self $canvas] {} set xs $@w --- 2998,3001 ---- *************** *** 3084,3088 **** set outs 2 #[expr [string compare $@snd empty]==0] - set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] set colour [parse_color $@bcol] # bluebox_draw $self $canvas $x1 $y1 $xs $ys $ins $outs --- 3006,3009 ---- *************** *** 3098,3114 **** for {set i 1} {$i<=40} {incr i} { set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2] ! $canvas create rectangle $x3 $y $x4 [expr $y+$led_size] \ ! -fill [parse_color [lindex $vu_col $i]] -tags ${self}RMS -width 0 ! } ! ! if {$isnew} { ! $canvas create rectangle $x3 $y1 $x4 $y1 -tags ${self}MASK \ ! -width 0 -fill [bluify $colour] ! } { ! $canvas coords ${self}MASK $x3 $y1 $x4 $y1 }
if {!$@scale} {return} - $canvas delete ${self}SCALE set lfont [list \ --- 3019,3028 ---- for {set i 1} {$i<=40} {incr i} { set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2] ! item $self $canvas RMS rectangle $x3 $y $x4 [expr $y+$led_size] \ ! -fill [parse_color [lindex $vu_col $i]] -width 0 }
+ item $self $canvas MASK rectangle $x3 $y1 $x4 $y1 -width 0 -fill [bluify $colour] if {!$@scale} {return} $canvas delete ${self}SCALE set lfont [list \ *************** *** 3123,3128 **** set k4 [expr $y1-$k3] set yyy [expr $k4 + $k1*($k2-4*$i)] ! $canvas create text [expr $x2+4] [expr $yyy+$k3-3] -text $level -anchor w \ ! -font $lfont -fill $lcolor -tags ${self}SCALE incr i } --- 3037,3042 ---- set k4 [expr $y1-$k3] set yyy [expr $k4 + $k1*($k2-4*$i)] ! item $self $canvas SCALE text [expr $x2+4] [expr $yyy+$k3-3] -text $level -anchor w \ ! -font $lfont -fill $lcolor incr i } *************** *** 3193,3202 **** set ys $@h set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] ! if {$isnew} { ! $canvas create rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] \ ! -tags ${self}BASE -fill [parse_color $@bcol] ! } { ! $canvas coords ${self}BASE $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] ! } label_draw $self $canvas } --- 3107,3112 ---- set ys $@h set isnew [expr [llength [$canvas gettags ${self}BASE]] == 0] ! item $self $canvas BASE rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] \ ! -fill [parse_color $@bcol] label_draw $self $canvas }