Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28418
Modified Files: Tag: devel_0_39 desire.tk Log Message: the key navigation is behaving much better now, need to error proof it next and test to find more bugs the eye of the crosshair removed
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.358 retrieving revision 1.1.2.359 diff -C2 -d -r1.1.2.358 -r1.1.2.359 *** desire.tk 17 Aug 2006 01:39:43 -0000 1.1.2.358 --- desire.tk 17 Aug 2006 03:22:05 -0000 1.1.2.359 *************** *** 1277,1283 **** set @keynav_port 0 # the list of objects that has io selected set @keynav_iosel {} set @keynav_current 0 ! set @keynav_next 0 set @shift_wires {} set @keynav_tab_sel "wire" --- 1277,1284 ---- set @keynav_port 0 # the list of objects that has io selected + set @keynav 0 set @keynav_iosel {} set @keynav_current 0 ! set @keynav_last 0 set @shift_wires {} set @keynav_tab_sel "wire" *************** *** 2277,2280 **** --- 2278,2282 ---- } set _($@canvas:select_by) "selrect" + set _($@canvas:keynav_tab_sel) "wire" $@canvas end_action } *************** *** 2303,2306 **** --- 2305,2310 ---- object {$self selection+= $id; set @action edit} wire { + $self deselect_all + set @keynav_tab_sel "object" switch [expr $f&255] { 0 {$self selection_wire= $id} *************** *** 2395,2425 ****
def* Canvas tab_jump {} { ! $self deselect_all if {$@keynav_tab_sel == "object"} {set @keynav_tab_sel "wire"} else {set @keynav_tab_sel "object"} switch $@keynav_tab_sel { object { ! set obj_sel [lindex $@children 0] ! $obj_sel selected?= 1 ! set @keynav_current $obj_sel set @selection $@keynav_current } wire { ! #set wire_sel [lindex $@wires 0] ! set wire_sel [lindex $_($@keynav_current:wires) $@jump] ! $wire_sel selected?= 1 ! set @keynav_current_wire $wire_sel set @selection_wire $@keynav_current ! } } ! ! # if {[llength $@children] != 0} { ! # $self deselect_all ! # set obj_sel [lindex $@children $@jump] ! # $obj_sel selected?= 1 ! # set @keynav_current $obj_sel ! # set @selection $@keynav_current ! # incr @jump ! # if {$@jump >= [llength $@children]} {set @jump 0} ! # } }
--- 2399,2456 ----
def* Canvas tab_jump {} { ! set @keynav 1 ! #puts " selection:::: [$self selection]" ! #puts " selection_wire:::: [$self selection_wire]" ! #puts " keynav_current:::: $@keynav_current" ! #puts " keynav_tab_sel:::: $@keynav_tab_sel" ! #$self deselect_all ! set olength [llength $@selection] ! set wlength [llength $@selection_wire] if {$@keynav_tab_sel == "object"} {set @keynav_tab_sel "wire"} else {set @keynav_tab_sel "object"} switch $@keynav_tab_sel { object { ! if {$@keynav_current == 0} {set @keynav_current [lindex $@children 0]} ! $@keynav_current selected?= 0 ! #$self selection_wire-= $@keynav_current ! if {$olength} { ! set @keynav_current [lindex $@selection 0] ! } else { ! if {$wlength} { ! set wire [lindex $@selection_wire 0] ! $self selection_wire-= $@keynav_current ! set @keynav_last $@keynav_current ! set @keynav_current $_($wire:obj1) ! } ! } set @selection $@keynav_current + #set @keynav_tab_sel "wire" } wire { ! if {$@keynav_current == 0} {set @keynav_current [lindex $@selection_wire 0]} ! $@keynav_current selected?= 0 ! if {$wlength} { ! set @keynav_current [lindex $@selection_wire 0] ! } else { ! if {$olength} { ! set obj [lindex $@selection 0] ! $self selection-= $@keynav_current ! #set @keynav_current [lindex $_($obj:wires) 0] ! if {$@keynav_last == 0} {set @keynav_last [lindex $_($obj:wires) 0]} ! set @keynav_current $@keynav_last ! } ! } set @selection_wire $@keynav_current ! #set @keynav_tab_sel "object" } ! ! } ! ! $@keynav_current selected?= 1 ! #if {$@keynav_tab_sel == "object"} {set @keynav_tab_sel "wire"} else {set @keynav_tab_sel "object"} ! #puts "-------------------------------------------" ! #puts " selection:::: [$self selection]" ! #puts " selection_wire:::: [$self selection_wire]" ! #puts " keynav_current:::: $@keynav_current" ! #puts " keynav_tab_sel:::: $@keynav_tab_sel" }
*************** *** 2438,2523 ****
def* Canvas key_nav {du dv shift} { ! set group "" ! set distances "" switch $@keynav_tab_sel { object { - set @keynav_next [$self quadrant $du $dv $@children] - set @keynav_active_obj $@keynav_next ! #if {!$shift} { ! #$self selection-= $@keynav_current ! #$@keynav_current selected?= 0 ! #} ! #if {[lsearch $@selection $@keynav_next] < 0} {lappend @selection $@keynav_next} ! #$@keynav_next selected?= 1 ! #set @keynav_current $@keynav_next } wire { ! $@keynav_current_wire selected?= 0 ! set @keynav_next [$self quadrant $du $dv $@wires] ! #$self find_neighbor_wire $du $dv ! #set obj1 $_($@keynav_current:obj1) ! ! #if {$@jump >= [llength $_($@keynav_current:wires)]} {set @jump 0} ! #puts " jump::$@jump" ! #set @keynav_current_wire [lindex $_($@keynav_current:wires) $@jump] ! #incr @jump ! #$@keynav_current_wire selected?= 1 ! #puts "$@keynav_current" ! #puts "$_($@keynav_current:wires)" ! #set @keynav_next [$self quadrant $du $dv $wires] ! } }
! if {!$shift} { ! $self selection-= $@keynav_current ! $@keynav_current selected?= 0 ! } ! if {[lsearch $@selection $@keynav_next] < 0} {lappend @selection $@keynav_next} $@keynav_next selected?= 1 set @keynav_current $@keynav_next ! } ! ! def Canvas find_neighbor_wire {du dv} { ! set find [lsearch $@wires $@keynav_current] ! set all [lreplace $@wires $find $find] ! mset {x1 y1 x2 y2} [$@keynav_current bbox] ! set obj1 $_($@keynav_current:obj1) ! set inlets [$obj1 ninlets] ! set outlets [$obj1 noutlets] ! set outlet_wires {} ! set inlet_wires {} ! #stores all wires connected to the object and their coords ! set wires_coords {} ! set outport $_($@keynav_current:port1) ! set inport $_($@keynav_current:port2) ! for {set i 0} {$i<$outlets} {incr i} {lappend outlet_wires $i} ! for {set i 0} {$i<$inlets} {incr i} {lappend inlet_wires $i} ! puts "wire $@keynav_current comes from $obj1 of outlet $outport" ! ! puts "and it has wires::: $_($obj1:wires)" ! foreach wire $_($obj1:wires) {lappend wires_coords $wire} ! for {set i 0} {$i < [llength $wires_coords]} {incr i} { ! lset wires_coords $i [list [lindex $wires_coords $i] [[lindex [lindex $wires_coords $i] 0] bbox]] ! } ! puts "wires_coords::: $wires_coords" ! ! #foreach wire $_($obj1:wires) { ! # set wire_info [$wire report] ! # set find [lsearch $wire_info $obj1] ! # if {$find == 0} { ! # set new [linsert [lindex $outlet_wires [lindex $wire_info 1]] end $wire] ! # set outlet_wires [lreplace $outlet_wires [lindex $wire_info 1] [lindex $wire_info 1] $new] ! # } else { ! # set new [linsert [lindex $inlet_wires [lindex $wire_info 3]] end $wire] ! # set inlet_wires [lreplace $inlet_wires [lindex $wire_info 3] [lindex $wire_info 3] $new] ! # } ! #} ! # ! # if {[llength [lindex $outlet_wires $outport]] > 2} {puts " this outlet has other wires"} ! # puts "outlet_wires::: $outlet_wires" ! # puts "inlet_wires::: $inlet_wires" }
--- 2469,2505 ----
def* Canvas key_nav {du dv shift} { ! #puts " keynav_tab_sel::: $@keynav_tab_sel" ! #puts " selection_wire::: $@selection_wire" ! #puts " selection::: $@selection" switch $@keynav_tab_sel { object { ! set @keynav_next [$self quadrant $du $dv $@children] ! if {!$shift} { ! $self selection-= $@keynav_current ! $@keynav_current selected?= 0 ! } ! if {[lsearch $@selection $@keynav_next] < 0} {lappend @selection $@keynav_next} } wire { ! #$@keynav_current selected?= 0 ! set @keynav_next [$self quadrant $du $dv $@wires] ! if {!$shift} { ! $self selection_wire-= $@keynav_current ! $@keynav_current selected?= 0 ! } ! if {[lsearch $@selection_wire $@keynav_next] < 0} {lappend @selection_wire $@keynav_next} } }
! ! #if {[lsearch $@selection $@keynav_next] < 0} {lappend @selection $@keynav_next} $@keynav_next selected?= 1 set @keynav_current $@keynav_next ! #puts "--------------------------------------------" ! #puts " keynav_tab_sel::: $@keynav_tab_sel" ! #puts " selection_wire::: $@selection_wire" ! #puts " selection::: $@selection" }
*************** *** 2697,2704 **** } Escape { ! if {[llength $@selection] > 0} { $self deselect_all $self dehilite_io } } default {} --- 2679,2690 ---- } Escape { ! if {[llength $@selection] > 0 | [llength $@selection_wire] > 0} { $self deselect_all $self dehilite_io } + if {$@keynav} {set @keynav 0} + + #this should be better sorted out in canvas tab_jump + if {$@keynav_tab_sel == "object"} {set @keynav_tab_sel "wire"} else {set @keynav_tab_sel "object"} } default {} *************** *** 2721,2726 **** }
! def Canvas draw_active {} { ! if {![string compare $@keynav_current 0]} {return} mset {x y} [$@keynav_current xy] set line1 [l+ [list -16 -16 0 0] [list $x $y $x $y]] --- 2707,2713 ---- }
! def* Canvas draw_active {} { ! #if {![string compare $@keynav_current 0]} {return} ! if {$@keynav} { mset {x y} [$@keynav_current xy] set line1 [l+ [list -16 -16 0 0] [list $x $y $x $y]] *************** *** 2728,2733 **** --- 2715,2728 ---- $self item ACTIVE1 line $line1 -fill "#000000" -width 5 -arrow last -arrowshape {12 14 8} $self item ACTIVE2 line $line2 -fill "#ffcc00" -width 2 -arrow last -arrowshape {6 12 6} + } else { + if {![llength [.$self.c gettags ${self}ACTIVE1]]} { return } else { + $self hide_active + } + } }
+ def Canvas hide_active {} { + .$self.c delete ${self}ACTIVE1 ${self}ACTIVE2 + } #-----------------------------------------------------------------------------------# class_new Box {View} *************** *** 2864,2879 **** }
- def Wire xy_poo {} { - set obj1 $@obj1 - mset {x1 y1 x2 y2} [$obj1 xy] - list $x1 $y1 - } - - def Wire xy2 {} { - set obj2 $@obj2 - mset {x1 y1 x2 y2} [$obj2 xy] - list $x1 $y1 - } - def Wire xy {} { mset {x1 y1 x2 y2} [$self bbox] --- 2859,2862 ---- *************** *** 4389,4408 **** } ! set v1 [list $X 0 $X [expr $Y - $off]] ! set h1 [list 0 $Y [expr $X - $off] $Y] ! set v2 [list $X [expr $Y + $off] $X $height] ! set h2 [list [expr $X + $off] $Y $width $Y] ! set eye [list [expr $X - $off] [expr $Y - $off] [expr $X + $off] [expr $Y + $off]] $self item VHAIR1 line $v1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} $self item HHAIR1 line $h1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} ! $self item VHAIR2 line $v2 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} ! $self item HHAIR2 line $h2 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} ! $self item EYE oval $eye -dash {4 4 4 4} -outline [look selrect] }
def Canvas hide_crosshair {} { ! .$self.c delete ${self}VHAIR1 ${self}HHAIR1 ${self}VHAIR2 ${self}HHAIR2 ${self}EYE }
--- 4372,4394 ---- } ! #set v1 [list $X 0 $X [expr $Y - $off]] ! #set h1 [list 0 $Y [expr $X - $off] $Y] ! set v1 [list $X 0 $X $height] ! set h1 [list 0 $Y $width $Y] ! #set v2 [list $X [expr $Y + $off] $X $height] ! #set h2 [list [expr $X + $off] $Y $width $Y] ! #set eye [list [expr $X - $off] [expr $Y - $off] [expr $X + $off] [expr $Y + $off]] $self item VHAIR1 line $v1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} $self item HHAIR1 line $h1 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} ! #$self item VHAIR2 line $v2 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} ! #$self item HHAIR2 line $h2 -fill [look selectframe] -width 0.5 -dash {4 4 4 4} ! #$self item EYE oval $eye -dash {4 4 4 4} -outline [look selrect] }
def Canvas hide_crosshair {} { ! #.$self.c delete ${self}VHAIR1 ${self}HHAIR1 ${self}VHAIR2 ${self}HHAIR2 ${self}EYE ! .$self.c delete ${self}VHAIR1 ${self}HHAIR1 }