[PD-cvs] pd/src desire.tk,1.1.2.600.2.135,1.1.2.600.2.136

chunlee chunlee at users.sourceforge.net
Sun Dec 24 16:20:59 CET 2006


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
some fixes on graphical array


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.135
retrieving revision 1.1.2.600.2.136
diff -C2 -d -r1.1.2.600.2.135 -r1.1.2.600.2.136
*** desire.tk	22 Dec 2006 18:22:26 -0000	1.1.2.600.2.135
--- desire.tk	24 Dec 2006 15:20:55 -0000	1.1.2.600.2.136
***************
*** 2120,2123 ****
--- 2120,2124 ----
  
  def TextBox draw {} {
+ 	if {[$self class] == "Canvas"} {if {$@text == "graph"} {$self update_size; super; return}}
  	# "TEXT" is the text label while "text" is the the input text field tk widget.
  	# the text should be drawn before, so that update_size works at the right time.
***************
*** 2156,2160 ****
  	$self update_size
  	set font_str [$self look font]
! 	set new_size [format %.0f [expr [lindex $font_str 1]*[$@canvas zoom]]]
  	set font_str [lreplace $font_str 1 1 $new_size]
  	set l {};set nl 1;set newline {-1};set i 0;set width 0
--- 2157,2161 ----
  	$self update_size
  	set font_str [$self look font]
! pppp	set new_size [format %.0f [expr [lindex $font_str 1]*[$@canvas zoom]]]
  	set font_str [lreplace $font_str 1 1 $new_size]
  	set l {};set nl 1;set newline {-1};set i 0;set width 0
***************
*** 3432,3435 ****
--- 3433,3437 ----
  					set obj [$id get_parent_gop $self]
  				} else {set obj $id}
+ 				if {[$id class] == "Canvas"} {if {[$id text] == "graph"} {set @action none; return}}
  				$obj edit; set @action none; $obj changed action
  			}
***************
*** 5363,5369 ****
  }
  
  def Array draw {} {
  	global font
! 	#set canvas [$self get_canvas]
  	mset {x_off y_off} [$@canvas xy]
  	mset {xfrom yto xto yfrom pixwidth pixheight} [$@canvas get_mess]
--- 5365,5378 ----
  }
  
+ def Array draw_name {} {
+ 	mset {x_off y_off} [$@canvas xy]
+ 	$self item TEXT text [lmap + [list $x_off $y_off] 2] \
+ 		    -font [View_look $self font] -text $@name \
+ 		    -fill [View_look $self fg] -anchor nw
+ }
+ 
  def Array draw {} {
  	global font
! 	$self draw_name
  	mset {x_off y_off} [$@canvas xy]
  	mset {xfrom yto xto yfrom pixwidth pixheight} [$@canvas get_mess]
***************
*** 5374,5378 ****
  		foreach val $@data {
  			if {!$val} {set val 0.0}
! 			set y [expr $c_height - ((($val+abs($yfrom))/($yto-($yfrom)) * $c_height))]
  			set x1 [expr $width * $i]
  			set x2 [expr $x1 + $width]
--- 5383,5387 ----
  		foreach val $@data {
  			if {!$val} {set val 0.0}
! 			set y [expr $c_height - (((double($val)+abs($yfrom))/($yto-($yfrom)) * $c_height))]
  			set x1 [expr $width * $i]
  			set x2 [expr $x1 + $width]
***************
*** 5385,5394 ****
  	} else {
  		set width [expr $pixwidth / $@length]
- 	        #set canvas [$@canvas canvas]
  		set canvas [$self get_canvas]
  		set i 0
  		foreach val $@data {
  			if {!$val} {set val 0.0}
! 			set y [expr  ($pixheight - (($val+abs($yfrom))/($yto-($yfrom)) * $pixheight)) + $y_off]
  			set x1 [expr ($width * $i) + $x_off]
  			set x2 [expr $x1 + $width]
--- 5394,5404 ----
  	} else {
  		set width [expr $pixwidth / $@length]
  		set canvas [$self get_canvas]
  		set i 0
  		foreach val $@data {
  			if {!$val} {set val 0.0}
! 			#set val2 [lindex $@data [expr $i+1]]
! 			set y [expr  ($pixheight - ((double($val)+abs($yfrom))/($yto-($yfrom)) * $pixheight)) + $y_off]
! 			#set y2 [expr  ($pixheight - ((double($val2)+abs($yfrom))/($yto-($yfrom)) * $pixheight)) + $y_off]
  			set x1 [expr ($width * $i) + $x_off]
  			set x2 [expr $x1 + $width]
***************
*** 5397,5400 ****
--- 5407,5425 ----
  			incr i
  		}
+ 		[$canvas widget] raise $self
+ 		#set width [expr $pixwidth / [expr $@length-1]]
+ 		#set canvas [$self get_canvas]
+ 		#set i 0
+ 		#for {set i 0} {$i < [expr $@length-1]} {incr i} {
+ 		#	#if {!$val} {set val 0.0}
+ 		#	set val [lindex $@data [expr $i]]
+ 		#	set val2 [lindex $@data [expr $i+1]]
+ 		#	set y [expr  ($pixheight - ((double($val)+abs($yfrom))/($yto-($yfrom)) * $pixheight)) + $y_off]
+ 		#	set y2 [expr  ($pixheight - ((double($val2)+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 $y2]
+ 		#	$self item ${self}ELEM${i} line $line -fill [$self look fg] -width 0
+ 		#}
  	}
  }





More information about the Pd-cvs mailing list