Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8638
Modified Files:
Tag: devel_0_39
pd.tk pd_objects.tk
Log Message:
brb
Index: pd.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/pd.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
*** pd.tk 11 Aug 2005 14:30:58 -0000 1.1.2.4
--- pd.tk 12 Aug 2005 23:45:45 -0000 1.1.2.5
***************
*** 1,6 ****
#pd tk gui v2 ix
! if {[catch {package require snack}]} {set has_snack 0} {set has_snack 1}
! if {[catch {package require tkdnd}]} {set has_dnd 0} {set has_dnd 1}
namespace eval ::pd {
--- 1,7 ----
#pd tk gui v2 ix
! foreach _ {snack tkdnd tkpath} {
! if {[catch {package require $_}]} {set has_$_ 0} {set has_$_ 1}
! }
namespace eval ::pd {
***************
*** 47,54 ****
set x [tr $p $t x i $($t:hx)]
set y [tr $p $t y i $($t:hy)]
! item_ua $p $t $id abs [dict create x $x xx $x y $y yy $y color {128 128 128} v 1] 0
if {[dict exists $obj $type defaults]} {
! item_ua $p $t $id abs [dict get $obj [dict get $d type] defaults] 0
}
--- 48,60 ----
set x [tr $p $t x i $($t:hx)]
set y [tr $p $t y i $($t:hy)]
! if {[dict exists $obj $type size]} {
! set sx [dict get $obj $type size x]
! set sy [dict get $obj $type size y]
! } {set sx 0; set sy 0}
!
! item_ua $p $t $id abs [dict create x $x xx [expr $x + $sx] y $y yy [expr $y + $sy] color {128 128 128} v 1] 0
if {[dict exists $obj $type defaults]} {
! item_ua $p $t $id abs [dict get $obj $type defaults] 0
}
***************
*** 65,70 ****
set tags [list item i$id $id]
set color [color [dict get $($t:g) $($t:cg) color]]
! foreach local [dict keys [dict get $obj $type defaults]] {
! set $local [dict get $obj $type defaults $local]}
eval [dict get $obj $type draw]
redraw $p $t $id
--- 71,77 ----
set tags [list item i$id $id]
set color [color [dict get $($t:g) $($t:cg) color]]
! if {[dict exists $obj $type defaults]} {
! foreach local [dict keys [dict get $obj $type defaults]] {
! set $local [dict get $obj $type defaults $local]}}
eval [dict get $obj $type draw]
redraw $p $t $id
***************
*** 135,140 ****
set tags [concat item && i$id && $id]
set item [$p find withtag $tags]
! foreach tag [dict get $obj $type tags] {
! set $tag [$p find withtag "$tags && $tag"]}
eval [dict get $obj $type redraw]
redraw_io $p $t $id
--- 142,148 ----
set tags [concat item && i$id && $id]
set item [$p find withtag $tags]
! if {[dict exists $obj $type tags]} {
! foreach tag [dict get $obj $type tags] {
! set $tag [$p find withtag "$tags && $tag"]}}
eval [dict get $obj $type redraw]
redraw_io $p $t $id
***************
*** 148,155 ****
proc item_v {p t a x y} {
variable ""
! foreach item $($t:sel) {
! item_ua $p $t $item rel [dict create v [expr {($x - $($t:cx)) / 100.0}]] 1
}
- item_info $p $t $($t:sel)
}
--- 156,167 ----
proc item_v {p t a x y} {
variable ""
! variable obj
! foreach id $($t:sel) {
! set type [dict get $($t) $id type]
! if {[dict exists $obj $type defaults]} {
! foreach local [dict keys [dict get $obj $type defaults]] {
! set $local [dict get $obj $type defaults $local]}}
! eval [dict get $obj $type control Button-1]
}
}
***************
*** 161,165 ****
set my [tr $p $t y d [expr {$y - $($t:cy)}]]
foreach item $($t:sel) {item_pos $p $t $item rel $mx $my $mx $my}
- item_info $p $t $($t:sel)
}
--- 173,176 ----
***************
*** 177,182 ****
array set ax {x x xx x y y yy y}
set m [tr $p $t $ax($e) d [expr $$ax($e) - $($t:c$ax($e))]]
! foreach item $($t:sel) {item_ua $p $t $item rel [dict create $e $m] 1}
! item_info $p $t $($t:sel)
}
--- 188,192 ----
array set ax {x x xx x y y yy y}
set m [tr $p $t $ax($e) d [expr $$ax($e) - $($t:c$ax($e))]]
! item_mua $p $t rel [dict create $e $m] 1
}
***************
*** 272,296 ****
}
proc inspect {p t id} {
if {![winfo exists .i$t]} {return}
variable ""
set keys [dict keys [dict get $($t) $id]]
! if {$($t:inspect) != $id} {
foreach c [winfo children .ic] {destroy $c}
foreach k $keys {
! text .i$t.$k -wrap none -width 10 -height 1 -bd 0
.i$t.$k insert 1.0 $k
.i$t.$k configure -state disabled
! text .i$t.${k}v -wrap none -width 16 -height 1 -bd 1
! bind .i$t.${k}v <Any-KeyRelease> "::pd::item_ua $p $t $id abs \[dict create $k \[.i$t.${k}v get 1.0 end\] \] 1"
! grid .i$t.$k .i$t.${k}v
! }
! }
set ($t:inspect) $id
foreach k $keys {
.i$t.${k}v delete 1.0 end
! .i$t.${k}v insert 1.0 [dict get $($t) $id $k]
! }
! }
proc click {m button action p t x y X Y} {
--- 282,312 ----
}
+ proc inspector {p t} {
+ variable ""
+ if {![winfo exists .i$t]} {toplevel .i$t
+ if {[info exists ($t:inspect)]} {unset ($t:inspect)}}}
+
proc inspect {p t id} {
if {![winfo exists .i$t]} {return}
variable ""
set keys [dict keys [dict get $($t) $id]]
! if {![info exists ($t:inspect)] || ([info exists ($t:inspect)] && [dict get $($t) $($t:inspect) type] ne [dict get $($t) $id type])} {
foreach c [winfo children .ic] {destroy $c}
foreach k $keys {
! text .i$t.$k -wrap none -width 8 -height 1 -bd 0
.i$t.$k insert 1.0 $k
+ .i$t.$k tag add justify 1.0 end
+ .i$t.$k tag configure justify -justify right
.i$t.$k configure -state disabled
! text .i$t.${k}v -wrap none -width 16 -height 1 -bd 0 -bg gray94
! bind .i$t.${k}v <Any-KeyRelease> "::pd::item_mua $p $t abs \[dict create $k \[.i$t.${k}v get 1.0 end\] \] 1"
! grid .i$t.$k .i$t.${k}v -sticky nsew
! grid rowconfigure .i$t .i$t.${k}v -weight 1
! grid columnconfigure .i$t .i$t.${k}v -weight 3
! grid columnconfigure .i$t .i$t.$k -weight 1}}
set ($t:inspect) $id
foreach k $keys {
.i$t.${k}v delete 1.0 end
! .i$t.${k}v insert 1.0 [dict get $($t) $id $k]}}
proc click {m button action p t x y X Y} {
***************
*** 355,363 ****
$m add cascade -label "view" -menu [set mv [menu $m.view -tearoff no]]
$mv add command -label "zoom to fit" -command "::pd::viewpoint $p $t {action fit}"
$mv add command -label "reset" -command "::pd::viewpoint $p $t {action reset}"
$m add command -label reload -command {source pd.tk}
$m add command -label "console" -command {tkcon show}
! $m add command -label "inspector" -command "toplevel .i$t"
} else {
--- 371,381 ----
$m add cascade -label "view" -menu [set mv [menu $m.view -tearoff no]]
$mv add command -label "zoom to fit" -command "::pd::viewpoint $p $t {action fit}"
+ $mv add command -label "flip x" -command "::pd::viewpoint $p $t {action mirror_x}"
+ $mv add command -label "flip y" -command "::pd::viewpoint $p $t {action mirror_y}"
$mv add command -label "reset" -command "::pd::viewpoint $p $t {action reset}"
$m add command -label reload -command {source pd.tk}
$m add command -label "console" -command {tkcon show}
! $m add command -label "inspector" -command "::pd::inspector $p $t"
} else {
***************
*** 381,408 ****
switch [dict get $opts action] {
fit {
! set i 0
! dict for {s xy} $($t) {
! dict with xy {
! if {$i == 0} {
! set xa $x
! set xb $x
! set ya $y
! set yb $y
! }
! if {$x > $xb} {set xb $x}
! if {$x < $xa} {set xa $x}
! if {$y > $yb} {set yb $y}
! if {$y < $ya} {set ya $y}
! if {$xx > $xb} {set xb $xx}
! if {$xx < $xa} {set xa $xx}
! if {$yy > $yb} {set yb $yy}
! if {$yy < $ya} {set ya $yy}
! incr i
! }
! }
! set ($t:xa) $xa
! set ($t:xb) $xb
! set ($t:ya) $ya
! set ($t:yb) $yb
}
reset {
--- 399,413 ----
switch [dict get $opts action] {
fit {
! lassign [$p bbox item] xa ya xb yb
! set ($t:xa) [tr $p $t x i $xa]
! set ($t:xb) [tr $p $t x i $xb]
! set ($t:ya) [tr $p $t y i $ya]
! set ($t:yb) [tr $p $t y i $yb]
! }
! mirror_x {
! lassign "$($t:xb) $($t:xa)" ($t:xa) ($t:xb)
! }
! mirror_y {
! lassign "$($t:yb) $($t:ya)" ($t:ya) ($t:yb)
}
reset {
***************
*** 495,501 ****
proc group_assign {p t group} {
variable ""
! foreach item $($t:sel) {
! item_ua $p $t $item abs [dict create g $group] 1
! }
}
--- 500,509 ----
proc group_assign {p t group} {
variable ""
! item_mua $p $t abs [dict create g $group] 1
! }
!
! proc item_mua {p t r u redraw} {
! variable ""
! foreach item $($t:sel) {item_ua $p $t $item $r $u $redraw}
}
***************
*** 547,560 ****
variable obj
foreach xy {x y} {foreach ab {a b} {set ($t:${xy}${ab}o) [dict get $opts ${xy}${ab}]}}
! foreach a {sc ln mode xa xb ya yb qx qy mx my samplerate inspect} {set ($t:$a) [dict get $opts $a]}
if {[winfo exists $p] != 1} {
canvas $p -bg [dict get $opts bg]
place $p -relwidth 1 -relheight 1
- toplevel .i$t
bind $p <Configure> "::pd::gridlines $p $t; ::pd::redraw $p $t all"
bind $p <Enter> "focus $p"
bind $p <Key> "::pd::key $p $t %k 1"
bind $p <KeyRelease> "::pd::key $p $t %k 0"
! if {$::has_dnd == 1} {
dnd bindtarget $p text/plain <Drop> "::pd::drop $p $t %D %x %y"
} else {
--- 555,567 ----
variable obj
foreach xy {x y} {foreach ab {a b} {set ($t:${xy}${ab}o) [dict get $opts ${xy}${ab}]}}
! foreach a {sc ln mode xa xb ya yb qx qy mx my samplerate} {set ($t:$a) [dict get $opts $a]}
if {[winfo exists $p] != 1} {
canvas $p -bg [dict get $opts bg]
place $p -relwidth 1 -relheight 1
bind $p <Configure> "::pd::gridlines $p $t; ::pd::redraw $p $t all"
bind $p <Enter> "focus $p"
bind $p <Key> "::pd::key $p $t %k 1"
bind $p <KeyRelease> "::pd::key $p $t %k 0"
! if {$::has_tkdnd == 1} {
dnd bindtarget $p text/plain <Drop> "::pd::drop $p $t %D %x %y"
} else {
***************
*** 615,619 ****
. configure -width 800 -height 800
! new .c c {bg gray86 ln white mode edit sc orange samplerate 44100 xa 0 xb 100 ya 0 yb 100 qx 10 qy 10 mx 15 my 15 inspect -}
}
--- 622,626 ----
. configure -width 800 -height 800
! new .c c {bg gray86 ln white mode edit sc orange samplerate 44100 xa 0 xb 100 ya 0 yb 100 qx 10 qy 10 mx 15 my 15}
}
Index: pd_objects.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/pd_objects.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
*** pd_objects.tk 11 Aug 2005 14:30:58 -0000 1.1.2.4
--- pd_objects.tk 12 Aug 2005 23:45:45 -0000 1.1.2.5
***************
*** 57,61 ****
box loc
}
! defaults {
ins 0
outs 0
--- 57,62 ----
box loc
}
! size {x 10 y 10}
! defaults {
ins 0
outs 0
***************
*** 73,77 ****
label_cable {
! defaults {width 8}
draw {
$p create line 0 0 0 0 -tags $tags -fill green -arrow last -width 8
--- 74,78 ----
label_cable {
! size {x 10 y 10}
draw {
$p create line 0 0 0 0 -tags $tags -fill green -arrow last -width 8
***************
*** 89,92 ****
--- 90,96 ----
box txt
}
+ size {
+ x 6.4 y 1.2
+ }
defaults {
ins 1
***************
*** 95,106 ****
}
draw {
! $p create polygon 0 0 0 0 -tags [concat $tags box] -fill $color
$p create text 0 0 -tags [concat $tags txt] -fill white -anchor nw -justify left
}
redraw {
$p coords $txt $x $y
$p itemconfigure $txt -font [list {bitstream vera sans} [expr int($sy)]] -text $msg
lassign [$p bbox $txt] x y xx yy
! $p coords $box $x $y [expr $xx + $sx / 5.] $y $xx [expr $y + $sy/2.] [expr $xx + $sx / 5.] $yy $x $yy
}
}
--- 99,112 ----
}
draw {
! $p create polygon 0 0 0 0 -tags [concat $tags box]
$p create text 0 0 -tags [concat $tags txt] -fill white -anchor nw -justify left
}
redraw {
$p coords $txt $x $y
+ $p itemconfigure $box -fill $color
$p itemconfigure $txt -font [list {bitstream vera sans} [expr int($sy)]] -text $msg
lassign [$p bbox $txt] x y xx yy
! set flare [expr $xx + ($xx - $x) / 10.]
! $p coords $box $x $y $flare $y $xx [expr $y + ($yy - $y)/2.] $flare $yy $x $yy
}
}
***************
*** 110,115 ****
--- 116,123 ----
pos box
}
+ size {x 2 y 10}
defaults {
min 1
+ v 48
max 69
ins 0
***************
*** 123,131 ****
$p coords $box $x $y $xx $yy
if {[expr ($xx - $x) > ($yy - $y)]} {set orient h} {set orient v}
switch $orient {
! v {set coords [concat $x [expr $y + ($yy - $y) * [dict get $($t) $id v]] [expr $xx - $x] 3]}
! h {set coords [concat [expr $x + ($xx - $x) * [dict get $($t) $id v]] $y 3 [expr $yy - $y]]}}
$p coords $pos $coords
}
}
--- 131,152 ----
$p coords $box $x $y $xx $yy
if {[expr ($xx - $x) > ($yy - $y)]} {set orient h} {set orient v}
+ set v [expr ($v - $min + 0.) / ($max - $min + 0.)]
switch $orient {
! v {
! set loc [expr $y + ($yy - $y) * $v]
! set coords [concat $x $loc $xx $loc]
! }
! h {
! set loc [expr $x + ($xx - $x) * $v]
! set coords [concat $loc $y $loc $yy]
! }
! }
$p coords $pos $coords
}
+ control {
+ Button-1 {
+ item_ua $p $t $id rel [dict create v [expr {($x - $($t:cx)) / 100.0 * ($max - $min + 0.)}]] 1
+ }
+ }
}