Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14196
Modified Files: Tag: devel_0_39 desire.tk Log Message: can now undo edits to objectbox,messagebox,comment
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.361 retrieving revision 1.1.2.362 diff -C2 -d -r1.1.2.361 -r1.1.2.362 *** desire.tk 18 Aug 2006 00:03:01 -0000 1.1.2.361 --- desire.tk 18 Aug 2006 00:37:24 -0000 1.1.2.362 *************** *** 999,1003 **** puts $sock "$s;" #flush $sock ! puts "<- $s;" }
--- 999,1003 ---- puts $sock "$s;" #flush $sock ! puts "<- $s; \033[0;1;33m(from [info level -1])\033[0m" }
*************** *** 1581,1585 **** if {$@edit} { set t .$@canvas.c.${self}text ! $t configure -width [expr [string length $@text]+1] } { $self item TEXT text [l+ {2 2} [list $x1 $y1]] \ --- 1581,1585 ---- if {$@edit} { set t .$@canvas.c.${self}text ! $t configure -width [expr [string length [$t get 0.0 end]]+1] } { $self item TEXT text [l+ {2 2} [list $x1 $y1]] \ *************** *** 1631,1651 **** def TextBox after_key {widget} { $widget configure -state normal - set @text [$widget get 1.0 1.end] - #set l {} - #foreach char [split $@text ""] {lappend l [scan $char %c]} - #set tab [lsearch $l 9] - #set l [lreplace $l $tab $tab] - #$widget delete 1.0 1.end - #set text {} - #foreach char $l {append text [format %c $char]} - #$widget insert 1.0 $text - #set @text $text $self update_size ! $self draw }
! def TextBox update_size {} { global font ! set textwidth [expr $font(padx)+$font(width)*([string length $@text]+$@edit)] set topwidth [expr (2* $@ninlets-1) * [look iowidth]] set bottomwidth [expr (2*$@noutlets-1) * [look iowidth]] --- 1631,1643 ---- def TextBox after_key {widget} { $widget configure -state normal $self update_size ! $self changed }
! def TextBox update_size {{n -1}} { global font ! set n [string length $@text] ! catch {set n [string length [.$@canvas.c.${self}text get 1.0 1.end]]} ! set textwidth [expr $font(padx)+$font(width)*($n+$@edit)] set topwidth [expr (2* $@ninlets-1) * [look iowidth]] set bottomwidth [expr (2*$@noutlets-1) * [look iowidth]] *************** *** 1725,1728 **** --- 1717,1730 ---- }
+ # this is called from the GUI; text= is reserved for server. + def TextBox setto {text} { + [$@canvas history] add [list $self setto $@text] + set @text $text + set l {} + foreach char [split $@text ""] {lappend l [scan $char %c]} + pd .$@canvas text_setto !$self $l + $self changed + } + def TextBox unedit {} { if {!$@edit} {return} *************** *** 1731,1740 **** set t $c.${self}text set propose $c.${self}propose ! set @text [$t get 1.0 1.end] after 1 "destroy $t" #after 1 "destroy $propose" - set l {} - foreach char [split $@text ""] {lappend l [scan $char %c]} - pd .$@canvas text_setto !$self $l focus $c } --- 1733,1739 ---- set t $c.${self}text set propose $c.${self}propose ! $self setto [$t get 1.0 1.end] after 1 "destroy $t" #after 1 "destroy $propose" focus $c }