Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26893
Modified Files: Tag: devel_0_39 desire.tk Log Message: more tweaks and fixes to the keyboard navigation code. it should be functional now. see more detail here:
http://desiredata.goto10.org/ticket/15
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.288 retrieving revision 1.1.2.289 diff -C2 -d -r1.1.2.288 -r1.1.2.289 *** desire.tk 6 Aug 2006 14:58:28 -0000 1.1.2.288 --- desire.tk 6 Aug 2006 21:19:16 -0000 1.1.2.289 *************** *** 2250,2254 **** #foreach obj $@selection {$c itemconfigure ${obj}BASE -outline [look objectframe4]} foreach obj $@selection {$obj selected?= 1} ! if {[llength $@selection] == 1} {set @keynav_current $@selection} # hilite wire foreach wire $@selection_wire {$wire select 1} --- 2250,2258 ---- #foreach obj $@selection {$c itemconfigure ${obj}BASE -outline [look objectframe4]} foreach obj $@selection {$obj selected?= 1} ! if {[llength $@selection] == 1} { ! set @keynav_current $@selection ! } else { ! set @keynav_current [lindex $@selection 0] ! } # hilite wire foreach wire $@selection_wire {$wire select 1} *************** *** 2335,2342 **** if {[llength $@children] != 0} { $self deselect_all $@keynav_current selected?= 0 set obj_sel [lindex $@children $@jump] $obj_sel selected?= 1 ! set @keynav_current $objsel #set @selection $obj_sel #puts "jump -> $@jump" --- 2339,2348 ---- if {[llength $@children] != 0} { $self deselect_all + set @keynav_current [lindex $@children 0] + set @selection $@keynav_current $@keynav_current selected?= 0 set obj_sel [lindex $@children $@jump] $obj_sel selected?= 1 ! set @keynav_current $obj_sel #set @selection $obj_sel #puts "jump -> $@jump" *************** *** 2361,2426 **** set find [lsearch $@children $@keynav_current] set childrens [lreplace $@children $find $find] switch $direction { up { foreach item $childrens { ! if {$_($item:y1) < $_($@keynav_current:y1)} { ! if {$_($item:x1) >= $_($@keynav_current:x1) && $_($item:x1) <= [expr $_($@keynav_current:x1) + $_($@keynav_current:xs)]} { lappend group $item ! lappend distances [expr abs ($_($item:y1) - $_($@keynav_current:y1))] } set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $_($@keynav_current:x1) && $x2 <= [expr $_($@keynav_current:x1) + $_($@keynav_current:xs)]} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $_($@keynav_current:y1))] } } } } down { foreach item $childrens { ! if {$_($item:y1) > $_($@keynav_current:y1)} { ! if {$_($item:x1) >= $_($@keynav_current:x1) && $_($item:x1) <= [expr $_($@keynav_current:x1) + $_($@keynav_current:xs)]} { lappend group $item ! lappend distances [expr abs ($_($item:y1) - $_($@keynav_current:y1))] } set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $_($@keynav_current:x1) && $x2 <= [expr $_($@keynav_current:x1) + $_($@keynav_current:xs)]} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $_($@keynav_current:y1))] } } } } right { foreach item $childrens { ! if {$_($item:x1) > $_($@keynav_current:x1)} { ! if {$_($item:y1) >= $_($@keynav_current:y1) && $_($item:y1) <= [expr $_($@keynav_current:y1) + $_($@keynav_current:ys)]} { lappend group $item ! lappend distances [expr abs ($_($item:x1) - $_($@keynav_current:x1))] } ! set y2 [expr $_($item:y1) + $_($item:ys)] ! if {$y2 >= $_($@keynav_current:y1) && $y2 <= [expr $_($@keynav_current:y1) + $_($@keynav_current:ys)]} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $_($@keynav_current:x1))] } } } } left { foreach item $childrens { ! if {$_($item:x1) < $_($@keynav_current:x1)} { ! if {$_($item:y1) >= $_($@keynav_current:y1) && $_($item:y1) <= [expr $_($@keynav_current:y1) + $_($@keynav_current:ys)]} { lappend group $item ! lappend distances [expr abs ($_($item:x1) - $_($@keynav_current:x1))] } ! set y2 [expr $_($item:y1) + $_($item:ys)] ! if {$y2 >= $_($@keynav_current:y1) && $y2 <= [expr $_($@keynav_current:y1) + $_($@keynav_current:ys)]} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $_($@keynav_current:x1))] } } } } } --- 2367,2475 ---- set find [lsearch $@children $@keynav_current] set childrens [lreplace $@children $find $find] + set off 0 + set max 100 + switch $direction { up { + set y1 $_($@keynav_current:y1) + + while {![llength $group]} { + set left [expr $_($@keynav_current:x1) - ($_($@keynav_current:xs) * $off)] + set right [expr ($_($@keynav_current:x1) + $_($@keynav_current:xs)) + ($_($@keynav_current:xs) * $off)] foreach item $childrens { ! if {$_($item:y1) < $y1} { ! if {$_($item:x1) >= $left && $_($item:x1) <= $right} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $y1)] } set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $left && $x2 <= $right} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $y1)] } } } + incr off + puts "incr ----> $off" + if {$off == $max} {break} + } } down { + set y1 $_($@keynav_current:y1) + + while {![llength $group]} { + set left [expr $_($@keynav_current:x1) - ($_($@keynav_current:xs) * $off)] + set right [expr ($_($@keynav_current:x1) + $_($@keynav_current:xs)) + ($_($@keynav_current:xs) * $off)] + foreach item $childrens { ! if {$_($item:y1) > $y1} { ! if {$_($item:x1) >= $left && $_($item:x1) <= $right} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $y1)] } set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $left && $x2 <= $right} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $y1)] } } } + incr off + puts "incr ----> $off" + if {$off == $max} {break} + } } right { + set x1 $_($@keynav_current:x1) + + while {![llength $group]} { + set top [expr $_($@keynav_current:y1) + ($_($@keynav_current:ys) * $off)] + set bottom [expr ($_($@keynav_current:y1) - $_($@keynav_current:ys)) - ($_($@keynav_current:ys) * $off)] + foreach item $childrens { ! if {$_($item:x1) > $x1} { ! if {$_($item:y1) <= $top && $_($item:y1) >= $bottom} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $x1)] } ! set y2 [expr $_($item:y1) - $_($item:ys)] ! if {$y2 <= $top && $y2 >= $bottom} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $x1)] } } } + incr off + puts "incr ----> $off" + if {$off == $max} {break} + } } left { + set x1 $_($@keynav_current:x1) + + while {![llength $group]} { + set top [expr $_($@keynav_current:y1) + ($_($@keynav_current:ys) * $off)] + set bottom [expr ($_($@keynav_current:y1) - $_($@keynav_current:ys)) - ($_($@keynav_current:ys) * $off)] + foreach item $childrens { ! if {$_($item:x1) < $x1} { ! if {$_($item:y1) <= $top && $_($item:y1) >= $bottom} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $x1)] } ! set y2 [expr $_($item:y1) - $_($item:ys)] ! if {$y2 <= $top && $y2 >= $bottom} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $x1)] } } } + incr off + puts "incr ----> $off" + if {$off == $max} {break} + } + } } *************** *** 2437,2441 **** set @keynav_next [lindex $group $index] } else { ! #set @keynav_next $@selection } --- 2486,2490 ---- set @keynav_next [lindex $group $index] } else { ! set @keynav_next $@selection } *************** *** 2445,2449 **** $@keynav_current selected?= 0 } ! lappend @selection $@keynav_next $@keynav_next selected?= 1 set @keynav_current $@keynav_next --- 2494,2498 ---- $@keynav_current selected?= 0 } ! if {[lsearch $@selection $@keynav_next] < 0} {lappend @selection $@keynav_next} $@keynav_next selected?= 1 set @keynav_current $@keynav_next