Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16068
Modified Files: Tag: devel_0_39 desire.tk Log Message: added support for selecting multiple objects separated by objects with keys
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.287 retrieving revision 1.1.2.288 diff -C2 -d -r1.1.2.287 -r1.1.2.288 *** desire.tk 6 Aug 2006 02:54:44 -0000 1.1.2.287 --- desire.tk 6 Aug 2006 14:58:28 -0000 1.1.2.288 *************** *** 448,451 **** --- 448,455 ---- set key(key_nav_right) "Ctrl+right" set key(key_nav_left) "Ctrl+left" + set key(key_nav_up_shift) "Ctrl+UP" + set key(key_nav_down_shift) "Ctrl+DOWN" + set key(key_nav_right_shift) "Ctrl+RIGHT" + set key(key_nav_left_shift) "Ctrl+LEFT"
set accels {} *************** *** 1163,1166 **** --- 1167,1172 ---- set @coords 0 set @jump 0 + set @keynav_current 0 + set @keynav_next 0 }
*************** *** 2244,2247 **** --- 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} *************** *** 2328,2335 **** if {[llength $@children] != 0} { $self deselect_all set obj_sel [lindex $@children $@jump] $obj_sel selected?= 1 ! set @selection $obj_sel ! puts "jump -> $@jump" incr @jump if {$@jump >= [llength $@children]} {set @jump 0} --- 2335,2344 ---- 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" incr @jump if {$@jump >= [llength $@children]} {set @jump 0} *************** *** 2337,2361 **** }
! def Canvas key_nav_up {} {$self key_nav "up"} ! def Canvas key_nav_down {} {$self key_nav "down"} ! def Canvas key_nav_right {} {$self key_nav "right"} ! def Canvas key_nav_left {} {$self key_nav "left"} ! def* Canvas key_nav {direction} { ! if {[llength $@selection] == 1} { set group "" set distances "" switch $direction { up { ! foreach item $@children { ! if {$_($item:y1) < $_($@selection:y1)} { ! if {$_($item:x1) >= $_($@selection:x1) && $_($item:x1) <= [expr $_($@selection:x1) + $_($@selection:xs)]} { lappend group $item ! lappend distances [expr abs ($_($item:y1) - $_($@selection:y1))] } set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 >= $_($@selection:x1) && $x2 <= [expr $_($@selection:x1) + $_($@selection:xs)]} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $_($@selection:y1))] } } --- 2346,2377 ---- }
! def Canvas key_nav_up {} {$self key_nav "up" 0} ! def Canvas key_nav_down {} {$self key_nav "down" 0} ! def Canvas key_nav_right {} {$self key_nav "right" 0} ! def Canvas key_nav_left {} {$self key_nav "left" 0} ! def Canvas key_nav_up_shift {} {$self key_nav "up" 1} ! def Canvas key_nav_down_shift {} {$self key_nav "down" 1} ! def Canvas key_nav_right_shift {} {$self key_nav "right" 1} ! def Canvas key_nav_left_shift {} {$self key_nav "left" 1} ! ! def* Canvas key_nav {direction shift} { set group "" set distances "" + puts "current:::: $@keynav_current" + 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))] } } *************** *** 2363,2376 **** } down { ! foreach item $@children { ! if {$_($item:y1) > $_($@selection:y1)} { ! if {$_($item:x1) > $_($@selection:x1) && $_($item:x1) < [expr $_($@selection:x1) + $_($@selection:xs)]} { lappend group $item ! lappend distances [expr abs ($_($item:y1) - $_($@selection:y1))] } set x2 [expr $_($item:x1) + $_($item:xs)] ! if {$x2 > $_($@selection:x1) && $x2 < [expr $_($@selection:x1) + $_($@selection:xs)]} { lappend group $item ! lappend distances [expr abs($_($item:y1) - $_($@selection:y1))] } } --- 2379,2392 ---- } 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))] } } *************** *** 2378,2391 **** } right { ! foreach item $@children { ! if {$_($item:x1) > $_($@selection:x1)} { ! if {$_($item:y1) >= $_($@selection:y1) && $_($item:y1) <= [expr $_($@selection:y1) + $_($@selection:ys)]} { lappend group $item ! lappend distances [expr abs ($_($item:x1) - $_($@selection:x1))] } set y2 [expr $_($item:y1) + $_($item:ys)] ! if {$y2 >= $_($@selection:y1) && $y2 <= [expr $_($@selection:y1) + $_($@selection:ys)]} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $_($@selection:x1))] } } --- 2394,2407 ---- } 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))] } } *************** *** 2394,2407 **** } left { ! foreach item $@children { ! if {$_($item:x1) < $_($@selection:x1)} { ! if {$_($item:y1) >= $_($@selection:y1) && $_($item:y1) <= [expr $_($@selection:y1) + $_($@selection:ys)]} { lappend group $item ! lappend distances [expr abs ($_($item:x1) - $_($@selection:x1))] } set y2 [expr $_($item:y1) + $_($item:ys)] ! if {$y2 >= $_($@selection:y1) && $y2 <= [expr $_($@selection:y1) + $_($@selection:ys)]} { lappend group $item ! lappend distances [expr abs($_($item:x1) - $_($@selection:x1))] } } --- 2410,2423 ---- } 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))] } } *************** *** 2410,2413 **** --- 2426,2430 ---- } + puts "group:::: $group" if {[llength $group] > 0} { *************** *** 2418,2430 **** } set index [lsearch $distances $closest] ! set next [lindex $group $index] } else { ! set next $@selection } ! $self deselect_all ! $next selected?= 1 ! set @selection $next } } --- 2435,2451 ---- } set index [lsearch $distances $closest] ! set @keynav_next [lindex $group $index] } else { ! #set @keynav_next $@selection } ! if {!$shift} { ! set find [lsearch $@selection $@keynav_current] ! set @selection [lreplace $@selection $find $find] ! $@keynav_current selected?= 0 } + lappend @selection $@keynav_next + $@keynav_next selected?= 1 + set @keynav_current $@keynav_next }