aboutsummaryrefslogtreecommitdiff
path: root/desiredata/src
diff options
context:
space:
mode:
authorN.N. <matju@users.sourceforge.net>2009-06-03 21:26:01 +0000
committerN.N. <matju@users.sourceforge.net>2009-06-03 21:26:01 +0000
commitdff5e27fa631ca30f77b5eb1d64a93fbe356b1e3 (patch)
tree5adb1e659a1b9e9d8bdf75d46673663d26a70efa /desiredata/src
parentf9cd729dcc43f08544af5e6260e51aa200772390 (diff)
move graphviz stuff out
svn path=/trunk/; revision=11664
Diffstat (limited to 'desiredata/src')
-rw-r--r--desiredata/src/desire.tk53
-rw-r--r--desiredata/src/unused.tcl53
2 files changed, 53 insertions, 53 deletions
diff --git a/desiredata/src/desire.tk b/desiredata/src/desire.tk
index ff54bf5e..86efe50c 100644
--- a/desiredata/src/desire.tk
+++ b/desiredata/src/desire.tk
@@ -8764,59 +8764,6 @@ def Canvas blink_image {} {
#-----------------------------------------------------------------
-#lappend ::auto_path /usr/local/lib/graphviz
-catch {package require Tcldot}
-def Canvas graphviz_sort {} {
- error "this code has to be rewritten to use the new containers"
- 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
- }
- puts "$nodes"
- foreach wire $@wires {
- mset {from outlet to inlet} [$wire report]
- set n1 [lindex $nodes [expr [lsearch $nodes $from]-1]]
- set n2 [lindex $nodes [expr [lsearch $nodes $to]-1]]
- $n1 addedge $n2
- }
- #$g layout
- ;# see what render produces
- #if {$debug} {puts [$g render]}
- #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
- exec rm graph.txt
- mset {x1 y1 x2 y2} [[$self widget] bbox all]
- set width [expr $x2 - $x1]
- set height [expr $y2 - $y1]
- foreach line [split $contents "\n"] {
- switch [lindex $line 0] {
- graph {set gw [lindex $line 2]; set gh [lindex $line 3]}
- node {
- set w [expr $width/$gw]
- set h [expr $height/$gh]
- set id [lindex $line 1]
- set x [lindex $line 2]; set y [lindex $line 3]
- $id moveto [expr $x*$w] [expr ($gh-$y)*$h]
- }
- edge {break}
- }
- }
-}
-
proc widget_tree {w {indent 0}} {
foreach element [winfo children $w] {
puts [format "%*s%s" [expr 2*$indent] "" $element]
diff --git a/desiredata/src/unused.tcl b/desiredata/src/unused.tcl
new file mode 100644
index 00000000..29f2b551
--- /dev/null
+++ b/desiredata/src/unused.tcl
@@ -0,0 +1,53 @@
+#lappend ::auto_path /usr/local/lib/graphviz
+catch {package require Tcldot}
+def Canvas graphviz_sort {} {
+ error "this code has to be rewritten to use the new containers"
+ 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
+ }
+ puts "$nodes"
+ foreach wire $@wires {
+ mset {from outlet to inlet} [$wire report]
+ set n1 [lindex $nodes [expr [lsearch $nodes $from]-1]]
+ set n2 [lindex $nodes [expr [lsearch $nodes $to]-1]]
+ $n1 addedge $n2
+ }
+ #$g layout
+ ;# see what render produces
+ #if {$debug} {puts [$g render]}
+ #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
+ exec rm graph.txt
+ mset {x1 y1 x2 y2} [[$self widget] bbox all]
+ set width [expr $x2 - $x1]
+ set height [expr $y2 - $y1]
+ foreach line [split $contents "\n"] {
+ switch [lindex $line 0] {
+ graph {set gw [lindex $line 2]; set gh [lindex $line 3]}
+ node {
+ set w [expr $width/$gw]
+ set h [expr $height/$gh]
+ set id [lindex $line 1]
+ set x [lindex $line 2]; set y [lindex $line 3]
+ $id moveto [expr $x*$w] [expr ($gh-$y)*$h]
+ }
+ edge {break}
+ }
+ }
+}
+