/usr/share/blt2.4/demos/scripts/clone.tcl is in blt-demo 2.4z-4.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | proc CopyOptions { cmd orig new } {
set all [eval $orig $cmd]
set configLine $new
foreach arg $cmd {
lappend configLine $arg
}
foreach option $all {
if { [llength $option] != 5 } {
continue
}
set switch [lindex $option 0]
set initial [lindex $option 3]
set current [lindex $option 4]
if { [string compare $initial $current] == 0 } {
continue
}
lappend configLine $switch $current
}
eval $configLine
}
proc CopyBindings { oper orig new args } {
set tags [$orig $oper bind]
if { [llength $args] > 0 } {
lappend tags [lindex $args 0]
}
foreach tag $tags {
foreach binding [$orig $oper bind $tag] {
set cmd [$orig $oper bind $tag $binding]
$new $oper bind $tag $binding $cmd
}
}
}
proc CloneGraph { orig new } {
graph $new
CopyOptions "configure" $orig $new
# Axis component
foreach axis [$orig axis names] {
if { [$new axis name $axis] == "" } {
$new axis create $axis
}
CopyOptions [list axis configure $axis] $orig $new
}
foreach axis { x y x2 y2 } {
$new ${axis}axis use [$orig ${axis}axis use]
}
# Pen component
foreach pen [$orig pen names] {
if { [$new pen name $pen] == "" } {
$new pen create $pen
}
CopyOptions [list pen configure $pen] $orig $new
}
# Marker component
foreach marker [$orig marker names] {
$new marker create [$orig marker type $marker] -name $marker
CopyBindings marker $orig $new $marker
CopyOptions [list marker configure $marker] $orig $new
}
# Element component
foreach elem [$orig element names] {
$new element create $elem
CopyBindings element $orig $new $elem
CopyOptions [list element configure $elem] $orig $new
}
# Fix element display list
$new element show [$orig element show]
# Legend component
CopyOptions {legend configure} $orig $new
CopyBindings legend $orig $new
# Postscript component
CopyOptions {postscript configure} $orig $new
# Grid component
CopyOptions {grid configure} $orig $new
# Grid component
CopyOptions {crosshairs configure} $orig $new
# Graph bindings
foreach binding [bind $orig] {
set cmd [bind $orig $binding]
bind $new $binding $cmd
}
return $new
}
toplevel .top
pack [CloneGraph $graph .top.graph]
|