[PD-cvs] pd/src desire.tk,1.1.2.455,1.1.2.456

chunlee chunlee at users.sourceforge.net
Mon Sep 4 15:58:21 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
active_draw is now a class_new Active, fixed wire reconnection bug


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.455
retrieving revision 1.1.2.456
diff -C2 -d -r1.1.2.455 -r1.1.2.456
*** desire.tk	4 Sep 2006 03:40:06 -0000	1.1.2.455
--- desire.tk	4 Sep 2006 13:58:18 -0000	1.1.2.456
***************
*** 1294,1297 ****
--- 1294,1298 ----
      set @copy_count 0
      set @crosshair [Crosshair new $self]
+     set @active [Active new $self]
      $self editmode= 0
  }
***************
*** 2306,2312 ****
  
  def Canvas disconnect {wire} {
  	mset {from outlet to inlet} $wire; pd .$self disconnect $from $outlet $to $inlet
  	$@history add [list $self    connect $wire]
- 	#set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $wire] [lsearch $@wires_pair $wire]]
  }
  def Canvas    connect {wire} {
--- 2307,2315 ----
  
  def Canvas disconnect {wire} {
+ 	puts "$@wires_pair"
+ 	set @keynav_tab_sel "wire"
+ 	$self selection_wire-= [lindex $@wires_pair [expr [lsearch $@wires_pair $wire]+1]]
  	mset {from outlet to inlet} $wire; pd .$self disconnect $from $outlet $to $inlet
  	$@history add [list $self    connect $wire]
  }
  def Canvas    connect {wire} {
***************
*** 2480,2485 ****
  			set obj2 [lindex $@children [lindex $wire 2]]
  			set inlet [lindex $wire 3]
! 			mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${outlet}] [$@canvas zoom]]
! 			mset {x3 y3 x4 y4} [lmap / [$c bbox ${obj2}i${inlet}] [$@canvas zoom]]
  			puts "	x3 $x3 y3 $y3 x4 $x4 y4 $y4"
  			set d_outlet [distance [list $x $y] [list [expr ($x1+$x2)/2] [expr ($y1+$y2)/2]]]
--- 2483,2490 ----
  			set obj2 [lindex $@children [lindex $wire 2]]
  			set inlet [lindex $wire 3]
! 			#mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${outlet}] [$@canvas zoom]]
! 			#mset {x3 y3 x4 y4} [lmap / [$c bbox ${obj2}i${inlet}] [$@canvas zoom]]
! 			mset {x1 y1 x2 y2} [lmap / [$c bbox ${obj1}o${outlet}] [$self zoom]]
! 			mset {x3 y3 x4 y4} [lmap / [$c bbox ${obj2}i${inlet}] [$self zoom]]
  			puts "	x3 $x3 y3 $y3 x4 $x4 y4 $y4"
  			set d_outlet [distance [list $x $y] [list [expr ($x1+$x2)/2] [expr ($y1+$y2)/2]]]
***************
*** 2569,2572 ****
--- 2574,2579 ----
  	set wlength [llength $@selection_wire]
  	if {$@keynav_tab_sel == "object"} {set @keynav_tab_sel "wire"} else {set @keynav_tab_sel "object"}
+ 	#puts "o:: $olength w:: $wlength"
+ 	#puts "what??? $@keynav_tab_sel"
  	switch $@keynav_tab_sel {
  	object {
***************
*** 2588,2593 ****
--- 2595,2605 ----
  	}
  	wire {
+ 		#if {![llength $@selection_wire]} {return}
+ 		if {[llength $@selection_wire]} {
  		if {$@keynav_current == 0} {set @keynav_current [lindex $@selection_wire 0]}
  		$@keynav_current selected?= 0
+ 		} else {
+ 			if {[llength $@wires_pair]} {set @keynav_current [lindex $@wires_pair 1]} else {return}
+ 		}
  		if {$wlength} {
  		set @keynav_current [lindex $@selection_wire 0]
***************
*** 2892,2905 ****
  
  #-----------------------------------------------------------------------------------#
  
  def Canvas keyup {x y key iso shift} {
      if {$iso != ""} {scan $iso %c key}
!     $self draw_active
  }
  
! 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]]
      set line2 [l+ [list -15 -15 -1 -1] [list $x $y $x $y]]
--- 2904,2928 ----
  
  #-----------------------------------------------------------------------------------#
+ def Canvas keynav_current {} {return $@keynav_current}
+ def Canvas keynav {} {return $@keynav}
+ 
  
  def Canvas keyup {x y key iso shift} {
      if {$iso != ""} {scan $iso %c key}
!     $@active draw
  }
  
! class_new Active {View}
! 
! def Active init {canvas} {
! 	super
! 	set @canvas $canvas
! }
! 
! def Active draw {} {
! 	set current [$@canvas keynav_current]
! 	if {![string compare $current 0]} {return}
! 	if {[$@canvas keynav]} {
!     mset {x y} [$current xy]
      set line1 [l+ [list -16 -16  0  0] [list $x $y $x $y]]
      set line2 [l+ [list -15 -15 -1 -1] [list $x $y $x $y]]
***************
*** 2907,2917 ****
      $self item ACTIVE2 line $line2 -fill "#ffcc00" -width 2 -arrow last -arrowshape {6 12 6}
      } else {
! 	if {![llength [[$self widget] gettags ${self}ACTIVE1]]} {return} else {$self hide_active}
      }
  }
  
! def Canvas hide_active {} {
! 	[$self widget] delete ${self}ACTIVE1 ${self}ACTIVE2
  }
  #-----------------------------------------------------------------------------------#
  class_new Box {View}
--- 2930,2942 ----
      $self item ACTIVE2 line $line2 -fill "#ffcc00" -width 2 -arrow last -arrowshape {6 12 6}
      } else {
! 	if {![llength [[$@canvas widget] gettags ${self}ACTIVE1]]} {return} else {$self hide}
      }
  }
  
! def Active hide {} {
! 	[$@canvas widget] delete ${self}ACTIVE1 ${self}ACTIVE2
  }
+ 
+ 
  #-----------------------------------------------------------------------------------#
  class_new Box {View}





More information about the Pd-cvs mailing list