[PD-cvs] pd/src desire.tk,1.1.2.483,1.1.2.484

chunlee chunlee at users.sourceforge.net
Tue Sep 26 18:27:28 CEST 2006


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

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


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.483
retrieving revision 1.1.2.484
diff -C2 -d -r1.1.2.483 -r1.1.2.484
*** desire.tk	26 Sep 2006 11:19:59 -0000	1.1.2.483
--- desire.tk	26 Sep 2006 16:27:25 -0000	1.1.2.484
***************
*** 2400,2403 ****
--- 2400,2405 ----
  def Canvas popup_help {} {global main; $main class_browser}
  
+ def Canvas popup_open {} {set @mapped 1; pd .$self map 1; $self init_window; $self redraw}
+ 
  def Canvas popup {id x y} {
    set p .$self.popup
***************
*** 2563,2569 ****
  	}
  	mset {type id detail} $target
  	if {[info exists @subpatch]} {
  		if {$@subpatch} {
- 		puts "$self is a subpatch and is mapped --> $@mapped"
  			if {!$@mapped} {
  			#can't wait till @mapped get updated till the update_object
--- 2565,2571 ----
  	}
  	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
***************
*** 2583,2586 ****
--- 2585,2589 ----
  	focus $c
  	}
+ 	}
  	set @click_at [list $x $y]
  	
***************
*** 2588,2593 ****
  	if {!$@editmode} {
  		if {[llength $id]} {
! 			puts "target = $target"
! 			$id click $x $y $f $target
  		}
  		return
--- 2591,2596 ----
  	if {!$@editmode} {
  		if {[llength $id]} {
! 			puts "target = $target :: [$id class]"
! 			if {[$id class] != "Canvas"} { $id click $x $y $f $target}
  		}
  		return
***************
*** 4510,4513 ****
--- 4513,4517 ----
  	set @name [lindex $mess 2]
  	puts "  my name is :::: $@name"
+ 	puts "  my canvas is ---> $@canvas"
  	set @length 0
  	set @data {}
***************
*** 4521,4538 ****
  def Array draw {} {
  	global font
! 	mset {x1 y1} {0 0}
! 	puts "  my canvas is: $@canvas"
! 	if {![$@canvas mapped]} return
!        	set mess [$@canvas get_mess]
! 	mset {c_width c_height} [$@canvas get_dimen]
! 	#set @width [winfo width .$@canvas.c]
! 	#set @height [winfo height .$@canvas.c]
  	set xfrom [lindex $mess 0]
  	set yfrom [lindex $mess 3]
  	set xto [lindex $mess 2]
  	set yto [lindex $mess 1]
  	set width [expr $c_width / $@length]
- 	puts "w: $c_width | h: $c_height | length: $@length | xfrom: $xfrom | xto: $xto | yfrom: $yfrom | yto: $yto"
- 	puts "data: $@data"
  	set i 0
  	#cheats
--- 4525,4538 ----
  def Array draw {} {
  	global font
! 	mset {x_off y_off} [$@canvas xy]
! 	set mess [$@canvas get_mess]
  	set xfrom [lindex $mess 0]
  	set yfrom [lindex $mess 3]
  	set xto [lindex $mess 2]
  	set yto [lindex $mess 1]
+ 
+ 	if {[$@canvas mapped]} {
+ 	mset {c_width c_height} [$@canvas get_dimen]
  	set width [expr $c_width / $@length]
  	set i 0
  	#cheats
***************
*** 4549,4552 ****
--- 4549,4569 ----
  		incr i
  	}
+ 	} else {
+ 		set pixwidth [lindex $mess 4]
+ 		set pixheight [lindex $mess 5]
+ 		set width [expr $pixwidth / $@length]
+ 	        set canvas [$@canvas canvas]
+ 		set i 0
+ 		foreach val $@data {
+ 		if {!$val} {set val 0.0}
+ 		set y [expr  (($val+abs($yfrom))/($yto-($yfrom)) * $pixheight) + $y_off]
+ 		set x1 [expr ($width * $i) + $x_off]
+ 		set x2 [expr $x1 + $width]
+ 		set line [list $x1 $y $x2 $y]
+ 		set tag ${self}${i}
+ 			$@canvas item elem${i} line $line -fill [$@canvas look compfg] -width 2 -tags "$self ${self}elem${i}"
+ 		incr i
+ 		}
+ 	}
  }
  





More information about the Pd-cvs mailing list