[PD-cvs] pd/src desire.tk,1.1.2.316,1.1.2.317

chunlee chunlee at users.sourceforge.net
Fri Aug 11 16:38:58 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more tweaks for canvas zoom and wire key bindings


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.316
retrieving revision 1.1.2.317
diff -C2 -d -r1.1.2.316 -r1.1.2.317
*** desire.tk	11 Aug 2006 13:25:09 -0000	1.1.2.316
--- desire.tk	11 Aug 2006 14:38:55 -0000	1.1.2.317
***************
*** 1023,1029 ****
  	
  	if {$type == "text"} {
  		if {$find >= 0} {
- 			set find [lsearch $args "-font"]
- 			post "View item find: $find"
  			set new_size [format %.0f [expr $font(size)*$_($@canvas:scale)]]
  			set s [format $font(str2) $new_size]
--- 1023,1028 ----
  	
  	if {$type == "text"} {
+ 		set find [lsearch $args "-font"]
  		if {$find >= 0} {
  			set new_size [format %.0f [expr $font(size)*$_($@canvas:scale)]]
  			set s [format $font(str2) $new_size]
***************
*** 1420,1424 ****
  	$self editmode= 1
  	mset {x y} $@curpos
! 	pd .$self $sel $x $y
  }
  
--- 1419,1425 ----
  	$self editmode= 1
  	mset {x y} $@curpos
! 	set x1 [expr $x/$@scale]
! 	set y1 [expr $y/$@scale]
! 	pd .$self $sel $x1 $y1
  }
  
***************
*** 1945,1954 ****
      if {[llength [$c gettags lnew]]} {
  	mset {ox1 oy1 ox2 oy2} [lrange [$c coords lnew] end-3 end]
  	#puts "ox1=$ox1 oy1=$oy1 x=$x y=$y"
  	set l [$c coords lnew]
! 	if {[llength $l]<4 || [distance [list $ox1 $oy1] [list $x $y]] < 30} {
! 		set l [lrange $l 0 [expr [llength $l]-3]]
! 	}
! 	lappend l $x $y
  	$c coords lnew $l
      }
--- 1946,1957 ----
      if {[llength [$c gettags lnew]]} {
  	mset {ox1 oy1 ox2 oy2} [lrange [$c coords lnew] end-3 end]
+ 	mset {x1 y1} [lrange [$c coords lnew] 0 1]
  	#puts "ox1=$ox1 oy1=$oy1 x=$x y=$y"
  	set l [$c coords lnew]
! 	#if {[llength $l]<4 || [distance [list $ox1 $oy1] [list $x $y]] < 30} {
! 	#	set l [lrange $l 0 [expr [llength $l]-3]]
! 	#}
! 	#lappend l $x $y
! 	set l [list $x1 $y1 $x $y]
  	$c coords lnew $l
      }
***************
*** 2273,2277 ****
  	switch $type {
  	  object {
- 	     puts "clicked on a object........."
  	     # handles the dash wire drawing
  	     mset {x1 y1 x2 y2} [$id bbox]
--- 2276,2279 ----
***************
*** 2288,2292 ****
  		set @wire_from [list $id $out]
  		#click on a outlet with shift
! 		if {$f == 1} {if {![llength $@shift_wires]} {set @shift_wires $@wire_from; puts "store::::: $@shift_wires"}}
  		set @action wire
  		return
--- 2290,2296 ----
  		set @wire_from [list $id $out]
  		#click on a outlet with shift
! 		if {$f == 1} {
! 			if {![llength $@shift_wires]} {set @shift_wires $@wire_from; puts "store::::: $@shift_wires"}
! 		}
  		set @action wire
  		return
***************
*** 2337,2340 ****
--- 2341,2345 ----
  		}
  		1 {
+ 			puts "	click on a wire with shift"
  			#clcik on a wire with shift
  			#if clcik on the one already selected wire, reconnect it 
***************
*** 2358,2361 ****
--- 2363,2381 ----
  			}
  		}
+ 		2 {
+ 			set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]]
+ 			$id delete
+ 			pd .$self disconnect $wire
+ 			set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $id] [lsearch $@wires_pair $id]]
+ 		  	set @wires_pair [lreplace $@wires_pair [lsearch $@wires_pair $wire] [lsearch $@wires_pair $wire]]
+ 			set obj1 [lindex $@children [lindex $wire 0]]
+ 			set outlet [lindex $wire 1]
+ 			mset {x1 y1 x2 y2} [$obj1 bbox]
+ 			mset {x1 y1 x2 y2} [$c bbox ${obj1}o${outlet}]
+ 			$c create line  [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] $x $y -dash {4 4 4 4} -tags lnew -fill [look wiredash]
+ 			set @wire_from [list $obj1 $outlet]
+ 			if {![llength $@shift_wires]} {set @shift_wires $@wire_from; puts "store::::: $@shift_wires"}
+ 			set @action wire
+ 		}
  		default {
  			puts "nothing......."
***************
*** 2380,2384 ****
      set y [$c canvasy $y]
      set @click_at [list $x $y]
!     if {$@editmode && !($f&2)} {$self clickedit $x $y $b $f; return}
      #if {$@editmode} {$self clickedit $x $y $b $f; return}
      mset {type id} [$self identify_target $x $y $b $f "click"]
--- 2400,2405 ----
      set y [$c canvasy $y]
      set @click_at [list $x $y]
!     #if {$@editmode && !($f&2)} {$self clickedit $x $y $b $f; return}
!     if {$@editmode} {$self clickedit $x $y $b $f; return}
      #if {$@editmode} {$self clickedit $x $y $b $f; return}
      mset {type id} [$self identify_target $x $y $b $f "click"]
***************
*** 2392,2395 ****
--- 2413,2417 ----
  
  def* Canvas unclickedit {x y b f} {
+     global look
      set c .$self.c
      puts "_____ unclickedit action:$@action "
***************
*** 2442,2452 ****
        }
        wire {
        	# if making wire without shift key (delete the dash line)
!         if {!$f} {$c delete lnew}
  	set x1 [expr $x/$_($@canvas:scale)]
  	set y1 [expr $y/$_($@canvas:scale)]
  	set x2 [expr $x1 - 1]
  	set y2 [expr $y1 - 1]
-        	#mset {type id} [$@canvas identify_target $x1 $y1 $x2 $y2s "unclick"]
  	mset {type id} [$@canvas identify_target $x $y [expr $x-1] [expr $y-1] "unclick"]
  	puts "type:: $type ||| id:: $id"
--- 2464,2482 ----
        }
        wire {
+       	#mset {type id} [$@canvas identify_target $x $y [expr $x-1] [expr $y-1] "unclick"]
        	# if making wire without shift key (delete the dash line)
! 	puts "		f::: $f"
!         if {!$f} {$c delete lnew} else {
! 		puts "		delete dash wire"
! 		$c delete lnew
! 		mset {from outlet} $@wire_from
! 		set orig $from
! 		mset {x1 y1 x2 y2} [$c bbox ${orig}o${outlet}]
! 		$c create line  [expr ($x1+$x2)/2] [expr ($y1+$y2)/2] $x $y -dash {4 4 4 4} -tags lnew -fill [look wiredash]
! 	}
  	set x1 [expr $x/$_($@canvas:scale)]
  	set y1 [expr $y/$_($@canvas:scale)]
  	set x2 [expr $x1 - 1]
  	set y2 [expr $y1 - 1]
  	mset {type id} [$@canvas identify_target $x $y [expr $x-1] [expr $y-1] "unclick"]
  	puts "type:: $type ||| id:: $id"
***************
*** 2899,2904 ****
  	set tag $self$type$n
  	set area [.$@canvas.c bbox $self$type$n]
- 	puts "tag -----------> $tag"
- 	puts "area ----------> $area"
  	set center [expr ([lindex $area 2] + [lindex $area 0]) / 2 ]
  	set dist [expr abs($x - $center)]
--- 2929,2932 ----





More information about the Pd-cvs mailing list