Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6321
Modified Files: Tag: desiredata desire.tk Log Message: experimenting with sorting patch with graphviz/tcldot
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.173 retrieving revision 1.1.2.600.2.174 diff -C2 -d -r1.1.2.600.2.173 -r1.1.2.600.2.174 *** desire.tk 23 Jan 2007 23:35:19 -0000 1.1.2.600.2.173 --- desire.tk 30 Jan 2007 22:06:52 -0000 1.1.2.600.2.174 *************** *** 5069,5072 **** --- 5069,5075 ----
class_new IEMGUI {} + def IEMGUI text {} { + return [$self class] + } class_new BlueBox {Labeled IEMGUI Box} #class_new BlueBox {Box Labeledo} *************** *** 8003,8004 **** --- 8006,8071 ---- $self selection_move +10 0 } + #----------------------------------------------------------------- + #!/usr/local/bin/wish + lappend ::auto_path /usr/lib/graphviz + puts $::auto_path + package require Tcldot + def Canvas graphviz_sort {} { + set nodes {} + set gwidth 0; set gh 0; + #toplevel .graph -height 600 -width 800 + #set c [canvas .graph.c -height 600 -width 800] + #pack $c + set g [dotnew digraph] + $g setnodeattribute style filled color white + foreach child $@children { + lappend nodes [$g addnode $child label "[$child text]" shape "record" height "0.1"] + lappend nodes $child + #for {set i 0} {$i < [$child ninlets]} {incr i} { + # $g addnode ${child}i${i} label "" shape "circle" width "0.1" height "0.1" + # [$g findnode ${child}i${i}] addedge [$g findnode $child] arrowhead "none" style "dashed" + #} + #for {set i 0} {$i < [$child noutlets]} {incr i} { + # $g addnode ${child}o${i} label "" shape "circle" width "0.1" height "0.1" + # [$g findnode $child] addedge [$g findnode ${child}o${i}] arrowhead "none" style "dashed" + #} + + } + puts "$nodes" + + foreach wire $@wires { + mset {obj1 port1 obj2 port2} [$wire report] + set n1 [lindex $nodes [expr [lsearch $nodes $obj1]-1]] + set n2 [lindex $nodes [expr [lsearch $nodes $obj2]-1]] + #set n1 [$g findnode ${obj1}o${port1}] + #set n2 [$g findnode ${obj2}i${port2}] + $n1 addedge $n2 + #puts "n1:: $n1 -> n2:: $n2" + } + #$g layout + #if {[info exists debug]} { + # puts [$g render] ;# see what render produces + #} + #eval [$g render] + set f {} + set fd [open graph.txt w] + $g write $fd plain + + close $fd + set fd [open graph.txt r] + set contents [read $fd] + close $fd + foreach line [split $contents "\n"] { + switch [lindex $line 0] { + graph {set gw [lindex $line 2]; set gh [lindex $line 3]} + node { + set m 65 + set id [lindex $line 1] + set x [lindex $line 2]; set y [lindex $line 3] + $id moveto [expr $x*$m] [expr ($gh-$y)*$m] + + } + edge {break} + } + } + }