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

chunlee chunlee at users.sourceforge.net
Thu Oct 5 17:29:50 CEST 2006


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

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.491
retrieving revision 1.1.2.492
diff -C2 -d -r1.1.2.491 -r1.1.2.492
*** desire.tk	4 Oct 2006 15:21:10 -0000	1.1.2.491
--- desire.tk	5 Oct 2006 15:29:47 -0000	1.1.2.492
***************
*** 1029,1033 ****
  def View item {suffixes type coords args} {
  	global font
! 	set c [$@canvas widget]
  	set zoom [$@canvas zoom]
  	set coords [lmap * $coords $zoom]
--- 1029,1034 ----
  def View item {suffixes type coords args} {
  	global font
! 	set c [[$self get_canvas] widget]
! 	#set c [$@canvas widget]
  	set zoom [$@canvas zoom]
  	set coords [lmap * $coords $zoom]
***************
*** 1087,1092 ****
  def View xy {} {
  	# todo: should compute GOP stuff here
! 	set cx $@x1
! 	set cy $@y1
  	return [list $cx $cy]
  }
--- 1088,1103 ----
  def View xy {} {
  	# todo: should compute GOP stuff here
! 	if {$@canvas == ""} {return [list $@x1 $@y1]}
! 	if {[$@canvas gop] && ![winfo exists .$@canvas.c]} {
! 		set mess [$@canvas get_mess]
! 		set xmargin [lindex $mess 6]
! 		set ymargin [lindex $mess 7]
! 		mset {x y} [$@canvas xy]
! 		set cx [expr ($@x1 - $xmargin) + $x]
! 		set cy [expr ($@y1 - $ymargin) + $y]
! 	} else {
! 		set cx $@x1
! 		set cy $@y1
! 	}
  	return [list $cx $cy]
  }
***************
*** 1095,1113 ****
  def View canvas= {c} {set @canvas $c}
  
  def View outside_of_the_box {} {
! 	if {[$self class] == "Array"} {set @inside_box 1; return}
  	if {[$@canvas gop]} {
  	set mess [$@canvas get_mess]
  	set pixwidth [lindex $mess 4]
  	set pixheight [lindex $mess 5]
! 	set xmargin [lindex $mess 6]
! 	set ymargin [lindex $mess 7]
! 	mset {x1 y1} [$self xy]
! 		if {$x1 < [expr $pixwidth + $xmargin] && $y1 < [expr $pixheight + $ymargin]} {
  			set @inside_box 1
  		} else {
  			set @inside_box 0
  		}
- 		if {[$self class] == "Wire"} {set @inside_box 0}
  	} else {
  		set @inside_box 1
--- 1106,1153 ----
  def View canvas= {c} {set @canvas $c}
  
+ # this returns the canvas actually exists/drawn
+ def View get_canvas {} {
+ 	if {[winfo exists .$@canvas.c]} {
+ 		return $@canvas
+ 	} else {
+ 		set next_canvas [$@canvas canvas]
+ 		if {[winfo exists .$next_canvas.c]} {
+ 			return $next_canvas
+ 		} else {
+ 			puts "bug:: no canvas found..."
+ 		}
+ 	}
+ }
+ 
  def View outside_of_the_box {} {
! 	# always hide these things
! 	if {[$self class] == "Wire"} {set @inside_box 0; return}
! 	if {[$self class] == "ObjectBox"} {set @inside_box 0; return}
! 	if {[$self class] == "MessageBox"} {set @inside_box 0; return}
! 	if {[$self class] == "Array"} {
! 		#set @inside_box 1; return
! 		mset {x1 y1} [$@canvas xy]
! 	} else {
! 		set x1 $@x1; set y1 $@y1
! 	}
  	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
  		}
  	} else {
  		set @inside_box 1
***************
*** 1116,1129 ****
  
  def View draw_maybe {} {
  	if {[$self class] == "Canvas" && $@canvas == ""} {return}
! 	if {[$self class] != "Canvas"} {
  		if {$@inside_box} {
  			$self draw
  		} else {
! 			puts "skipping $self, don't draw it...."
  		}
! 	} else {
! 		if {[$self gop]} {$self draw}
! 	}
  	
  }
--- 1156,1176 ----
  
  def View draw_maybe {} {
+ 	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}
! 	#}
  	
  }
***************
*** 3573,3577 ****
  	mset {x1 y1 x2 y2} [$self bbox]
  	set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
! 	[$@canvas widget] canvasx $x1
  	if {[$self selected?]} {set frcol [$self look selectframe]} {set frcol [$self look frame3]}
  	$self item BASE polygon $points -fill [$self look bg] -outline $frcol
--- 3620,3626 ----
  	mset {x1 y1 x2 y2} [$self bbox]
  	set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
! 	set canvas [$self get_canvas]
! 	[$canvas widget] canvasx $x1
! 	#[$@canvas widget] canvasx $x1
  	if {[$self selected?]} {set frcol [$self look selectframe]} {set frcol [$self look frame3]}
  	$self item BASE polygon $points -fill [$self look bg] -outline $frcol
***************
*** 4226,4231 ****
  
  def Radio set {value} {
! 	[$@canvas widget] itemconfigure ${self}BUT       -fill #ffffff
! 	[$@canvas widget] itemconfigure ${self}BUT$value -fill #000000
  }
  
--- 4275,4281 ----
  
  def Radio set {value} {
! 	set c [$self get_canvas]
! 	[$c widget] itemconfigure ${self}BUT       -fill #ffffff
! 	[$c widget] itemconfigure ${self}BUT$value -fill #000000
  }
  





More information about the Pd-cvs mailing list