[PD-cvs] pd/src desire.tk,1.1.2.106,1.1.2.107

Mathieu Bouchard matju at users.sourceforge.net
Sun Nov 6 01:16:16 CET 2005


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
stuff.


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.106
retrieving revision 1.1.2.107
diff -C2 -d -r1.1.2.106 -r1.1.2.107
*** desire.tk	5 Nov 2005 18:34:32 -0000	1.1.2.106
--- desire.tk	6 Nov 2005 00:16:14 -0000	1.1.2.107
***************
*** 877,881 ****
      $self canvas= $self
      #not sure if init should be calling pd, but it fixes the editmode bug for now -chun
!     pd $name editmode $editmode
  }
  
--- 877,881 ----
      $self canvas= $self
      #not sure if init should be calling pd, but it fixes the editmode bug for now -chun
!     pd $name editmode $@editmode
  }
  
***************
*** 1130,1135 ****
  class_new textbox {view}
  
! def textbox ninlets= {v}  {set @ninlets  $v}
  def textbox noutlets= {v} {set @noutlets $v}
  
  def textbox draw {} {
--- 1130,1137 ----
  class_new textbox {view}
  
! def textbox  ninlets= {v}  {set @ninlets  $v}
  def textbox noutlets= {v} {set @noutlets $v}
+ def textbox  ninlets {} {return  $@ninlets}
+ def textbox noutlets {} {return $@noutlets}
  
  def textbox draw {} {
***************
*** 1237,1244 ****
  }
  
  def canvas selection=  {objs} {set     @selection $objs}
! # should remove dupes
! def canvas selection+= {objs} {lappend @selection $objs}
! def canvas selection {objs} {return @selection}
  
  def* objectbox draw {} {
--- 1239,1247 ----
  }
  
+ def canvas selection   {}     {return  @selection}
  def canvas selection=  {objs} {set     @selection $objs}
! def canvas selection+= {objs} {
! 	set @selection [concat [lwithout $@selection $objs] $objs]
! }
  
  def* objectbox draw {} {
***************
*** 1304,1310 ****
  
  def objectbox unclickedit {args} {
! 	puts "$self is being unclicked in [lindex $args 0] edit mode"
! 	$self edit
! 	#objectbox_edit 
  }
  
--- 1307,1311 ----
  
  def objectbox unclickedit {args} {
! 	puts "$self is being unclicked in edit mode"
  }
  
***************
*** 1381,1386 ****
  proc distance {point1 point2} {
  	set off [l- $point1 $point2]
! 	set dist2 [lsum [lzip * $off $off]]
! 	return [expr sqrt($dist2)]
  }
  
--- 1382,1386 ----
  proc distance {point1 point2} {
  	set off [l- $point1 $point2]
! 	return [expr sqrt([lsum [lzip * $off $off]])]
  }
  
***************
*** 1437,1440 ****
--- 1437,1443 ----
  	$c coords lnew $l
      }
+     switch $@action { edit {
+         if {[distance [list $x $y] $@click_at] > 5} {set @action move; mset {ox oy} $@click_at}
+     }}
      switch $@action {
        move {
***************
*** 1554,1560 ****
  
  #-----------------------------------------------------------------------------------#
- def* objectbox clickedit {x y b f id} {
- }
- 
  def* canvas click_on_wire {x y b f id} {
  	set c .x$self.c
--- 1557,1560 ----
***************
*** 1583,1588 ****
  	puts "object_in_edit: $@obj_in_edit id:$id"
  	if {$f&8} {post "right click!"; return}
! 	# if clicked on empty space in edit mode and no object is in edit, draw dash sel rect
! 	if {![llength $id] && ![llength $@obj_in_edit]} {
  		$self deselect_all
  		set @action rect
--- 1583,1589 ----
  	puts "object_in_edit: $@obj_in_edit id:$id"
  	if {$f&8} {post "right click!"; return}
! 	if {[llength $@obj_in_edit]} {$@obj_in_edit unedit; set @obj_in_edit {}}
! 	# if clicked on empty space in edit mode, draw dash sel rect
! 	if {![llength $id]} {
  		$self deselect_all
  		set @action rect
***************
*** 1591,1626 ****
  		return
  	}
- 	if {[llength $@obj_in_edit]} {$@obj_in_edit unedit; set @obj_in_edit {}}
  	set in_selection [expr [lsearch $@selection $id]>=0]
- 	if {[llength $@selection]==1 && $in_selection} {set @select_by click; $x edit; return}
- 	if {[llength $@selection]} {
- 		foreach o $@selection {$o selected?= 0}
- 		set @selection {}
- 	}
  	mset {x1 y1 x2 y2} [$id bbox]
! 	set outs 0; catch {set outs $id noutlets}
  	if {abs($y2-3-$y)<=3 && $outs} {
  		set out [expr int(($x-$x1)*$outs/($x2-$x1))]
  		$c create line $x $y $x $y -dash {4 4 4 4} -tags lnew
! 		set @clickon [list outlet $self $out]
  		set @action wire
  		return
  	}
  	switch $type {
! 	  object {$id clickedit $x $y $b $f $id}
! 	  wire   {$id clickedit $x $y $b $f $id}
  	  default {error BORK}
  	}
  	if {($f&1) && !$already} {post "add to selection?"; return}
! 	if {!$in_selection} {
! 		if {[llength $@selection] == 1} {
! 			set @old_obj [lindex $@selection 0]
! 			if {$@select_by == "click"} {$old_obj unedit}
! 			set @obj_in_edit {}
! 		}
! 		set @selection {}
! 		set @selection [linsert $@selection 0 $id]
! 		set @select_by click
  		set @action move
  	}
  }
--- 1592,1618 ----
  		return
  	}
  	set in_selection [expr [lsearch $@selection $id]>=0]
  	mset {x1 y1 x2 y2} [$id bbox]
! 	set outs 0; set outs [$id noutlets]
! 	post %s "y=$y y1=$y1 y2=$y2 abs(\$y2-3-\$y)=[expr abs($y2-3-$y)] outs=$outs"
  	if {abs($y2-3-$y)<=3 && $outs} {
  		set out [expr int(($x-$x1)*$outs/($x2-$x1))]
  		$c create line $x $y $x $y -dash {4 4 4 4} -tags lnew
! 		set @click_on [list $self $out]
  		set @action wire
  		return
  	}
  	switch $type {
! 	  object {$id clickedit $x $y $b $f}
! 	  wire   {$id clickedit $x $y $b $f}
  	  default {error BORK}
  	}
  	if {($f&1) && !$already} {post "add to selection?"; return}
! 	if {$in_selection && [llength $@selection]>1} {
  		set @action move
+ 	} {
+ 		$self selection+= $id
+ 		set @select_by click
+ 		set @action edit
  	}
  }
***************
*** 1632,1637 ****
      set x [$c canvasx $x]
      set y [$c canvasy $y]
!     set @select_area [list $x $y $x $y]
!     if {$@editmode && !($f&2)} {$self clickedit $x $y $b $f}
      mset {type id} [$self identify_target $x $y $b $f "click"]
      if {![llength $id]} return
--- 1624,1629 ----
      set x [$c canvasx $x]
      set y [$c canvasy $y]
!     set @click_at [list $x $y]
!     if {$@editmode && !($f&2)} {$self clickedit $x $y $b $f; return}
      mset {type id} [$self identify_target $x $y $b $f "click"]
      if {![llength $id]} return
***************
*** 1750,1767 ****
  	$c delete selrect
      }
-     
-     if {[llength $@selection]==1} {
- 	#pd $self gobj-activate x$@selection
- 	if {$@select_by == "click"} {
- 		switch $_($@selection:class) {
- 		  objectbox {
- 			if {![llength $@obj_in_edit]} {
- 				set @obj_in_edit [lindex $@selection 1]
- 				[lindex $@selection 0] edit
- 			}
- 		  }
- 		}
- 	}
-     }
      if {[string length $@focus]} {
  	set id $@focus
--- 1742,1745 ----
***************
*** 1770,1773 ****
--- 1748,1752 ----
      }
      foreach {type id} [$self identify_target $cx $cy -1 -1 "blah "] {}
+     switch $@action { edit {set @obj_in_edit $id; $id edit}}
      switch $type {
        object {





More information about the Pd-cvs mailing list