Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27059
Modified Files: Tag: desiredata desire.tk ChangeLog Log Message: auto completion for the canvas command evalulator
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.169 retrieving revision 1.1.2.600.2.170 diff -C2 -d -r1.1.2.600.2.169 -r1.1.2.600.2.170 *** desire.tk 18 Jan 2007 14:39:30 -0000 1.1.2.600.2.169 --- desire.tk 23 Jan 2007 15:05:54 -0000 1.1.2.600.2.170 *************** *** 3085,3091 **** def Runcommand init {canvas} { set @canvas $canvas set f [$self widget] frame $f -border 1 -relief ridge - button $f.close -border 1 -command "$self delete" -image icon_close -width 9 -height 9 bind $f.close <Return> "$self delete" --- 3085,3094 ---- def Runcommand init {canvas} { set @canvas $canvas + set @defs {} + set @completions {} + set @comp_i 0 + set @comp_s "666" set f [$self widget] frame $f -border 1 -relief ridge button $f.close -border 1 -command "$self delete" -image icon_close -width 9 -height 9 bind $f.close <Return> "$self delete" *************** *** 3097,3110 **** -highlightthickness 0 bind $f.cmd <Escape> "$self delete" bind $f.cmd <Return> "$self run" bind $f.cmd <Up> "$@canvas cmd_up" bind $f.cmd <Down> "$@canvas cmd_down" ! pack $f.cmd -side left -fill x -expand yes ! bind $f.cmd <Tab> "$self traversal %K %W forward" ! if {[winfo exists .$@canvas.yscroll]} {set w .$@canvas.yscroll} else {set w .$@canvas.c} pack $f -side bottom -fill x -before $w focus $f.cmd }
--- 3100,3116 ---- -highlightthickness 0 bind $f.cmd <Escape> "$self delete" + bind $f.cmd <Control-g> "$self delete" bind $f.cmd <Return> "$self run" bind $f.cmd <Up> "$@canvas cmd_up" bind $f.cmd <Down> "$@canvas cmd_down" ! bind $f.cmd <Control-p> "$@canvas cmd_up" ! bind $f.cmd <Control-n> "$@canvas cmd_down" ! bind $f.cmd <Tab> "$self completion" pack $f.cmd -side left -fill x -expand yes ! bind $f.cmd <Control-Tab> "$self traversal %K %W forward" if {[winfo exists .$@canvas.yscroll]} {set w .$@canvas.yscroll} else {set w .$@canvas.c} pack $f -side bottom -fill x -before $w focus $f.cmd + $self defs }
*************** *** 3135,3138 **** --- 3141,3145 ---- def Runcommand run {} { set f [$self widget] + if {[winfo exists $f.completion]} {$self replace $@comp; destroy $f.completion; return} set text [$f.cmd get] $@canvas cmd_history+ $text *************** *** 3140,3143 **** --- 3147,3177 ---- post %s "returns: [uplevel [info level] [join [list $@canvas $text]]]" } + + def Runcommand defs {} { + set name [$@canvas class] + set len [string length ${name}_] + foreach def [info procs ${name}_*] { + lappend @defs [string replace $def 0 $len-1] + } + } + + def Runcommand completion {} { + set f [$self widget] + set text [$f.cmd get] + if {$text != $@comp_s} { + set @comp_s $text + set @completions {} + set @comp_i 0 + foreach def $@defs {if {[regexp ^$@comp_s $def]} {post %s $def; lappend @completions $def}} + } + if {![llength $@completions]} return + set @comp [lindex $@completions $@comp_i] + set @comp_i [expr ($@comp_i+1)%[llength $@completions]] + if {![winfo exists $f.completion]} { + label $f.completion -textvariable _($self:comp) -pady 0 + pack $f.completion -side right + } + } + def Canvas foo {x y z} {puts " $z -- $y -- $x"} def Canvas visible_rect {} {
Index: ChangeLog =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/ChangeLog,v retrieving revision 1.1.4.11.2.16 retrieving revision 1.1.4.11.2.17 diff -C2 -d -r1.1.4.11.2.16 -r1.1.4.11.2.17 *** ChangeLog 17 Jan 2007 00:42:29 -0000 1.1.4.11.2.16 --- ChangeLog 23 Jan 2007 15:05:55 -0000 1.1.4.11.2.17 *************** *** 26,29 **** --- 26,30 ---- [operator2-rule] [operator2-test] * new parser for string support + * Command evalulator per canvas window
Desire 0.40.pre5 (2006.12.19) (-r desiredata; ./configure && make) :