Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7905
Modified Files: Tag: desiredata desire.tk Log Message: a rather quick fix to handle ctrl+v resizing the text widget
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.328 retrieving revision 1.1.2.600.2.329 diff -C2 -d -r1.1.2.600.2.328 -r1.1.2.600.2.329 *** desire.tk 9 Aug 2007 02:07:52 -0000 1.1.2.600.2.328 --- desire.tk 9 Aug 2007 03:21:33 -0000 1.1.2.600.2.329 *************** *** 1356,1360 **** def View draw {} {}
- #def View delete {} {if {[[$self class] <= Box]} {$self erase}; super} def View delete {} {$self erase; super} def View erase {} {$self item_delete} --- 1356,1359 ---- *************** *** 2541,2544 **** --- 2540,2544 ---- bind $t <Key> "$self key_input %W %x %y %K %A 0; after 0 [$self resize %K]" bind $t <Control-Return> "$self key_input %W %x %y 10 %A 0" + bind $t <Control-v> "$self paste_resize" bind $t <Return> "$self unedit" bind $t <Escape> "$self unedit 0" *************** *** 2604,2607 **** --- 2604,2632 ---- }
+ def TextBox paste_resize {} { + if {[[$self class] <= AtomBox]} {return} + set c [$self cwidget] + set t $c.${self}text + $self long_line + set fixed [font metrics [$self look font] -fixed] + set text [clipboard get] + if {$fixed} { + set width [string length $text] + } else { + set textpix [font measure [$self look font] $text] + set fwidth [font measure [$self look font] 0] + set width [expr (($textpix+$fwidth-1)/$fwidth)+1] + } + set maxwidth 40 + mset {y1 y2} [$t yview] + set height [$t cget -height] + if {$y2-$y1 < 1} { + set height [expr $height/($y2-$y1)] + } + $t configure -width [min $width $maxwidth] -height $height -wrap word + $self update_size + $self changed + } + def TextBox scroll_history {incr} { set c [$self cwidget] *************** *** 7426,7429 **** --- 7451,7455 ---- def Dialog apply {} {} def Dialog delete {} {destroy .$self; super} + def Dialog erase {} {}; # so that it doesn't call View erase
def Dialog init {args} {