[PD-cvs] pd/src desire.tk,1.1.2.492,1.1.2.493

chunlee chunlee at users.sourceforge.net
Fri Oct 6 17:06:48 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more on gop...


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.492
retrieving revision 1.1.2.493
diff -C2 -d -r1.1.2.492 -r1.1.2.493
*** desire.tk	5 Oct 2006 15:29:47 -0000	1.1.2.492
--- desire.tk	6 Oct 2006 15:06:45 -0000	1.1.2.493
***************
*** 1132,1150 ****
  	}
  	if {[$@canvas gop]} {
! 	set mess [$@canvas get_mess]
! 	set pixwidth [lindex $mess 4]
! 	set pixheight [lindex $mess 5]
  		if {[llength $mess] == 6} {
  			set xmargin 0; set ymargin 0
  		} else {
! 			set xmargin [lindex $mess 6]
! 			set ymargin [lindex $mess 7]
  		}
! 
! 		if {$x1 < [expr $pixwidth + $xmargin] \
! 		    && $x1 > $xmargin \
! 		    && $y1 < [expr $pixheight + $ymargin] \
! 		    && $y1 > $ymargin} {
  			set @inside_box 1
  		} else {
  			set @inside_box 0
--- 1132,1147 ----
  	}
  	if {[$@canvas gop]} {
! 		set mess [$@canvas get_mess]
! 		set pixwidth [lindex $mess 4]
! 		set pixheight [lindex $mess 5]
  		if {[llength $mess] == 6} {
  			set xmargin 0; set ymargin 0
  		} else {
! 			set xmargin [lindex $mess 6];set ymargin [lindex $mess 7]
  		}
! 		if {$x1 < [expr $pixwidth + $xmargin] && $x1 > $xmargin &&\
! 		    $y1 < [expr $pixheight + $ymargin] && $y1 > $ymargin} {
  			set @inside_box 1
+ 			$@canvas visible_children+= $self
  		} else {
  			set @inside_box 0
***************
*** 1158,1177 ****
  	if {$@canvas == "" && [winfo exists .$self.c]} {$self draw}
  	if {[$self class] == "Canvas" && $@canvas == ""} {return}
! 	#if {[$self class] != "Canvas"} {
! 		if {$@inside_box} {
! 			#set @canvas [$@canvas canvas]
  			$self draw
  		} else {
! 			# for drawing opened gop
! 			if {[winfo exists .$@canvas.c]} {
! 				$self draw
! 			} else {
! 				puts "skipping $self, don't draw it...."
! 			}
  		}
! 	#} else {
! 	#	if {[$self gop]} {$self draw}
! 	#}
! 	
  }
  #-----------------------------------------------------------------------------------#
--- 1155,1169 ----
  	if {$@canvas == "" && [winfo exists .$self.c]} {$self draw}
  	if {[$self class] == "Canvas" && $@canvas == ""} {return}
! 	if {$@inside_box} {
! 		#set @canvas [$@canvas canvas]
! 		$self draw
! 	} else {
! 		# for drawing opened gop
! 		if {[winfo exists .$@canvas.c]} {
  			$self draw
  		} else {
! 			puts "skipping $self, don't draw it...."
  		}
! 	}
  }
  #-----------------------------------------------------------------------------------#
***************
*** 1366,1369 ****
--- 1358,1362 ----
      set @keynav_tab_sel "wire"
      set @copy_count 0
+     set @visible_children {}
      #$self editmode= 0
  }
***************
*** 2066,2069 ****
--- 2059,2070 ----
  }
  
