Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29596
Modified Files: Tag: devel_0_39 desire.tk Log Message: first commit for multiple line textbox
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.464 retrieving revision 1.1.2.465 diff -C2 -d -r1.1.2.464 -r1.1.2.465 *** desire.tk 8 Sep 2006 13:42:25 -0000 1.1.2.464 --- desire.tk 12 Sep 2006 15:00:49 -0000 1.1.2.465 *************** *** 1636,1639 **** --- 1636,1640 ---- set @y1 [lindex $mess 3] set @text [lrange $mess 4 end] + set @longline 0 }
*************** *** 1648,1652 **** if {$@edit} { set t [$@canvas widget].${self}text ! $t configure -width [string length [$t get 0.0 end]] } { $self item TEXT text [l+ {2 2} [list $x1 $y1]] \ --- 1649,1654 ---- if {$@edit} { set t [$@canvas widget].${self}text ! #$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]] \ *************** *** 1668,1671 **** --- 1670,1674 ---- set @edit 1 set @tab_repeats 0 + set @longline 0 $@canvas obj_in_edit= $self set @selected? 1 *************** *** 1695,1700 **** --- 1698,1708 ---- def TextBox key {widget x y key iso shift} { after 0 "$self after_key $widget" + set c [$@canvas widget] + set t $c.${self}text + #$self long_line + #$t configure -width [string length [$t get $@longline.0 $@longline.end]] switch -- $key { Tab {$self propose_completions; $widget configure -state disabled} + 10 {$t configure -height [expr [lindex [$t configure -height] 4] + 1]} #default {lower [$@canvas widget].${self}propose $widget; set @tab_repeats 0} } *************** *** 1702,1718 ****
def TextBox after_key {widget} { ! $widget configure -state normal $self changed }
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] set c [$@canvas widget] set padx [$self look fontpadx];set pady [$self look fontpady] set width [font measure [$self look fontstring] W] ! set height [font metrics [$self look fontstring] -linespace] #set width [$self look fontwidth];set height [$self look fontheight] set textwidth [expr $padx+$width*($n+$@edit)] if {[llength [$c gettags ${self}TEXT]]} { --- 1710,1745 ----
def TextBox after_key {widget} { ! #$widget configure -state normal ! $self long_line $self changed }
+ def TextBox long_line {} { + set c [$@canvas widget] + set t $c.${self}text + set lines [lindex [$t configure -height] 4] + for {set line 1} {$line <= $lines} {incr line} { + set len [string length [$c.${self}text get $line.0 $line.end]] + set len2 [string length [$c.${self}text get $@longline.0 $@longline.end]] + if {$len > $len2} {set @longline $line} + } + } + 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] set c [$@canvas widget] + set t $c.${self}text 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]]} { *************** *** 1722,1728 **** #if {[llength [$c gettags ${self}text]]} { catch { ! set n [expr [string length [$c.${self}text get 1.0 1.end]] -1] ! mset {x1 y1 w h} [$c.${self}text bbox 1.$n] ! set textwidth [expr ($padx + $x1 + ($w * 2)+$padx+2) / [$@canvas zoom]] } #} --- 1749,1758 ---- #if {[llength [$c gettags ${self}text]]} { catch { ! #set n [expr [string length [$c.${self}text get 1.0 1.end]] -1] ! set n [expr [string length [$c.${self}text get $@longline.0 $@longline.end]] -1] ! #mset {x1 y1 w h} [$c.${self}text bbox 1.$n] ! mset {x1 y1 w h} [$c.${self}text bbox $@longline.$n] ! set textwidth [expr ($padx + $x1 + ($w * 2)+$padx+2) / [$@canvas zoom]] ! } #} *************** *** 1820,1824 **** set t $c.${self}text set propose $c.${self}propose ! $self setto [$t get 1.0 1.end] after 1 "destroy $t" if {[winfo exists .completion]} {$@action cancel} --- 1850,1854 ---- 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}