Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16394
Modified Files: Tag: devel_0_39 desire.tk Log Message: some fixes for Vu
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.383 retrieving revision 1.1.2.384 diff -C2 -d -r1.1.2.383 -r1.1.2.384 *** desire.tk 20 Aug 2006 06:05:19 -0000 1.1.2.383 --- desire.tk 20 Aug 2006 19:55:26 -0000 1.1.2.384 *************** *** 493,496 **** --- 493,497 ---- } } + #set cmdline(server) "$cmdline(server)" switch -regexp -- $cmdline(lang) { *************** *** 1019,1023 **** puts $sock "$s;" #flush $sock ! puts "<- $s; \033[0;1;33m(from [info level -1])\033[0m" }
--- 1020,1026 ---- puts $sock "$s;" #flush $sock ! #if {[info level]} {set info [info level -1]} {set info "(toplevel)"} ! #puts "<- $s; \033[0;1;33m(from $info)\033[0m" ! puts "<- $s;" }
*************** *** 1578,1606 ****
#-----------------------------------------------------------------------------------# - # wtf is this supposed to be, again? - class_new io {ganymeda} ;# kill me - - def io draw/2 {which n y} { - set nplus [expr $n==1 ? 1 : $n-1] - mset {x1 y1 x2 y2} [$self bbox] - set xs [expr $x2-$x1] - set ys [expr $y2-$y1] - set c .$@canvas.c - for {set i 0} {$i<$n} {incr i} { - set onset [expr $x1 + ($xs-([look iowidth])) * $i / $nplus] - set points [list [expr $onset] [expr $y-1] [expr $onset+[look iowidth]] $y] - switch $which { i {set color [look inletfg]} o {set color [look outletfg]}} - $self item [list $which$i $which] rectangle $points -outline $color -fill $color - } - } - - def io draw {} { - set fy [look iopos] - mset {x1 y1 x2 y2} [$self bbox] - io_draw/2 $self i $@ninlets [expr $y1-$fy-1] - io_draw/2 $self o $@noutlets [expr $y2+$fy] - } - - #-----------------------------------------------------------------------------------# class_new TextBox {Box}
--- 1581,1584 ---- *************** *** 1740,1747 **** global font super ! mset {x1 y1} [$self xy] ! set x2 [expr $x1+$@xs] ! set y2 [expr $y1+$@ys] ! set xya [list $x1 $y1 $x2 $y2] set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]] set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]] --- 1718,1723 ---- global font super ! set xya [$self bbox] ! mset {x1 y1 x2 y2} $xya set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]] set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]] *************** *** 1753,1757 **** def ObjectBox draw {} { super ! io_draw $self if {[$self selected?]} {set frcol [look selectframe]} {set frcol [look objectframe3]} set c .$@canvas.c --- 1729,1733 ---- def ObjectBox draw {} { super ! $self draw_io if {[$self selected?]} {set frcol [look selectframe]} {set frcol [look objectframe3]} set c .$@canvas.c *************** *** 2879,2882 **** --- 2855,2878 ---- }
+ def Box draw_io2 {which n y} { + set nplus [expr $n==1 ? 1 : $n-1] + mset {x1 y1 x2 y2} [$self bbox] + set xs [expr $x2-$x1] + set ys [expr $y2-$y1] + for {set i 0} {$i<$n} {incr i} { + set onset [expr $x1 + ($xs-([look iowidth])) * $i / $nplus] + set points [list [expr $onset] [expr $y-1] [expr $onset+[look iowidth]] $y] + switch $which { i {set color [look inletfg]} o {set color [look outletfg]}} + $self item [list $which$i $which] rectangle $points -outline $color -fill $color + } + } + + def Box draw_io {} { + set fy [look iopos] + mset {x1 y1 x2 y2} [$self bbox] + $self draw_io2 i $@ninlets [expr $y1-$fy-1] + $self draw_io2 o $@noutlets [expr $y2+$fy] + } + # type is i or o def Box hilite_io {type x y} { *************** *** 3160,3164 **** def MessageBox draw {} { super ! io_draw $self super #comment out the following to see what happens with the q...... --- 3156,3160 ---- def MessageBox draw {} { super ! $self draw_io super #comment out the following to see what happens with the q...... *************** *** 3193,3197 **** if {[$self selected?]} {set frcol [look selectframe]} {set frcol [look objectframe3]} $self item BASE polygon $points -fill [look objectbg] -outline $frcol ! io_draw $self }
--- 3189,3193 ---- if {[$self selected?]} {set frcol [look selectframe]} {set frcol [look objectframe3]} $self item BASE polygon $points -fill [look objectbg] -outline $frcol ! $self draw_io }
*************** *** 3240,3244 **** $self item BASE2 line $xyb -fill #ffffff $self item BASE3 line $xyc -fill [darker $color] ! io_draw $self $self draw_wires } --- 3236,3240 ---- $self item BASE2 line $xyb -fill #ffffff $self item BASE3 line $xyc -fill [darker $color] ! $self draw_io $self draw_wires } *************** *** 3653,3657 **** $c create line $x3 $y1 $x3 $y2 -tags ${self}CURS -fill red } ! io_draw $self if {[$self selected?]} {set frcol [look selectframe]} {set frcol [look objectframe3]} $c itemconfigure ${self}BASE -outline $frcol --- 3649,3653 ---- $c create line $x3 $y1 $x3 $y2 -tags ${self}CURS -fill red } ! $self draw_io if {[$self selected?]} {set frcol [look selectframe]} {set frcol [look objectframe3]} $c itemconfigure ${self}BASE -outline $frcol *************** *** 4022,4028 **** }
def Vu bbox {} { mset {x1 y1} [$self xy] ! list $x1 $y1 [expr $x1+$@w] [expr $y1+$@w] }
--- 4018,4030 ---- }
+ def Vu init {mess} { + super $mess + set @value 0 + set @peak 0 + } + def Vu bbox {} { mset {x1 y1} [$self xy] ! list $x1 $y1 [expr $x1+$@w] [expr $y1+$@h] }
*************** *** 4035,4063 **** def Vu draw {} { global vu_col ! mset {x1 y1} [$self xy] ! set xs $@w ! set ys $@h ! set x2 [expr $x1+$xs] ! set y2 [expr $y1+$ys] ! set ins [expr 2*([string compare $@rcv empty]==0)] ! set outs 2 set colour [parse_color $@bcol] super set led_size [$self led_size] ! set x3 [expr $x1+$xs/4] ! set x4 [expr $x1+$xs-$xs/4] ! set c .$@canvas.c ! $c delete ${self}RMS for {set i 1} {$i<=40} {incr i} { set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2] ! $self item RMS rectangle [list $x3 $y $x4 [expr $y+$led_size]] \ -fill [parse_color [lindex $vu_col $i]] -width 0 } ! $self item MASK rectangle [list $x3 $y1 $x4 $y1] -width 0 -fill [bluify $colour] ! if {!$@scale} {return} ! $c delete ${self}SCALE ! set lfont [list \ ! [lindex {courier helvetica times} $@fstyle] \ ! $@fs bold] set lcolor [parse_color $@lcol] set i 0 --- 4037,4055 ---- def Vu draw {} { global vu_col ! mset {x1 y1 x2 y2} [$self bbox] set colour [parse_color $@bcol] super + $self draw_io set led_size [$self led_size] ! set x3 [expr $x1+$@w/4] ! set x4 [expr $x2-$@w/4] ! $self item BASE rectangle [list $x1 $y1 $x2 $y2] -width 0 -fill [bluify $colour] for {set i 1} {$i<=40} {incr i} { set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2] ! $self item RMS${i} rectangle [list $x3 $y $x4 [expr $y+$led_size]] \ -fill [parse_color [lindex $vu_col $i]] -width 0 } ! #if {!$@scale} {return} ! set lfont [list [lindex {courier helvetica times} $@fstyle] $@fs bold] set lcolor [parse_color $@lcol] set i 0 *************** *** 4068,4095 **** set k4 [expr $y1-$k3] set yyy [expr $k4 + $k1*($k2-4*$i)] ! $self item SCALE text [list [expr $x2+4] [expr $yyy+$k3-3]] -text $level -anchor w \ ! -font $lfont -fill $lcolor incr i } ! #vu_set 0 ! #vu_peak 0 }
! def Vu set {i j} { ! global vu_col ! mset {x1 y1} [$self xy] ! set xs $@w ! set ys $@h ! set led_size [$self led_size] ! set y [expr $y1 + ($led_size+1)*(41-$i) - ($led_size+1)/2] ! set x3 [expr $x1+$xs/4] ! set x4 [expr $x1+$xs-$xs/4] ! $@canvas coords ${self}MASK $x3 $y1 $x4 $y ! $@canvas delete ${self}PEAK ! set c [lindex $vu_col $j] ! if {!$j} {return} ! set y1 [expr $y1 + ($led_size+1)*(41-$j) - ($led_size+1)/2] ! $@canvas create rectangle $x1 $y1 [expr $x1+$xs] [expr $y1+$led_size] \ ! -fill [parse_color $c] -tags ${self}PEAK -width 0 }
--- 4060,4079 ---- set k4 [expr $y1-$k3] set yyy [expr $k4 + $k1*($k2-4*$i)] ! $self item SCALE{$level} text [list [expr $x2+4] [expr $yyy+$k3-3]] \ ! -text $level -anchor w -font $lfont -fill $lcolor incr i } ! set y [expr $y1 + ($led_size+1)*(41-$@value) - ($led_size+1)/2] ! $self item MASK rectangle [list $x3 $y1 $x4 $y] -width 0 -fill [bluify $colour] ! set c [lindex $vu_col $@peak] ! set y [expr $y1 + ($led_size+1)*(41-$@peak) - ($led_size+1)/2] ! $self item PEAK rectangle [list $x1 $y $x2 [expr $y+$led_size]] \ ! -fill [parse_color $c] -width 0 }
! def* Vu set {i j} { ! set @value $i ! set @peak $j ! $self changed }
*************** *** 4109,4114 **** set colour [parse_color $@fcol] set lcolour [parse_color $@lcol] - set ins [expr [string compare $@rcv empty]==0] - set outs [expr [string compare $@snd empty]==0] super if {$isnew} { --- 4093,4096 ----