[PD-cvs] pd/src desire.tk,1.1.2.600.2.340,1.1.2.600.2.341
chunlee
chunlee at users.sourceforge.net
Sat Aug 11 06:30:20 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2588
Modified Files:
Tag: desiredata
desire.tk
Log Message:
TextBox clean up
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.340
retrieving revision 1.1.2.600.2.341
diff -C2 -d -r1.1.2.600.2.340 -r1.1.2.600.2.341
*** desire.tk 11 Aug 2007 01:54:10 -0000 1.1.2.600.2.340
--- desire.tk 11 Aug 2007 04:30:14 -0000 1.1.2.600.2.341
***************
*** 1876,1880 ****
if {$y2 > 100} {set ymax $y2}
set bbox [list $xmin $ymin $xmax $ymax]
- puts "bbox $bbox size::: $size"
if {$@bbox != $bbox} {
$c configure -scrollregion $bbox
--- 1876,1879 ----
***************
*** 2490,2497 ****
mset {x1 y1} [$self xy]
if {$@edit} {
! set t [[$self get_canvas] widget].${self}text
! if {![winfo exists $t]} {$self draw_edit}
! $self item text window [l+ $@textoffset [$self xy]] -window $t -anchor nw \
! -tags "${self}text $self text"
} else {
set fw [font measure [$self look font] 0]
--- 2489,2493 ----
mset {x1 y1} [$self xy]
if {$@edit} {
! $self draw_edit
} else {
set fw [font measure [$self look font] 0]
***************
*** 2534,2537 ****
--- 2530,2534 ----
if {[lsearch [$@canvas selection] $self] < 0} {$@canvas selection+= $self}
set t $c.${self}text
+ if {[winfo exists $t]} {return}
set @edit 1
set @tab_repeats 0
***************
*** 2540,2544 ****
set @selected? 1
$c delete ${self}TEXT
- $self update_size
set font_str [$self look font]
set new_size [format %.0f [expr [lindex $font_str 1]*[$@canvas zoom]]]
--- 2537,2540 ----
***************
*** 2552,2555 ****
--- 2548,2554 ----
text $t -width [expr $width+1] -height $height -relief flat -bg [$self look bgedit] -borderwidth 0 \
-highlightthickness 0 -font $font_str -fg $fg -insertbackground $insertbg -wrap word
+ #text $t -width [expr $width+1] -height $height -relief flat -bg red -borderwidth 0 \
+ # -highlightthickness 0 -font $font_str -fg $fg -insertbackground $insertbg -wrap word
+
$self new_bind
$@canvas focus= $self
***************
*** 2637,2671 ****
def TextBox update_size {} {
- set width [font measure [$self look font] W]
- set ls [font metrics [$self look font] -linespace]
- if {([$self class] == "FloatBox" || [$self class] == "NumBox") && $@w} {
- set @xs [expr ($width*$@w)+3]
- set @ys [expr $ls+3]
- return
- }
if {[info exists @gop]} {if {$@gop} {mset [list @xs @ys] $@pixsize; return}}
- 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]
set c [$self cwidget]
! set t $c.${self}text
!
! if {[winfo exists $c.${self}text]} {
! set nl [lindex [$t configure -height] 4]
! set height [expr {$nl*$ls}]
} else {
! }
! set height [expr {$nl*$ls}]
! set textwidth [expr {$width*($n+$@edit)}]
! if {[llength [$c gettags ${self}TEXT]]} {
! mset {x1 y1 x2 y2} [$c bbox ${self}TEXT]
! set textwidth [expr {($x2 - $x1)/[$@canvas zoom]}]
! set height [expr $y2-$y1]
! }
! catch {
! mset {x1 y1 x2 y2} [[[$self canvas] widget] bbox ${self}text]
set textwidth [expr ($x2-$x1+2)/[$@canvas zoom]]
}
set iowidth [$self look iowidth]
--- 2636,2653 ----
def TextBox update_size {} {
if {[info exists @gop]} {if {$@gop} {mset [list @xs @ys] $@pixsize; return}}
if {$@canvas == ""} {puts "update_size: this textbox has no canvas, try again later"; return}
set c [$self cwidget]
! set t_widget $c.${self}text
! set t_item $c.${self}TEXT
! set w2 0; set h2 0
! set xpad 2; set ypad 3
! if {[winfo exists $t_widget]} {
! set textwidth [expr [winfo reqwidth $t_widget]+$xpad]
! set height [winfo reqheight $t_widget]
} else {
! mset {x1 y1 x2 y2} [[[$self canvas] widget] bbox ${self}TEXT]
set textwidth [expr ($x2-$x1+2)/[$@canvas zoom]]
+ set height [expr ($y2-$y1+2)/[$@canvas zoom]]
}
set iowidth [$self look iowidth]
***************
*** 2673,2678 ****
set bottomwidth [expr {(2*$@noutlets-1)*$iowidth}]
set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! set @ys [expr {3+$height}]
}
#-----------------------------------------------------------------------------------
--- 2655,2661 ----
set bottomwidth [expr {(2*$@noutlets-1)*$iowidth}]
set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! set @ys [expr {$ypad+$height}]
}
+
#-----------------------------------------------------------------------------------
***************
*** 5412,5415 ****
--- 5395,5405 ----
}
+ def AtomBox update_size {} {
+ set width [font measure [$self look font] W]
+ set ls [font metrics [$self look font] -linespace]
+ set @xs [expr ($width*$@w)+3]
+ set @ys [expr $ls+3]
+ }
+
class_new Comment {TextBox}
More information about the Pd-cvs
mailing list