home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Linux
/
Divers
/
angela-1.28-BETA-bin-Linux-i586.tar.gz
/
angela-1.28-BETA-bin-Linux-i586.tar
/
angela-1.28-BETA
/
module_tclout.tcl
< prev
next >
Wrap
Text File
|
1998-05-05
|
4KB
|
116 lines
# This is a module for TCL code generation
# See the LICENSE file for licensing informations.
# If this file was not included with your distribution package, please
# contact pabst@mpi-sb.mpg.de for informations.
proc tcl_out { command { arg1 "" } { arg2 "" } { arg3 "" } { arg4 "" } } {
switch $command {
long_info
{
return "{ TCL output }\
{ TCL output }\
{ Oliver Pabst }\
{ 1.0 }\
{ TCL output/Tcl } \
{ TCL output filter as Tcl module for angela! }\
{ Oliver Pabst }\
{ 1.0 }\
{ filter_out }\
{ tcl }"
}
extension
{
return ".tcl"
}
init
{
}
save
{
tcl_out:save $arg1 $arg2 $arg3 $arg4
}
}
}
proc tcl_out:save { handle msg nodes edges } {
global tcl_platform
# Save some informations, so that everybody knows what the generated
# file is.
set separator "# -----------------------------------------------------------------------"
puts $handle "#!/bin/sh"
puts $handle "# Please leave the first two lines intact \\"
puts $handle "exec wish -f \"\$0\" \$\{1+\"\$@\"\}"
puts $handle $separator
puts $handle "# This is a generated Tcl script, generated with angela! [$msg VERSION]"
puts $handle "# Running on $tcl_platform(os) version\
$tcl_platform(osVersion) ($tcl_platform(platform)) $tcl_platform(machine)."
puts $handle $separator
puts $handle "# For more informations about angela!, consult"
puts $handle "# http://www.mpi-sb.mpg.de/~pabst/angela"
puts $handle "# or contact pabst@mpi-sb.mpg.de"
puts $handle $separator
puts $handle "# On Windows platforms, run this script using wish.exe"
puts $handle $separator
puts $handle "# This script could also be run with the tcl plugin for browsers."
puts $handle $separator
set canvas [$msg CANVAS]
puts $handle "# Creating canvas to display items"
puts $handle "frame .canvas"
puts $handle "pack .canvas -fill both -expand yes"
puts $handle "canvas .canvas.c -background white\\"
puts $handle "\t-scrollregion \{[$canvas bbox all]\}\\"
puts $handle "\t-xscrollcommand \[list .canvas.xscroll set\]\\"
puts $handle "\t-yscrollcommand \[list .canvas.yscroll set\]\\"
puts $handle "\t-highlightthickness 0\\"
puts $handle "\t-borderwidth 0"
puts $handle "scrollbar .canvas.xscroll -orient horizontal\\"
puts $handle "\t-command \[list .canvas.c xview]"
puts $handle "scrollbar .canvas.yscroll -orient vertical\\"
puts $handle "\t-command \[list .canvas.c yview]"
puts $handle "grid .canvas.c .canvas.yscroll -sticky news"
puts $handle "grid .canvas.xscroll -sticky ew"
puts $handle "grid rowconfigure .canvas 0 -weight 1"
puts $handle "grid columnconfigure .canvas 0 -weight 1"
puts $handle $separator
puts $handle "# Generate items"
$msg GRAPH:CLEANUP
foreach i [$canvas find all] {
set type [$canvas type $i]
set config [$canvas itemconfigure $i]
set coords [$canvas coords $i]
puts $handle $separator
puts -nonewline $handle ".canvas.c create $type $coords"
foreach configitem $config {
set value [string trim [lindex $configitem 4]]
puts -nonewline $handle "\\\n\t[lindex $configitem 0] "
if { $value == "" } {
set value "{}"
}
if { [llength $value] > 1 } {
puts -nonewline $handle \"$value\"
} else {
puts -nonewline $handle $value
}
}
puts $handle ""
}
puts $handle $separator
puts $handle "# angela! lives ;)"
}