[PD-cvs] pd/src desire.tk,1.1.2.514,1.1.2.515

chunlee chunlee at users.sourceforge.net
Thu Oct 19 03:42:35 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
finally fed up with the long Canvas click, its now a lot shorter


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.514
retrieving revision 1.1.2.515
diff -C2 -d -r1.1.2.514 -r1.1.2.515
*** desire.tk	18 Oct 2006 23:23:54 -0000	1.1.2.514
--- desire.tk	19 Oct 2006 01:42:32 -0000	1.1.2.515
***************
*** 1048,1054 ****
  def View item_delete {{suffix all}} {
    set c [$@canvas widget]
    switch -- $suffix {
      all     {$c delete $self       }
!     default {$c delete $self$suffix}}}
  
  def View draw {} {}
--- 1048,1056 ----
  def View item_delete {{suffix all}} {
    set c [$@canvas widget]
+ 	if {![winfo exists $c]} {return}
    switch -- $suffix {
      all     {$c delete $self       }
!     default {$c delete $self$suffix}}
! }
  
  def View draw {} {}
***************
*** 1146,1151 ****
  	if {[$self class] == "Canvas" && $@canvas == ""} {return}
  	if {$@inside_box} {
! 		#set @canvas [$@canvas canvas]
! 		$self draw
  	} else {
  		# for drawing opened gop
--- 1148,1152 ----
  	if {[$self class] == "Canvas" && $@canvas == ""} {return}
  	if {$@inside_box} {
! 		if {[$@canvas mapped]} {$self draw}
  	} else {
  		# for drawing opened gop
***************
*** 2793,2797 ****
  }
  
- #!@#$ this method is too long
  def Canvas click {x y f target} {
  	if {[winfo exists .completion]} {
--- 2794,2797 ----
***************
*** 2801,2871 ****
  	}
  	mset {type id detail} $target
- 	if {!$@gop} {
- 	if {[info exists @subpatch]} {
- 		if {$@subpatch} {
- 			if {!$@mapped} {
- 			#can't wait till @mapped get updated till the update_object
- 			set @mapped 1
- 			pd .$self map 1
- 			$self init_window
- 			$self redraw
- 			return
- 			} else {
- 				set c [$self widget]
- 				focus $c
- 				if {$id == $self} {return}
- 			}
- 	       	}
- 	} else { 
  	set c [$self widget]
  	focus $c
- 	}
- 	}
  	set @click_at [list $x $y]
! 	
! 	if {$f&8} {
! 		if {!$@editmode} {return}
! 		set c [$self widget]
! 		set @insert_x $x; set @insert_y $y
! 		$self popup $id [winfo pointerx $c] [winfo pointery $c]
! 		return
  	}
! 	if {!$@editmode} {
! 		if {[llength $id]} {
! 			if {[$id class] != "Canvas"} {
! 				$id click $x $y $f $target
! 			} else {
! 				if {[$id subpatch]} {
! 					if {![$id mapped]} {
! 						$id popup_open
! 					} else {
! 					        raise .$id
! 					}
  				}
  			}
  		}
- 		return
  	}
! 	if {[llength $@obj_in_edit]} {$@obj_in_edit unedit; set @obj_in_edit {}}
! 	set in_selection [expr [lsearch $@selection $id]>=0]
! 	switch $type {
! 	  outlet {set @action [FutureWire new $self $x $y $f $target]; return}
! 	  inlet {}
! 	  object {
! 		  if {[$id subpatch]} {puts "$id could be a subpatch"}
! 		  $self selection+= $id; set @action edit
! 		  switch [expr $f&255] {
! 			  2 {$self auto_wire}
! 		  }
! 	  }
! 	  wire {
! 	    #$self deselect_all
! 	    set obj_selection [$self selection]
! 	    if {[llength $obj_selection]} {$self selection-= $obj_selection}
! 	    set @keynav_tab_sel "object"
! 	    switch [expr $f&255] {
  		0 {$self selection_wire= $id}
  		1 {$self selection_wire+= $id}
! 		2 {# ctrl-click on wire?
  			set c [$self widget]
  			set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]]
--- 2801,2853 ----
  	}
  	mset {type id detail} $target
  	set c [$self widget]
  	focus $c
  	set @click_at [list $x $y]
! 	if {$f&8} {$self right_click $id $x $y; return}
! 	if {!$@editmode} {$self run_click $id $x $y $f $target; return}
! 	if {[llength $@obj_in_edit]} {$@obj_in_edit unedit; set @obj_in_edit {}}
! 	set in_selection [expr [lsearch $@selection $id]>=0]
! 	switch $type {
! 		outlet {set @action [FutureWire new $self $x $y $f $target]; return}
! 		inlet {}
! 		object {$self click_on_object $id $f}
! 		wire {$self click_on_wire $id $f $x $y}
! 		nothing {$self click_on_nothing $f $target $x $y; return}
! 		default {error "BORK: $type"}
  	}
! 
! }
! 
! def Canvas run_click {id x y f target} {
! 	if {[llength $id]} {
! 		if {[$id class] != "Canvas"} {
! 			$id click $x $y $f $target
! 		} else {
! 			if {[$id subpatch]} {
! 				if {![$id mapped]} {
! 					$id popup_open
! 				} else {
! 					raise .$id
  				}
  			}
  		}
  	}
! }
! 
! def Canvas click_on_object {id f} {
! 	$self selection+= $id; set @action edit
! 	switch [expr $f&255] {
! 		2 {$self auto_wire}
! 	}
! }
! 
! def Canvas click_on_wire {id f x y} {
! 	set obj_selection [$self selection]
! 	if {[llength $obj_selection]} {$self selection-= $obj_selection}
! 	set @keynav_tab_sel "object"
! 	switch [expr $f&255] {
  		0 {$self selection_wire= $id}
  		1 {$self selection_wire+= $id}
! 		2 {
  			set c [$self widget]
  			set wire [lindex $@wires_pair [expr [lsearch $@wires_pair $id]-1]]
***************
*** 2875,2880 ****
  			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]]
--- 2857,2860 ----
***************
*** 2891,2900 ****
  			set @action [FutureWire new $self $x1 $y1 $f $target]
  		}
! 	    }
! 	  }
! 	  nothing {
! 		$self deselect_all
! 		$self dehilite_io
! 		switch $@action {
  		edit {}
  		move {}
--- 2871,2881 ----
  			set @action [FutureWire new $self $x1 $y1 $f $target]
  		}
! 	}
! }
! 
! def Canvas click_on_nothing {f target x y} {
! 	$self deselect_all
! 	$self dehilite_io
! 	switch $@action {
  		edit {}
  		move {}
***************
*** 2903,2913 ****
  		chain_obj {}
  		default {$@action unclick $x $y $f $target}
-       		}
- 		set @action [SelRect new $self $x $y $f $target]
- 		return
- 	  }
- 	  default {error "BORK: $type"}
  	}
  
  }
  
--- 2884,2896 ----
  		chain_obj {}
  		default {$@action unclick $x $y $f $target}
  	}
+ 	set @action [SelRect new $self $x $y $f $target]
+ }
  
+ def Canvas right_click {id x y} {
+ 	if {!$@editmode} {return}
+ 	set c [$self widget]
+ 	set @insert_x $x; set @insert_y $y
+ 	$self popup $id [winfo pointerx $c] [winfo pointery $c]
  }
  





More information about the Pd-cvs mailing list