[PD-cvs] pd/src desire.tk,1.1.2.337,1.1.2.338

chunlee chunlee at users.sourceforge.net
Tue Aug 15 04:19:22 CEST 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5864

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
trying to get key_nav to work with wires....


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.337
retrieving revision 1.1.2.338
diff -C2 -d -r1.1.2.337 -r1.1.2.338
*** desire.tk	15 Aug 2006 02:16:05 -0000	1.1.2.337
--- desire.tk	15 Aug 2006 02:19:20 -0000	1.1.2.338
***************
*** 1270,1273 ****
--- 1270,1274 ----
      set @keynav_next 0
      set @shift_wires {}
+     set @keynav_tab_sel "wire"
  }
  
***************
*** 1839,1843 ****
  }
  
! def View draw_wires {} {foreach wire $@wires {$wire draw}}
  
  def* View set_orig_xy {x y} {
--- 1840,1844 ----
  }
  
! def View draw_wires {} {foreach wire $_($@canvas:wires) {$wire draw}}
  
  def* View set_orig_xy {x y} {
***************
*** 2359,2374 ****
  }
  
! def* Canvas obj_jump {} {
! 		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
! 		#set @selection $obj_sel 
! 		#puts "jump -> $@jump"
! 		incr @jump
! 		if {$@jump >= [llength $@children]} {set @jump 0}
! 		}
  }
  
--- 2360,2390 ----
  }
  
! 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]
! 		$wire_sel selected?= 1
! 		set @keynav_current $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}
! #		}
  }
  
***************
*** 2389,2402 ****
  	set group ""
  	set distances ""
! 	set find [lsearch $@children $@keynav_current]
! 	set children [lreplace $@children $find $find]
  	set off 0
  	set max 100
! 	set x1 $_($@keynav_current:x1); set xs $_($@keynav_current:xs)
! 	set y1 $_($@keynav_current:y1); set ys $_($@keynav_current:ys)
  	while {![llength $group]} {
  	  set left  [expr $x1 - $xs*$off]; set right  [expr $x1 + $xs + $xs*$off]
  	  set top   [expr $y1 - $ys*$off]; set bottom [expr $y1 + $ys + $ys*$off]
! 	  foreach item $children {
  	    mset {ix1 iy1 ix2 iy2} [$item bbox]
  	    set add 0
--- 2405,2468 ----
  	set group ""
  	set distances ""
! 	switch $@keynav_tab_sel {
! 	object {
! 		set @keynav_next [$self find_neighbor_obj $@keynav_current $direction]
! 	}
! 	wire {
! 		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_wire {}
! 		set inlet_wire {}
! 		for {set i 0} {$i<$outlets} {incr i} {lappend outlet_wire $i}
! 		for {set i 0} {$i<$inlets} {incr i} {lappend inlet_wire $i}
! 		puts "outlet_wire::: $outlet_wire"
! 		puts "inlet_wire::: $inlet_wire"
! 		puts "wire $@keynav_current comes from $obj1"
! 		
! 		puts "and it has wires::: $_($obj1:wires)"
! 		foreach wire $_($obj1:wires) {
! 			set wire_info [$wire report]
! 			set find [lsearch $wire_info $obj1]
! 			if {$find == 0} {
! 				set new [linsert [lindex $outlet_wire [lindex $wire_info 1]] 0 $wire]
! 				set outlet_wire [lreplace $outlet_wire [lindex $wire_info 1] [lindex $wire_info 1] $new]
! 			} else {
! 				set new [linsert [lindex $inlet_wire [lindex $wire_info 3]] 0 $wire]
! 				set inlet_wire [lreplace $inlet_wire [lindex $wire_info 3] [lindex $wire_info 3] $new]
! 			}
! 		}
! 		puts "outlet_wire::: $outlet_wire"
! 		puts "inlet_wire::: $inlet_wire"
! 	}
! 	}
! 
! 	if {!$shift} {
! 		set find [lsearch $@selection $@keynav_current]
! 		set @selection [lreplace $@selection $find $find]
! 		$@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_obj {object direction} {
! 	set group ""
! 	set distances ""
! 	set find [lsearch $@children $object]
! 	set all [lreplace $@children $find $find]
! 	set x1 $_($object:x1); set xs $_($object:xs)
! 	set y1 $_($object:y1); set ys $_($object:ys)
  	set off 0
  	set max 100
! 	
  	while {![llength $group]} {
  	  set left  [expr $x1 - $xs*$off]; set right  [expr $x1 + $xs + $xs*$off]
  	  set top   [expr $y1 - $ys*$off]; set bottom [expr $y1 + $ys + $ys*$off]
! 	  foreach item $all {
  	    mset {ix1 iy1 ix2 iy2} [$item bbox]
  	    set add 0
***************
*** 2425,2440 ****
  		}
  		set index [lsearch $distances $closest]
! 		set @keynav_next [lindex $group $index]
  	} else {
! 		set @keynav_next [lindex $@selection end end]
! 	}
! 	if {!$shift} {
! 		set find [lsearch $@selection $@keynav_current]
! 		set @selection [lreplace $@selection $find $find]
! 		$@keynav_current selected?= 0
  	}
! 	if {[lsearch $@selection $@keynav_next] < 0} {lappend @selection $@keynav_next}
! 	$@keynav_next selected?= 1
! 	set @keynav_current $@keynav_next
  }
  
--- 2491,2499 ----
  		}
  		set index [lsearch $distances $closest]
! 		return [lindex $group $index]
  	} else {
! 		return [lindex $@selection end end]
  	}
! 
  }
  
***************
*** 2550,2554 ****
  	Left  {$self selection_move -$motion 0}
  	Right {$self selection_move +$motion 0}
! 	Tab   {$self obj_jump}
  	Return {
  	  if {[llength $@selection] == 1} {
--- 2609,2613 ----
  	Left  {$self selection_move -$motion 0}
  	Right {$self selection_move +$motion 0}
! 	Tab   {$self tab_jump}
  	Return {
  	  if {[llength $@selection] == 1} {
***************
*** 2693,2696 ****
--- 2752,2769 ----
  def Wire  inlet {} {return $@port2}
  
+ def Wire bbox {} {
+ 	set obj1 $@obj1
+ 	set obj2 $@obj2
+ 	set port1 $@port1
+ 	set port2 $@port2
+ 	mset {x1 y1 x2 y2} [.$@canvas.c bbox ${obj1}o${port1}]
+ 	mset {x3 y3 x4 y4} [.$@canvas.c bbox ${obj2}o${port2}]
+ 	list [expr ($x2+$x1)/2] [expr ($y2+$y1)/2] [expr ($x4+$x3)/2] [expr ($y4+$y3)/2]
+ }
+ 
+ def Wire report {} {
+ 	list $@obj1 $@port1 $@obj2 $@port2
+ }
+ 
  def Wire draw {} {
  	set scale [$@canvas scale]





More information about the Pd-cvs mailing list