Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27418
Modified Files: Tag: desiredata desire.tk defaults.ddrc Log Message: introducing keyboard macro
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.292 retrieving revision 1.1.2.600.2.293 diff -C2 -d -r1.1.2.600.2.292 -r1.1.2.600.2.293 *** desire.tk 6 Aug 2007 05:38:21 -0000 1.1.2.600.2.292 --- desire.tk 6 Aug 2007 06:56:09 -0000 1.1.2.600.2.293 *************** *** 548,551 **** --- 548,552 ---- if {$mode&4} {append s Control-} if {$mode&8} {append s Alt-} + if {[regexp {[0-9]} $k]} {set k Key-$k} return $s$k } *************** *** 698,702 **** #set cmdline(server) "$cmdline(server)" set encoding "" ! set langoptions {english francais deutsch catala espanol portugues italiano bokmal euskara polski dansk} #lappend langoptions {chinese} #lappend langoptions {esperanto} --- 699,703 ---- #set cmdline(server) "$cmdline(server)" set encoding "" ! set langoptions {english francais deutsch catala espanol portugues italiano bokmal euskara polski dansk chinese} #lappend langoptions {chinese} #lappend langoptions {esperanto} *************** *** 1958,1961 **** --- 1959,1963 ---- $self bind <KeyRelease> keyup_wrap %x %y %K %A 0 $self bind <Shift-KeyRelease> keyup_wrap %x %y %K %A 1 + $self bind <Control-KeyRelease> keyup_wrap %x %y %K %A 0 $self bind <Motion> motion_wrap %x %y 0 $self bind <Alt-Motion> motion_wrap %x %y 4 *************** *** 2226,2229 **** --- 2228,2294 ----
def Canvas popup_properties {} {CanvasPropertiesDialog new $self} + #-----------------------------------------------------------------------------------# + class_new Macro {EventHistory} + def Macro init {} { + $::event_history subscribe $self + set @state 0 + set @list {} + } + def Macro state= {val} {set @state $val; if {$val} {set @list {}; puts "start recording macro..."} {puts "end..."}} + def Macro state {} {return $@state} + def Macro dump {} {set i 0; foreach step $@list {puts "step $i -> $step"; incr i}} + + def Macro notice {args} { + if {$@state} { + set mess [lindex $args 2] + switch [lindex $args 1] { + add {$self add $mess} + default {} + } + } + } + + def Macro add {mess} {lappend @list $mess} + + def Macro play {} { + set i 0 + set focus [string range [focus] 1 [string first . [focus] 2]-1] + foreach step $@list { + mset {event widget x y mode k kval} $step + if {[regexp {^Control_} $k]} {continue} + if {[regexp {^Alt_} $k]} {continue} + if {[regexp {^Shift_} $k]} {continue} + switch $event { + KeyPress { + + set name [modekey $k $mode] + $self run $name $x $y + #set w [focus] + #puts "np::::: $i $name -- $widget $x $y" + #incr i + } + ButtonPress {$self run $event-$k $x $y} + ButtonRelease {$self run $event-$k $x $y} + } + } + } + + def Macro run {name x y} { + #mset {event widget x y mode k kval} $step + set w [focus] + puts "$w $name" + event generate $w <$name> + } + + + set ::macro [Macro new] + set ::macro_state 0 + + def Canvas macro_toggle {} {if {![$::macro state]} {set ::macro_state 1} {$::macro state= 0}} + def Canvas macro_play {} {$::macro play} + def Canvas keyevent {} { + focus [$self widget] + event generate [$self widget] <Control-Key-1> + }
#-----------------------------------------------------------------------------------# *************** *** 3357,3360 **** --- 3422,3426 ---- return } + #$self unpack_prompt super $self unpack_prompt *************** *** 4628,4631 **** --- 4694,4698 ---- def Canvas keyup {x y key iso shift} { if {$iso != ""} {scan $iso %c key} + if {$::macro_state} {$::macro state= 1; set ::macro_state 0 } $@active draw }
Index: defaults.ddrc =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/defaults.ddrc,v retrieving revision 1.1.2.10.2.17 retrieving revision 1.1.2.10.2.18 diff -C2 -d -r1.1.2.10.2.17 -r1.1.2.10.2.18 *** defaults.ddrc 4 Aug 2007 05:30:13 -0000 1.1.2.10.2.17 --- defaults.ddrc 6 Aug 2007 06:56:11 -0000 1.1.2.10.2.18 *************** *** 145,149 **** save_as Ctrl+S select_all Ctrl+a - send_message Ctrl+m text_editor Ctrl+t tidy_up {} --- 145,148 ---- *************** *** 153,161 **** clear_wires Ctrl+k auto_wire Ctrl+j ! subpatcherize Alt+m clear_selection Ctrl+A auto_test Ctrl+grave runcommand Alt+x keyprefix Ctrl+x } Client { --- 152,162 ---- clear_wires Ctrl+k auto_wire Ctrl+j ! subpatcherize Alt+s clear_selection Ctrl+A auto_test Ctrl+grave runcommand Alt+x keyprefix Ctrl+x + macro_toggle Alt+m + macro_play Ctrl+m } Client {