+ def Canvas visible_children+= {children} {
+ 	if {[lsearch $@visible_children $children] < 0} {
+ 		set @visible_children [lappend @visible_children $children]
+ 	}
+ }
+ 
+ def Canvas visible_children {} {return $@visible_children}
+ 
  # for undo; calls the server
  def Canvas ins {i constructor} {
***************
*** 2227,2284 ****
  
  def Canvas motion {x y f target} {
!     global font canvas tooltip crosshair
!     set c [$self widget]
!     if {[$self look hairstate] && $@editmode} {
! 	$@crosshair data= $x $y $target
! 	$@crosshair draw
!     } else {
! 	$@crosshair erase
!     }
!     if {$tooltip(visible)} {
! 	if {[expr [distance $tooltip(curpos) [list $x $y]] > 10]} {
! 	    $tooltip(canvas) hide_tooltip
  	}
!     }
!     eval $@dehighlight
!     set @dehighlight {}
!     set oldpos $@curpos
!     set @curpos [list $x $y]
!     # detects if the focus is not on the canvas itself in run mode, ie. numbox
!     if {!$@editmode & [$self focus] != $self & [$self focus] != ""} {[$self focus] motion $x $y $f $target}
!     mset {type id detail} $target
!     switch $@action {
!       move {
!         mset {ox oy} $oldpos
!         foreach obj $@selection {
! 	    if {[[$obj class] <= Box]} {
! 		$obj move [expr $x-$ox] [expr $y-$oy]
! 	    } else {
! 		puts "Canvas motion warning: trying to move non-Box explicitly"
! 	    }
  	}
!         return
!       }
!       edit {
!         if {[distance [list $x $y] $@click_at] > 5} {
! 	  foreach obj $@selection {
! 		if {[[$obj class] <= Box]} {
! 			$obj backupxy= [$obj xy]
! 		} else {
! 			puts "Canvas motion warning: trying to backup coordinates of non-Box"
  		}
- 	  }
- 	  set @action move
- 	  mset {ox oy} $@click_at
  	}
-       }
-       none {}
-       default {$@action motion $x $y $f $target}
-     }
-     if {$@editmode} {
-       switch $type {
- 	inlet  {set port [$id hilite_io i $x $y]; set @dehighlight [list $c delete ${id}i${port}b]}
- 	outlet {set port [$id hilite_io o $x $y]; set @dehighlight [list $c delete ${id}o${port}b]}
-       }
-     }
  }
  
--- 2228,2294 ----
  
  def Canvas motion {x y f target} {
! 	global font canvas tooltip crosshair
! 	set c [$self widget]
! 	if {[$self look hairstate] && $@editmode} {
! 		$@crosshair data= $x $y $target
! 		$@crosshair draw
! 	} else {
! 		$@crosshair erase
  	}
! 	if {$tooltip(visible)} {
! 		if {[expr [distance $tooltip(curpos) [list $x $y]] > 10]} {
! 			$tooltip(canvas) hide_tooltip
! 		}
  	}
! 	eval $@dehighlight
! 	set @dehighlight {}
! 	set oldpos $@curpos
! 	set @curpos [list $x $y]
! 	# detects if the focus is not on the canvas itself in run mode, ie. numbox
! 	if {!$@editmode & [$self focus] != $self & [$self focus] != ""} {
! 		[$self focus] motion $x $y $f $target
! 	}
! 	mset {type id detail} $target
! 	switch $@action {
! 		move {
! 			mset {ox oy} $oldpos
! 			foreach obj $@selection {
! 				if {[[$obj class] <= Box]} {
! 					$obj move [expr $x-$ox] [expr $y-$oy]
! 				} else {
! 					puts "Canvas motion warning: trying to move non-Box explicitly"
! 				}
! 			}
! 			return
! 		}
! 		edit {
! 			if {[distance [list $x $y] $@click_at] > 5} {
! 				foreach obj $@selection {
! 					if {[[$obj class] <= Box]} {
! 						$obj backupxy= [$obj xy]
! 					} else {
! 						puts "Canvas motion warning: trying to backup coordinates of non-Box"
! 					}
! 				}
! 				set @action move
! 				mset {ox oy} $@click_at
! 			}
! 		}
! 		none {}
! 		default {$@action motion $x $y $f $target}
! 	}
! 	if {$id == ""} {return}
! 	if {$@editmode && [$id canvas] == $self} {
! 		switch $type {
! 			inlet  {
! 				set port [$id hilite_io i $x $y]
! 				set @dehighlight [list $c delete ${id}i${port}b]
! 			}
! 			outlet {
! 				set port [$id hilite_io o $x $y]
! 				set @dehighlight [list $c delete ${id}o${port}b]
! 			}
  		}
  	}
  }
  
***************
*** 3238,3244 ****
  	set @y1 [expr $@y1+$dy]
  	set zoom [$@canvas zoom]
- 	#[$@canvas widget] move $self [expr $dx*$zoom] [expr $dy*$zoom]
  	$self changed ;# until we find a way to avoid rounding errors on [$@canvas widget] move.
  	$self changed_wires
  }
  
--- 3248,3262 ----
  	set @y1 [expr $@y1+$dy]
  	set zoom [$@canvas zoom]
  	$self changed ;# until we find a way to avoid rounding errors on [$@canvas widget] move.
  	$self changed_wires
+ 	#update/move the content of gop 
+ 	if {[$self class] == "Canvas"} {
+ 		if {[$self gop] && ![winfo exists .$self.c]} {
+ 			#foreach x $@children {$x changed}
+ 			foreach x $@visible_children {$x changed}
+ 		}
+ 	} else {
+ 		$self changed_wires
+ 	}
  }
  
***************
*** 4043,4051 ****
  
  def AtomBox click {x y f target} {
! 	set c [$@canvas widget]
  	set @clickpos [list $x $y]
  	set @mouse [list $x $y]
  	set t $c.${self}text
! 	$@canvas focus= $self
  	set @rate [expr $f&1 ? 0.01 : 1.00]
  	set @clicking 1
--- 4061,4070 ----
  
  def AtomBox click {x y f target} {
! 	set canvas [$self get_canvas]
! 	set c [$canvas widget]
  	set @clickpos [list $x $y]
  	set @mouse [list $x $y]
  	set t $c.${self}text
! 	$canvas focus= $self
  	set @rate [expr $f&1 ? 0.01 : 1.00]
  	set @clicking 1
***************
*** 4066,4070 ****
  
  def FloatAtom motion {x y f target} {
! 	set focused [$self == [$@canvas focus]]
  	if {!$focused} {return}
  	if {!$@clicking} {return}
--- 4085,4090 ----
  
  def FloatAtom motion {x y f target} {
! 	set canvas [$self get_canvas]
! 	set focused [$self == [$canvas focus]]
  	if {!$focused} {return}
  	if {!$@clicking} {return}





More information about the Pd-cvs mailing list