[PD-cvs] pd/src desire.tk,1.1.2.466,1.1.2.467

chunlee chunlee at users.sourceforge.net
Wed Sep 13 03:46:51 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
fixes to the previous multi line commits


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.466
retrieving revision 1.1.2.467
diff -C2 -d -r1.1.2.466 -r1.1.2.467
*** desire.tk	12 Sep 2006 17:13:55 -0000	1.1.2.466
--- desire.tk	13 Sep 2006 01:46:48 -0000	1.1.2.467
***************
*** 1649,1658 ****
      if {$@edit} {
  	set t [$@canvas widget].${self}text
! 	    puts [$t get 1.0 end]
! 	#$t configure -width [string length [$t get 1.0 1.end]]
! 	$t configure -width [string length [$t get $@longline.0 $@longline.end]]
      } {
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-font [$self look fontstring] -text $@text -fill [$self look fg] -anchor nw
      }
      $self update_size
--- 1649,1658 ----
      if {$@edit} {
  	set t [$@canvas widget].${self}text
! 	#$t configure -width [string length [$t get 1.0 end]]
! 	#$t configure -width [string length [$t get $@longline.0 $@longline.end]]
      } {
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-font [$self look fontstring] -text $@text \
! 	        -fill [$self look fg] -anchor nw
      }
      $self update_size
***************
*** 1671,1675 ****
  	set @edit 1
  	set @tab_repeats 0
! 	set @longline 1
  	$@canvas obj_in_edit= $self
  	set @selected? 1
--- 1671,1676 ----
  	set @edit 1
  	set @tab_repeats 0
! 	# stores which line is the longest if multiple line
! 	set @longline 1 
  	$@canvas obj_in_edit= $self
  	set @selected? 1
***************
*** 1684,1689 ****
  		-bg [$c itemcget ${self}BASE -fill] -borderwidth 0 -highlightthickness 0\
  		-font $font_str -fg [$self look fg]
! 	#bind $t <Key>            "$self long_line; puts  \[$t get $@longline.0 $@longline.end\] ;$self key %W %x %y %K %A 0"
! 	bind $t <Key>            "$self key %W %x %y %K %A 0"
  	bind $t <Control-Return> "$self key %W %x %y 10 %A 0"
  	bind $t <Return>         "$self unedit"
--- 1685,1694 ----
  		-bg [$c itemcget ${self}BASE -fill] -borderwidth 0 -highlightthickness 0\
  		-font $font_str -fg [$self look fg]
! 	#text $t -height 1 -width [expr [string length $@text]+1] -relief flat \
! 	#	-bg pink -borderwidth 0 -highlightthickness 0\
! 	#	-font $font_str -fg [$self look fg]
! 
! 	bind $t <Key> "$self resize; $self key %W %x %y %K %A 0"
! 	#bind $t <Key>            "$self key %W %x %y %K %A 0"
  	bind $t <Control-Return> "$self key %W %x %y 10 %A 0"
  	bind $t <Return>         "$self unedit"
***************
*** 1698,1701 ****
--- 1703,1713 ----
  }
  
+ def TextBox resize {} {
+ 	set c [$@canvas widget]
+ 	set t $c.${self}text
+ 	$self long_line 
+ 	$t configure -width [string length [$t get $@longline.0 "$@longline.end + 1 chars"]]
+ }
+ 
  def TextBox key {widget x y key iso shift} {
  	after 0 "$self after_key $widget"
***************
*** 1713,1720 ****
  def TextBox after_key {widget} {
  	$widget configure -state normal
! 	$self long_line
  	$self changed
  }
! 
  def TextBox long_line {} {
  	set c [$@canvas widget]
--- 1725,1732 ----
  def TextBox after_key {widget} {
  	$widget configure -state normal
! 	#$self long_line
  	$self changed
  }
! #checks which line should be used as the width of the objectbox
  def TextBox long_line {} {
  	set c [$@canvas widget]
***************
*** 1726,1734 ****
  		if {$len > $len2} {set @longline $line}
  	}
- 	puts "   longline:::: $@longline"
  }
  
  def TextBox update_size {} {
! 	 global font
  	if {$@canvas == ""} {puts "update_size: this textbox has no canvas, try again later"; return}
  	set n [string length $@text]
--- 1738,1748 ----
  		if {$len > $len2} {set @longline $line}
  	}
  }
  
  def TextBox update_size {} {
! 	global font
! 	set l {};set nl 1
! 	foreach char [split $@text ""] {lappend l [scan $char %c]}
! 	foreach val $l {if {$val == 10} {incr nl}}
  	if {$@canvas == ""} {puts "update_size: this textbox has no canvas, try again later"; return}
  	set n [string length $@text]
***************
*** 1737,1748 ****
  	set padx [$self look fontpadx];set pady [$self look fontpady]
  	set width [font measure [$self look fontstring] W]
  	if {[winfo exists $c.${self}text]} {
! 		set height [expr [lindex [$t configure -height] 4] * \
! 				[font metrics [$self look fontstring] -linespace]]
! 	} else {
! 		set height [font metrics [$self look fontstring] -linespace]
  	}
! 	#set width [$self look fontwidth];set height [$self look fontheight]
! 	#set height [font metrics [$self look fontstring] -linespace]
  	set textwidth [expr $padx+$width*($n+$@edit)]
  	if {[llength [$c gettags ${self}TEXT]]} {
--- 1751,1762 ----
  	set padx [$self look fontpadx];set pady [$self look fontpady]
  	set width [font measure [$self look fontstring] W]
+ 	#set width [$self look fontwidth];set height [$self look fontheight]
  	if {[winfo exists $c.${self}text]} {
! 	     set height [expr [lindex [$t configure -height] 4] * \
! 			      [font metrics [$self look fontstring] -linespace]]
! 	      } else {
! 		      set height [expr [font metrics [$self look fontstring] -linespace] * $nl]
  	}
! 	#set height [expr [font metrics [$self look fontstring] -linespace] * $nl]
  	set textwidth [expr $padx+$width*($n+$@edit)]
  	if {[llength [$c gettags ${self}TEXT]]} {
***************
*** 1839,1843 ****
  # this is called from the GUI; text= is reserved for server.
  def TextBox setto {text} {
- 	puts "text:: $text"
  	[$@canvas history] add [list $self setto $@text]
  	set @text $text
--- 1853,1856 ----
***************
*** 1854,1858 ****
  	set t $c.${self}text
  	set propose $c.${self}propose
! 	$self setto [$t get 1.0 end]
  	after 1 "destroy $t"
  	if {[winfo exists .completion]} {$@action cancel}
--- 1867,1871 ----
  	set t $c.${self}text
  	set propose $c.${self}propose
! 	$self setto [$t get 1.0 "end - 1 chars"]
  	after 1 "destroy $t"
  	if {[winfo exists .completion]} {$@action cancel}





More information about the Pd-cvs mailing list