|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# This file:
# http://angg.twu.net/TCL/dragTs.tcl.html
# http://angg.twu.net/TCL/dragTs.tcl
# (find-angg "TCL/dragTs.tcl")
# Author: Eduardo Ochs <eduardoochs@gmail.com>
#
# By Edrx, 2007feb19
# This is meant to be used in eepitch blocks
# to drag text around
# (find-es "tcl" "dragTs")
# (find-tclbook2page (+ -126 167) "Anchors")
# canvas .c -width 200 -height 200
# pack .c -expand yes -fill both
set tcl_prompt2 { puts -nonewline "> " } ;# (find-es "tcl" "prompts")
proc T {x y text} {
global n placex placey
if {$x=="_"} { set x $placex }
if {$y=="_"} { set y $placey; incr placey 11 }
incr n
.c delete T${n}
.c create text $x $y -text $text -anchor nw -tags "T${n} dump"
.c bind T${n} <1> {set oldx %x; set oldy %y}
.c bind T${n} <B1-Motion> ".c move T${n}||tagged \[dragx %x\] \[dragy %y\]"
}
proc dumptostring {n} {
foreach {x y} [.c coords T${n}] {}
set x [expr int($x)]
set y [expr int($y)]
set text [.c itemcget T${n} -text]
format "T %3d %3d %s" $x $y [list $text]
}
proc dumpalltostring {} {
global n
set bigstr {}
for {set i 1} {$i<=$n} {incr i} {
append bigstr "[dumptostring $i]\n"
}
return $bigstr
}
source $env(HOME)/TCL/inc.tcl ;# (find-angg "TCL/inc.tcl")
proc writeTs {} { writefile /tmp/Ts [dumpalltostring] }
lindex {{} {This is a test block:
* (eepitch-tclsh)
* (eepitch-kill)
* (eepitch-tclsh)
package-require-Tk; # See: (find-es "tcl" "package-require-Tk")
source dragTs.tcl
canvas .c -width 200 -height 200
pack .c -expand yes -fill both
.c configure -width 255
.c configure -height 500
set n 0; set placex 20; set placey 20
set n 0
T 20 51 {quinta 22:}
T 20 62 {pegar B.O.}
T 20 20 { }
T 20 84 sexta:
T 20 93 {aula da valeria}
T 20 31 { }
T 22 126 {baixar formulario da Karen}
T 21 138 {preencher / imprimir}
T 23 151 {British council}
T 20 42 { }
T 171 38 Halloween:
T 173 49 __add
T 173 64 Polys
T 173 76 {Newton (getx)}
T 172 85 getxs
T 173 97 gnuplot
writeTs ;# (find-fline "/tmp/Ts")
}} 0 ;# End of the test block