Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14888
Modified Files: Tag: devel_0_39 desire.tk pd_base.tk pd_objects.tk Log Message:
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.56 retrieving revision 1.1.2.57 diff -C2 -d -r1.1.2.56 -r1.1.2.57 *** desire.tk 14 Sep 2005 10:09:48 -0000 1.1.2.56 --- desire.tk 14 Sep 2005 13:28:12 -0000 1.1.2.57 *************** *** 681,685 **** populate_menu .mbar.file {} { {"New" {menu_new} "Ctrl+n"} ! {"New 2" {toplevel .c -width 512 -height 512; ::pd::new .c.c {}} ""} {"Open" {menu_open} "Ctrl+o"} {} --- 681,685 ---- populate_menu .mbar.file {} { {"New" {menu_new} "Ctrl+n"} ! {"New 2" {toplevel .c -width 512 -height 512; ::pd::new .c.c} ""} {"Open" {menu_open} "Ctrl+o"} {}
Index: pd_objects.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/pd_objects.tk,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -C2 -d -r1.1.2.11 -r1.1.2.12 *** pd_objects.tk 14 Sep 2005 08:37:17 -0000 1.1.2.11 --- pd_objects.tk 14 Sep 2005 13:28:12 -0000 1.1.2.12 *************** *** 42,45 **** --- 42,46 ---- color {222 222 222} sc orange + mode edit sel {} xa 0 xb 100 ya 0 yb 100 xao 0 xbo 100 yao 0 ybo 100 *************** *** 48,52 **** canvas $_ place $_ -relwidth 1 -relheight 1 ! bind $_ <Configure> "::pd::redraw $_ all" bind $_ <Enter> "focus $_" bind $_ <Key> "::pd::key $_ %k 1" --- 49,53 ---- canvas $_ place $_ -relwidth 1 -relheight 1 ! # bind $_ <Configure> "::pd::redraw $_ all" bind $_ <Enter> "focus $_" bind $_ <Key> "::pd::key $_ %k 1" *************** *** 74,87 **** $_ configure -bg $color -width [expr {[winfo width $_] + $bd}] -height [expr {[winfo height $_] + $bd}] } - proc { - proc lc {_ args} { - variable "" - foreach arg $args { - upvar $arg var - set var [dict get $($_) canvas $arg] - } - return $args - } - } } gridlines { --- 75,78 ---- *************** *** 93,101 **** redraw { foreach items $item {$_ delete $items} foreach xy {x y} { - array set ta {x n y w} - array set tj {x center y left} - array set igx {y width x height} - lc $_ xa xb ya yb set range [expr abs($${xy}b - $${xy}a)] set nSlices [expr $range / $${xy}q] --- 84,92 ---- redraw { foreach items $item {$_ delete $items} + array set ta {x n y w} + array set tj {x center y left} + array set igx {y width x height} + l $_ canvas xa xb ya yb foreach xy {x y} { set range [expr abs($${xy}b - $${xy}a)] set nSlices [expr $range / $${xy}q] *************** *** 122,131 **** defaults { x 32 y 24 ! ins 0 ! outs 0 } init { $_ create rect 0 0 0 0 -tags [concat $tags box] ! new $_.$id {bg gray86 ln white sc orange samplerate 44100 xa 0 xb 100 ya 0 yb 100 qx 10 qy 10 mx 15 my 15} $_ create window 0 0 -tags [concat $tags subwin] -window $_.$id -anchor nw } --- 113,122 ---- defaults { x 32 y 24 ! ins 1 ! outs 1 } init { $_ create rect 0 0 0 0 -tags [concat $tags box] ! new $_.$id $_ create window 0 0 -tags [concat $tags subwin] -window $_.$id -anchor nw } *************** *** 141,147 **** } }
! xy { tags { --- 132,197 ---- } } + kbd { + defaults { + x 60 + y 12 + octaves 6 + color {0 0 0} + color_bg {255 255 255} + lp -1 + } + tags {box subwin} + init { + $_ create rect 0 0 0 0 -tags [concat $tags box] + set path [frame $_.$id] + $_ create window 0 0 -tags [concat $tags subwin] -window $_.$id -anchor nw + # $path config -width [expr $octaves * 66] + set bw {0 1 0 1 0 0 1 0 1 0 1 0} ; set npl {0 1 1 2 2 3 4 4 5 5 6 6} + set keys [dict create 1 [dict create fg $color_bg bg $rgb rw 0.1 rh 0.6 an "-anchor n"] 0 [dict create fg $rgb bg $color_bg rw [expr 1 / 7.] rh 1. an "; lower $wk"]] + for {set o 0} {$o < $octaves} {incr o} { + set w $path.f$o ; frame $w -bd 0 -height 66 -width 66 + for {set on 0} {$on < 12} {incr on} { + set wk $w.[expr $o * 12 + $on] ; set n [lindex $bw $on] + eval "label $wk -bg [color [dict get $keys $n bg]] -fg [color [dict get $keys $n bg]] -bd 1 -relief raised;place $wk -relx [expr [lindex $npl $on] / 7.] -y 0 -relwidth [dict get $keys $n rw] -relheight [dict get $keys $n rh] [dict get $keys $n an]" + bind $wk <1> "::pd::kbd_play $_ $id 0 1 %X %Y"; bind $wk <B1-Motion> [bind $wk <1>];bind $wk <ButtonRelease-1> "::pd::kbd_play $_ $id 0 0 %X %Y"; bind $wk <Enter> "::pd::kbd_play $_ $id 1 0 %X %Y"; bind $wk <3> "::pd::kbd_play $_ $id 1 1 %X %Y"; bind $wk <B3-Motion> [bind $wk <3>]; bind $wk <2> "::pd::kbd_off $_ $id $octaves" + } + place $w -y 0 -relheight 1.0 -relx [expr $o / $octaves.0] -relwidth [expr 1 / $octaves.0] + } + } + redraw { + $_ coords $box [expr $x - 10] $y $xx $yy + $_ itemconfigure $box -fill $color + $_ coords $subwin $x $y + set w [expr $xx - $x] + set h [expr $yy - $y] + if {[expr abs($w - [$_.$id cget -width]) >= 1 || abs($h - [$_.$id cget -height]) >= 1]} { + $_.$id configure -width $w -height $h + } + } + proc { + proc kbd_play {_ id m b x y} { + l $_ $id lp + foreach a {{rs {0 sunken 1 raised}} {v {0 0 1 {($y - [winfo rooty $w]) / ([winfo height $w] + 0.0)}}}} {array set [lindex $a 0] [lindex $a 1]} + set w [winfo containing $x $y] + if {$m != 1 && $lp != -1 && $lp ne $w} {kbd_action $_ $id $lp 0} + if {[$w cget -relief] eq $rs($b)} {kbd_action $_ $id $w [eval expr $v($b)]} + set lp $w + up $_ $id lp + }
+ proc kbd_action {_ id w v} { + if {$v == 0} {set relief raised} {set relief sunken} + $w config -relief $relief + # pd [concat $t.rp _cb [winfo name $w] $v ;] + }
! proc kbd_off {_ id octaves} { ! for {set o 0} {$o < $octaves} {incr o} { ! for {set on 0} {$on < 12} {incr on} { ! set w $_.$id.f$o.[expr $o * 12 + $on] ! if {[$w cget -relief] eq "sunken"} {kbd_action $_ $id $w 0}}}} ! } ! } ! xy { tags {
Index: pd_base.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/pd_base.tk,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** pd_base.tk 14 Sep 2005 08:37:17 -0000 1.1.2.8 --- pd_base.tk 14 Sep 2005 13:28:12 -0000 1.1.2.9 *************** *** 8,12 **** scale selection objbox - port some complex widgets resize: shift square, shift-right corners } --- 8,11 ---- *************** *** 69,73 **** switch $a { first { ! lc $_ sc foreach xy {x y} {set ($_:c$xy) [set $xy];set ($_:f$xy) [set $xy]} $_ create rect $($_:cx) $($_:cy) $($_:cx) $($_:cy) \ --- 68,72 ---- switch $a { first { ! l $_ canvas sc foreach xy {x y} {set ($_:c$xy) [set $xy];set ($_:f$xy) [set $xy]} $_ create rect $($_:cx) $($_:cy) $($_:cx) $($_:cy) \ *************** *** 164,167 **** --- 163,175 ---- }
+ proc l {_ id args} { + variable "" + foreach arg $args { + upvar $arg var + set var [dict get $($_) $id $arg] + } + return $args + } + proc pencil {_ a x y} { variable "" *************** *** 187,191 **** if {[expr $y > $yy]} {lassign "$y $yy" yy y} set sx [expr $xx - $x]; set sy [expr $yy - $y] ! if {[lsearch [getsel $_] $id] >= 0} {set rgb {233 233 233};set color [set [lc $_ sc]];set selected 1} else { set rgb [dict get $($_) $id color];set color [color $rgb];set selected 0} set atags [concat $class i$id $id] --- 195,199 ---- if {[expr $y > $yy]} {lassign "$y $yy" yy y} set sx [expr $xx - $x]; set sy [expr $yy - $y] ! if {[lsearch [getsel $_] $id] >= 0} {set rgb {233 233 233};set color [set [l $_ canvas sc]];set selected 1} else { set rgb [dict get $($_) $id color];set color [color $rgb];set selected 0} set atags [concat $class i$id $id] *************** *** 195,199 **** foreach tag [dict get $obj $type tags] { set $tag [$_ find withtag "$tags && $tag"]}} ! eval [dict get $obj $type redraw] if {$class eq "item" && ($ins > 0 || $outs > 0)} { eval [dict get $obj io redraw] --- 203,208 ---- foreach tag [dict get $obj $type tags] { set $tag [$_ find withtag "$tags && $tag"]}} ! if {[dict exists $obj $type redraw]} { ! eval [dict get $obj $type redraw]} if {$class eq "item" && ($ins > 0 || $outs > 0)} { eval [dict get $obj io redraw] *************** *** 309,313 **** proc item_info {_ clicked} { variable "" ! return set n 0;$_ delete hover foreach item $clicked { --- 318,322 ---- proc item_info {_ clicked} { variable "" ! # return set n 0;$_ delete hover foreach item $clicked { *************** *** 315,319 **** set data [dict get $($_) $item] foreach d $data {lappend info [string range $d 0 7]} ! $_ create text [list [expr [winfo width $_] - 8.0] [expr [winfo height $_] - 8.0 - 11 * $n.0]] -fill $($_:sc) -justify right -anchor se -font {{bitstream vera sans mono} 10} -tags hover -text $info incr n } --- 324,328 ---- set data [dict get $($_) $item] foreach d $data {lappend info [string range $d 0 7]} ! $_ create text [list [expr [winfo width $_] - 8.0] [expr [winfo height $_] - 8.0 - 11 * $n.0]] -fill [set [l $_ canvas sc]] -justify right -anchor se -font {{bitstream vera sans mono} 10} -tags hover -text $info incr n } *************** *** 323,339 **** variable "" if {[lsearch [getsel $_] $d] < 0} { ! set ($_:sel) [concat [getsel $_] $d] } else { ! set ($_:sel) [lsearch -inline -not -all [getsel $_] $d] } redraw $_ $d }
! proc updatesel {_ ns} { variable "" set os [getsel $_] ! dict set ($_) canvas sel $ns ! redraw $_ [lsort -unique [concat $os $ns]] ! item_info $_ $ns }
--- 332,349 ---- variable "" if {[lsearch [getsel $_] $d] < 0} { ! set sel [concat [getsel $_] $d] } else { ! set sel [lsearch -inline -not -all [getsel $_] $d] } + up $_ canvas sel redraw $_ $d }
! proc updatesel {_ sel} { variable "" set os [getsel $_] ! up $_ canvas sel ! redraw $_ [lsort -unique [concat $os $sel]] ! item_info $_ $sel }
*************** *** 358,362 **** colorpicker configure -data $picker label $p.colors -bd 0 ! entry $p.rgb -bd 0 -width 10 -font {{bitstream vera sans} 8} bind $p.colors <B1-Motion> {::pd::colors:pick %x %y} bind $p.colors <1> {::pd::colors:pick %x %y} --- 368,372 ---- colorpicker configure -data $picker label $p.colors -bd 0 ! entry $p.rgb -bd 0 -width 10 -font {{bitstream vera sans mono} 8} bind $p.colors <B1-Motion> {::pd::colors:pick %x %y} bind $p.colors <1> {::pd::colors:pick %x %y} *************** *** 488,492 **** variable "" array set dm {x width y height} ! lc $_ xa xb ya yb switch $inv { t {return [expr ($v - $${d}a) / ($${d}b - $${d}a + 0.0) * [winfo $dm($d) $_]]} --- 498,502 ---- variable "" array set dm {x width y height} ! l $_ canvas xa xb ya yb switch $inv { t {return [expr ($v - $${d}a) / ($${d}b - $${d}a + 0.0) * [winfo $dm($d) $_]]} *************** *** 497,501 **** proc viewpoint {_ opts} { variable "" ! lc $_ xa xb ya yb xao yao xbo ybo switch [dict get $opts action] { fit { --- 507,511 ---- proc viewpoint {_ opts} { variable "" ! l $_ canvas xa xb ya yb xao yao xbo ybo switch [dict get $opts action] { fit { *************** *** 594,607 **** proc mode_flip {_} { variable "" ! if {$($_:mode) eq "edit"} { ! array set m {bg white ln gray86 mode forward} ! } else { ! array set m {bg gray86 ln white mode edit} ! } ! set ($_:mode) $m(mode) ! $_ configure -bg $m(bg) ! ! update $_ grid abs [dict create ln $m(ln)] 1 ! redraw $_ grid }
--- 604,611 ---- proc mode_flip {_} { variable "" ! l $_ canvas mode ! if {$mode eq "edit"} {set mode forward} {set mode edit} ! up $_ canvas mode ! redraw $_ {canvas grid} }
*************** *** 636,640 **** }
! proc new {_ opts} { variable "" variable obj --- 640,644 ---- }
! proc new {_} { variable "" variable obj *************** *** 644,648 **** item_new $_ [dict create type gridlines id grid] } - # item_draw $_ all }
--- 648,651 ---- *************** *** 680,683 **** if {$argv eq "1" && ![winfo exists .c]} { toplevel .c -width 512 -height 512 ! ::pd::new .c.c {} } --- 683,686 ---- if {$argv eq "1" && ![winfo exists .c]} { toplevel .c -width 512 -height 512 ! ::pd::new .c.c }