Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14972
Modified Files: Tag: desiredata desire.tk defaults.ddrc Log Message: canvas command evaluator
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.168 retrieving revision 1.1.2.600.2.169 diff -C2 -d -r1.1.2.600.2.168 -r1.1.2.600.2.169 *** desire.tk 17 Jan 2007 00:42:27 -0000 1.1.2.600.2.168 --- desire.tk 18 Jan 2007 14:39:30 -0000 1.1.2.600.2.169 *************** *** 1527,1530 **** --- 1527,1532 ---- set @findbar "" set @find_string "" + set @cmd_hist {} + set @cmd_histi 0 }
*************** *** 3074,3078 **** --- 3076,3144 ---- return [lsearch $@children $child] } + def Canvas runcommand {} { + set @runcommand [Runcommand new $self] + } + + class_new Runcommand {Thing} + def Runcommand widget {} {return .$@canvas.run} + def Runcommand delete {} {focus .$@canvas.c; destroy [$self widget]; super} + 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" + pack $f.close -side left + bind $f.close <Tab> "$self traversal %K %W forward" + label $f.cmd_l -text Command: -font {helvetica -10} -pady 0 + pack $f.cmd_l -side left + entry $f.cmd -width 50 -relief flat -bg white -borderwidth 0 \ + -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 + }
+ def Runcommand traversal {k w direction} { + set f [$self widget] + if {$w == "$f.cmd"} {set next $f.close} else {set next [tk_focusNext $w]} + focus $next + } + + def Canvas cmd_history+ {v} {lappend @cmd_hist $v; set @cmd_histi [llength $@cmd_hist]} + def Canvas cmd_up {} { + if {$@cmd_histi>0} { + set @cmd_histi [expr $@cmd_histi-1]; $@runcommand replace [lindex $@cmd_hist $@cmd_histi] + } + } + def Canvas cmd_down {} { + if {$@cmd_histi<[llength $@cmd_hist]} { + incr @cmd_histi; $@runcommand replace [lindex $@cmd_hist $@cmd_histi] + } + } + def Runcommand replace {v} { + set f [$self widget] + $f.cmd delete 0 end + $f.cmd insert 0 $v + $f.cmd icursor end + } + + def Runcommand run {} { + set f [$self widget] + set text [$f.cmd get] + $@canvas cmd_history+ $text + $f.cmd delete 0 end + post %s "returns: [uplevel [info level] [join [list $@canvas $text]]]" + } + def Canvas foo {x y z} {puts " $z -- $y -- $x"} def Canvas visible_rect {} { set c [$self widget]
Index: defaults.ddrc =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/defaults.ddrc,v retrieving revision 1.1.2.10.2.11 retrieving revision 1.1.2.10.2.12 diff -C2 -d -r1.1.2.10.2.11 -r1.1.2.10.2.12 *** defaults.ddrc 9 Jan 2007 15:21:16 -0000 1.1.2.10.2.11 --- defaults.ddrc 18 Jan 2007 14:39:31 -0000 1.1.2.10.2.12 *************** *** 98,102 **** decr_scale Ctrl+UNDERSCORE decr_zoom Ctrl+minus ! dropper Alt+x duplicate Ctrl+d editmodeswitch Ctrl+e --- 98,102 ---- decr_scale Ctrl+UNDERSCORE decr_zoom Ctrl+minus ! dropper Alt+y duplicate Ctrl+d editmodeswitch Ctrl+e *************** *** 142,148 **** clear_wires Ctrl+k auto_wire Ctrl+j ! subpatcherize Alt+p clear_selection Ctrl+A auto_test Ctrl+grave } Client { --- 142,149 ---- clear_wires Ctrl+k auto_wire Ctrl+j ! subpatcherize Alt+m clear_selection Ctrl+A auto_test Ctrl+grave + runcommand Alt+x } Client {