[PD-cvs] pd/src pd_base.tk, 1.1.2.1, 1.1.2.2 pd_objects.tk, 1.1.2.6, 1.1.2.7
carmen rocco
ix9 at users.sourceforge.net
Wed Sep 7 00:58:55 CEST 2005
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4595
Modified Files:
Tag: devel_0_39
pd_base.tk pd_objects.tk
Log Message:
adding 'destroy' and initial cable support
Index: pd_objects.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/pd_objects.tk,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** pd_objects.tk 18 Aug 2005 22:20:18 -0000 1.1.2.6
--- pd_objects.tk 6 Sep 2005 22:58:52 -0000 1.1.2.7
***************
*** 7,12 ****
}
defaults {
! ins 0
! outs 0
zero_x 0
zero_y 1
--- 7,12 ----
}
defaults {
! ins 1
! outs 3
zero_x 0
zero_y 1
***************
*** 15,19 ****
img ""
}
! draw {
$p create rect 0 0 0 0 -tags [concat $tags box]
if {$img ne ""} {
--- 15,19 ----
img ""
}
! init {
$p create rect 0 0 0 0 -tags [concat $tags box]
if {$img ne ""} {
***************
*** 37,41 ****
}
! subwin {
tags {
box subwin
--- 37,41 ----
}
! subwin {
tags {
box subwin
***************
*** 45,49 ****
outs 0
}
! draw {
$p create rect 0 0 0 0 -tags [concat $tags box]
new $p.$id ${t}$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}
--- 45,49 ----
outs 0
}
! init {
$p create rect 0 0 0 0 -tags [concat $tags box]
new $p.$id ${t}$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}
***************
*** 64,77 ****
! xy {
tags {
box loc
}
! size {x 10 y 10}
! defaults {
ins 0
outs 0
}
! draw {
$p create rect 0 0 0 0 -tags [concat $tags box] -fill gray90
$p create rect 0 0 0 0 -tags [concat $tags loc] -fill red
--- 64,77 ----
! xy {
tags {
box loc
}
! defaults {
! x 10 y 10
ins 0
outs 0
}
! init {
$p create rect 0 0 0 0 -tags [concat $tags box] -fill gray90
$p create rect 0 0 0 0 -tags [concat $tags loc] -fill red
***************
*** 84,97 ****
}
! label_cable {
! size {x 10 y 10}
! draw {
$p create line 0 0 0 0 -tags $tags -fill green -arrow last -width 8
}
redraw {
$p coords $item $x $y $xx $yy
}
control {
! puts "mouseie"
}
}
--- 84,125 ----
}
! cable {
! defaults {
! x 10 y 10
! from ""
! to ""
! }
! init {
$p create line 0 0 0 0 -tags $tags -fill green -arrow last -width 8
}
+ destroy {
+ puts byebye_cable
+ }
redraw {
+ if {$from ne "" && [llength $from] == 2 } {
+ set loc [ioloc $p $t [lindex $from 0] [lindex $from 1] out]
+ set $x [lindex $loc 0]; set y [lindex $loc 1]
+ }
+ if {$to ne "" && [llength $to] == 2 } {
+ set loc [ioloc $p $t [lindex $to 0] [lindex $to 1] in]
+ set $xx [lindex $loc 0]; set yy [lindex $loc 1]
+ }
$p coords $item $x $y $xx $yy
}
control {
!
! }
! proc {
! proc ioloc {p t id n side} {
! variable ""
! array set ax {x x xx x y y yy y}
! foreach c {x y xx yy} {
! set $c [tr $p $t $ax($c) t [dict get $($t) $id $c]]}
! # puts "obj $x $y $xx $yy"
! array set nio "out [dict get $($t) $id outs] in [dict get $($t) $id ins]"
! set pos [expr $n / $nio($side).0 * ($xx - $x + 0.0) + $x]
! # puts "io $pos $y"
! return [list $pos $y]
! }
}
}
***************
*** 101,113 ****
box txt
}
- size {
- x 6.4 y 1.2
- }
defaults {
ins 1
outs 1
msg msg
}
! 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
--- 129,139 ----
box txt
}
defaults {
+ x 6.4 y 1.2
ins 1
outs 1
msg msg
}
! init {
$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
***************
*** 127,132 ****
pos box
}
- size {x 2 y 10}
defaults {
min 1
v 48
--- 153,158 ----
pos box
}
defaults {
+ x 2 y 10
min 1
v 48
***************
*** 135,139 ****
outs 0
}
! draw {
$p create rect 0 0 0 0 -tags [concat $tags box] -fill $color
$p create rect 0 0 0 0 -tags [concat $tags pos] -fill green -width 0
--- 161,165 ----
outs 0
}
! init {
$p create rect 0 0 0 0 -tags [concat $tags box] -fill $color
$p create rect 0 0 0 0 -tags [concat $tags pos] -fill green -width 0
***************
*** 170,174 ****
outs 0
}
! draw {
snack:::sound s$id
set filename [dict get $($t) $id filename]
--- 196,200 ----
outs 0
}
! init {
snack:::sound s$id
set filename [dict get $($t) $id filename]
Index: pd_base.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/pd_base.tk,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** pd_base.tk 23 Aug 2005 23:04:59 -0000 1.1.2.1
--- pd_base.tk 6 Sep 2005 22:58:52 -0000 1.1.2.2
***************
*** 1,3 ****
! #pd tk gui v2 ix
foreach _ {snack tkdnd tkpath} {
--- 1,9 ----
! # Pure-Deleuzian
! # 2005 cdr
! # This software has no license (write one if you feel like it)
!
! # see also: desire.tk. this is an experimental PD GUI focusing on customizable 2d-object visualizations and editing
! # docs: http://whats-your.name/pd
!
foreach _ {snack tkdnd tkpath} {
***************
*** 7,10 ****
--- 13,23 ----
namespace eval ::pd {
source pd_objects.tk
+
+ # load object procs
+ foreach type [dict keys $obj] {
+ if {[dict exists $obj $type proc]} {
+ eval [dict get $obj $type proc]}}
+
+ # omg the colours!!
proc rc {} {return [format "\#%06x" [expr "int(floor(rand() * 16777216))"]]}
proc rgb {} {return [list [expr "int(floor(rand() * 256))"] [expr "int(floor(rand() * 256))"] [expr "int(floor(rand() * 256))"]]}
***************
*** 12,15 ****
--- 25,30 ----
proc darken {rgb r} {set l {}; foreach c $rgb {lappend l [expr {$c - ($c * $r)}]}; return $l}
proc color {rgb} {return [format "\#%02x%02x%02x" [expr int([lindex $rgb 0])] [expr int([lindex $rgb 1])] [expr int([lindex $rgb 2])]]}
+
+ # if you can shorten this you kick ass
proc random_txt {n} {
set i 0
***************
*** 36,63 ****
proc item_new {p t id d} {
variable ""
variable obj
if {$id eq "-"} {
if {[dict keys $($t)] eq ""} {set id 0} else {
set id -1
! while true {if {[lsearch -integer [dict keys $($t)] [incr id]] == -1} {break}}
! }
! }
set ($t:ci) $id
- set type [dict get $d type]
-
- 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}
! update $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]} {
! update $p $t $id abs [dict get $obj $type defaults] 0
! }
! update $p $t $id abs $d 0
item_draw $p $t $id
}
--- 51,79 ----
proc item_new {p t id d} {
variable ""
+ #object definition dictionary (in pd_objects.tk or ~/.pd/*.tk)
variable obj
+
+ #generate an ID if one wasn't provided
if {$id eq "-"} {
if {[dict keys $($t)] eq ""} {set id 0} else {
set id -1
! while true {if {[lsearch -integer [dict keys $($t)] [incr id]] == -1} {break}}}}
set ($t:ci) $id
! set type [dict get $d type]
! #figure out size/position
! set x [tr $p $t x i $($t:hx)]; set y [tr $p $t y i $($t:hy)]
! set sx 0; set sy 0
! if {[dict exists $obj $type defaults x]} {set sx [dict get $obj $type defaults x]}
! if {[dict exists $obj $type defaults y]} {set sy [dict get $obj $type defaults y]}
! # 1 global defaults 2 object defaults 3 instance defaults
! set defaults [dict create x $x xx [expr $x + $sx] y $y yy [expr $y + $sy] color {128 128 128}]
! if {[dict exists $obj $type defaults]} {set defaults [dict merge $defaults [dict get $obj $type defaults]]}
! if {$d ne ""} {set defaults [dict merge $defaults $d]}
! update $p $t $id abs $defaults 0
!
! #draw the item
item_draw $p $t $id
}
***************
*** 74,88 ****
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
}
}
! proc item_delete {p t} {
variable ""
! foreach item $($t:sel) {
foreach i [$p find withtag i$item] {
$p delete $i
}
dict unset ($t) $item
set ($t:sel) {}
--- 90,109 ----
foreach local [dict keys [dict get $obj $type defaults]] {
set $local [dict get $obj $type defaults $local]}}
! eval [dict get $obj $type init]
redraw $p $t $id
}
}
! proc item_delete {p t {items ""}} {
variable ""
! variable obj
! if {$items eq ""} {set items $($t:sel)}
! foreach item $items {
foreach i [$p find withtag i$item] {
$p delete $i
}
+ set type [dict get $($t) $item type]
+ if {[dict exists $obj $type destroy]} {
+ eval [dict get $obj $type destroy]}
dict unset ($t) $item
set ($t:sel) {}
***************
*** 150,161 ****
set $tag [$p find withtag "$tags && $tag"]}}
eval [dict get $obj $type redraw]
! redraw_io $p $t $id
}
}
- proc redraw_io {p d id} {
-
- }
-
proc item_v {p t a x y} {
variable ""
--- 171,178 ----
set $tag [$p find withtag "$tags && $tag"]}}
eval [dict get $obj $type redraw]
! # redraw_io $p $t $id
}
}
proc item_v {p t a x y} {
variable ""
***************
*** 257,261 ****
proc item_info {p t clicked} {
variable ""
! return
set n 0;$p delete hover
foreach item $clicked {
--- 274,278 ----
proc item_info {p t clicked} {
variable ""
! # return
set n 0;$p delete hover
foreach item $clicked {
***************
*** 301,307 ****
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
--- 318,324 ----
variable ""
set keys [dict keys [dict get $($t) $id]]
! if {![info exists ($t:inspect)] || ($($t:inspect:type) ne [dict get $($t) $id type])} {
foreach c [winfo children .ic] {destroy $c}
! foreach k [concat id $keys] {
text .i$t.$k -wrap none -width 8 -height 1 -bd 0
.i$t.$k insert 1.0 $k
***************
*** 314,319 ****
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
--- 331,340 ----
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:type) [dict get $($t) $id type]
! }
set ($t:inspect) $id
+ .i$t.idv delete 1.0 end
+ .i$t.idv insert 1.0 $id
foreach k $keys {
.i$t.${k}v delete 1.0 end
***************
*** 385,389 ****
$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"
--- 406,410 ----
$mv add command -label "reset" -command "::pd::viewpoint $p $t {action reset}"
! $m add command -label reload -command {source pd_base.tk}
$m add command -label "console" -command {tkcon show}
$m add command -label "inspector" -command "::pd::inspector $p $t"
***************
*** 459,463 ****
selecta {
updatesel $p $t [dict keys $($t)]
! }
cut {
set ($t:c) [dict create]
--- 480,484 ----
selecta {
updatesel $p $t [dict keys $($t)]
! }
cut {
set ($t:c) [dict create]
***************
*** 564,567 ****
--- 585,589 ----
variable ""
variable obj
+ set opts [dict merge {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} $opts]
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]}
***************
*** 573,581 ****
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 {
- dict unset obj sound
- }
bind $p <Motion> "::pd::hover $p $t %x %y"
bind $p <4> "::pd::viewpoint $p $t {action scroll units 1 axis x}"
--- 595,598 ----
***************
*** 594,597 ****
--- 611,615 ----
foreach ba {0 1 2} {
bind $p <$m[lindex [lindex $b $ba] 0]> "::pd::click [list [string tolower [string trimright $m -1]]] $bn [lindex [lindex $b $ba] 1] $p $t %x %y %X %Y"}}}
+ if {$::has_tkdnd == 1} {dnd bindtarget $p text/plain <Drop> "::pd::drop $p $t %D %x %y"}
set bd [expr {[$p cget -bd] * 2}]
$p configure -bg gray -width [expr {[winfo width $p] + $bd}] -height [expr {[winfo height $p] + $bd}]
***************
*** 631,636 ****
}}}
! . 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}
variable pd_send
--- 649,654 ----
}}}
! . configure -width 512 -height 512
! new .c c {}
variable pd_send
More information about the Pd-cvs
mailing list