Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32667
Modified Files: Tag: devel_0_39 desire.tk Log Message: conitnuing with the key binding editor...
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.215 retrieving revision 1.1.2.216 diff -C2 -d -r1.1.2.215 -r1.1.2.216 *** desire.tk 31 May 2006 23:32:34 -0000 1.1.2.215 --- desire.tk 2 Jun 2006 01:09:43 -0000 1.1.2.216 *************** *** 408,411 **** --- 408,413 ---- set key(redraw) "" set key(crosshair) "" + set key(editmodeswitch) "Ctrl+e" + set accels {} ################## set up main window #########################
*************** *** 418,422 **** def Client init_binds {} { global OS ! set @accels {} bind . <Control-Key> {$main ctrlkey %K 0} bind . <Control-Shift-Key> {$main ctrlkey %K 1} --- 420,424 ---- def Client init_binds {} { global OS ! #set @accels {} bind . <Control-Key> {$main ctrlkey %K 0} bind . <Control-Shift-Key> {$main ctrlkey %K 1} *************** *** 697,701 **** } def Menuable populate_menu_1 {menu e} { ! global key if {[llength $e]==0} {$menu add separator; return} mset {text cmd accel} $e --- 699,703 ---- } def Menuable populate_menu_1 {menu e} { ! global key accels if {[llength $e]==0} {$menu add separator; return} mset {text cmd accel} $e *************** *** 710,719 **** } #set accel [accel_munge $accel] ! regsub -all %W $cmd $self cmd if {$accel != ""} { ! if {![dict exists $@accels $accel]} { ! dict set @accels $accel $cmd} else { ! puts "***** warning:: $accel already assigned *****" ! dict set @accels $accel $cmd } } --- 712,721 ---- } #set accel [accel_munge $accel] ! #regsub -all %W $cmd $self cmd if {$accel != ""} { ! if {![dict exists $accels $accel]} { ! dict set accels $accel $cmd} else { ! #puts "***** warning:: $accel already assigned *****" ! #dict set accels $accel $cmd } } *************** *** 777,785 ****
def* Menuable ctrlkey {key shift} { set key [if {$shift} {string toupper $key} {string tolower $key}] set key "Ctrl+$key" ! if {[dict exists $@accels $key]} { ! puts "key ==== $key | cmd === [dict get $@accels $key]" ! $self eval% [dict get $@accels $key] return } {puts "ctrlkey: unknown $key"} --- 779,788 ----
def* Menuable ctrlkey {key shift} { + global accels set key [if {$shift} {string toupper $key} {string tolower $key}] set key "Ctrl+$key" ! if {[dict exists $accels $key]} { ! puts "key ==== $key | cmd === [dict get $accels $key]" ! $self eval% [dict get $accels $key] return } {puts "ctrlkey: unknown $key"} *************** *** 787,795 ****
def* Menuable altkey {key iso} { #hum, where is shift? #set key [if {$shift} {string toupper $key} {string tolower $key}] set key "Alt+$key" ! if {[dict exists $@accels $key]} { ! $self eval% [dict get $@accels $key] return } {puts "altkey: unknown $key"} --- 790,799 ----
def* Menuable altkey {key iso} { + global accels #hum, where is shift? #set key [if {$shift} {string toupper $key} {string tolower $key}] set key "Alt+$key" ! if {[dict exists $accels $key]} { ! $self eval% [dict get $accels $key] return } {puts "altkey: unknown $key"} *************** *** 887,895 **** def View noutlets {} {return $@noutlets}
! def View init {} { set @selected? 0 set @ninlets 1 set @noutlets 0 ! set @accels {} super } --- 891,899 ---- def View noutlets {} {return $@noutlets}
! def* View init {} { set @selected? 0 set @ninlets 1 set @noutlets 0 ! #set @accels {} super } *************** *** 1249,1253 **** def Canvas new_menubar {editable} { set name .$self ! global pd_opendir pd_tearoff OS cmdline key set m $name.m menu $m --- 1253,1257 ---- def Canvas new_menubar {editable} { set name .$self ! global pd_opendir pd_tearoff OS cmdline key accels set m $name.m menu $m *************** *** 1315,1319 **** -variable @editmode -onvalue 1 -offvalue 0 #binds the state of the checkbox to global variable editmod ! dict append @accels "Ctrl+e" "$self editmodeswitch" $m.edit configure -postcommand "$self fix_edit_menu" $m.window configure -postcommand "menu_fixwindowmenu" --- 1319,1325 ---- -variable @editmode -onvalue 1 -offvalue 0 #binds the state of the checkbox to global variable editmod ! if {![dict exists $accels "Ctrl+e"]} { ! dict append accels $key(editmodeswitch) {[%W canvas] editmodeswitch} ! } $m.edit configure -postcommand "$self fix_edit_menu" $m.window configure -postcommand "menu_fixwindowmenu" *************** *** 3813,3817 **** -highlightbackground [format #%6.6x $c] -activebackground [darker $look($name)] set i 10 - #puts "self : $self | w : $w | name : $name" button $f.preset -text "..." -pady 2 -font {Helvetica 8} -command [list color_popup $w $w $name.color $i] pack $f.label $f.color $f.preset -side left --- 3819,3822 ---- *************** *** 3854,3858 **** foreach item $name { set item_lower [string tolower $item] ! eval "entry $f.$item_lower -textvariable key($item) -width 15" pack $f.$item_lower -side left #bind $f.$item <Return> "" --- 3859,3865 ---- foreach item $name { set item_lower [string tolower $item] ! #eval "entry $f.$item_lower -textvariable key($item) -width 15" ! eval "entry $f.$item_lower -width 15" ! $f.$item_lower insert 0 $key($item) pack $f.$item_lower -side left #bind $f.$item <Return> "" *************** *** 4242,4246 ****
def* ClientPrefsDialog read {} { ! global ddrc_options ddrc_options_h cmdline look set fd [open $cmdline(ddrcfilename) "RDONLY CREAT"] #set contents [split [string map {"\n" " "} [read $fd]] " "] --- 4249,4253 ----
def* ClientPrefsDialog read {} { ! global ddrc_options ddrc_options_h cmdline look key set fd [open $cmdline(ddrcfilename) "RDONLY CREAT"] #set contents [split [string map {"\n" " "} [read $fd]] " "] *************** *** 4250,4254 **** set @$name "" foreach subname [split $name |] { ! set ddrc_options_h($subname) [list $type $name] } } --- 4257,4264 ---- set @$name "" foreach subname [split $name |] { ! foreach item $subname { ! set ddrc_options_h($item) [list $type $name] ! puts "$item:$type:$item" ! } } } *************** *** 4264,4267 **** --- 4274,4278 ---- void {set @$name 1} color {set look($item) $value} + key {set key($item) $value} default {incr i; set @$name [lindex $contents $i]} } *************** *** 4289,4293 ****
def* ClientPrefsDialog write {} { ! global ddrc_options ddrc_options_h cmdline look set fd [open $cmdline(ddrcfilename) w] #puts "fd ===== $fd" --- 4300,4304 ----
def* ClientPrefsDialog write {} { ! global ddrc_options ddrc_options_h cmdline look accels key set fd [open $cmdline(ddrcfilename) w] #puts "fd ===== $fd" *************** *** 4301,4311 **** #files {foreach x $v {puts $fd "$op $x"}} #void {if {[string length $v]} {if {$v} {puts $fd $op}}} ! color { set var ${name}path - puts "var = $var" set new_color [$@$var cget -background] set look($name) $new_color puts $fd "$type $name $new_color" } #default {if {[string length $v]} {puts $fd "$op $v"}} } --- 4312,4338 ---- #files {foreach x $v {puts $fd "$op $x"}} #void {if {[string length $v]} {if {$v} {puts $fd $op}}} ! color { set var ${name}path set new_color [$@$var cget -background] set look($name) $new_color puts $fd "$type $name $new_color" + } + key { + foreach item $name { + set var ${item}path + set new_key [$@$var get] + set old_key $key($item) + if {$key($item) != $new_key} { + if {[dict exists $accels $old_key]} { + set cmd [dict get $accels $old_key] + set accels [dict remove $accels $old_key] + dict set accels $new_key $cmd + } } + set key($item) $new_key + puts $fd "$type $item $new_key" + } + + } #default {if {[string length $v]} {puts $fd "$op $v"}} } *************** *** 4353,4356 **** --- 4380,4387 ---- } key { + foreach item $name { + set var ${item}path + set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item] + } properties_dialog $which_self $which_section ClientPrefsDialog_ok \ [list $name $name $type {}]