Revision: 8154
http://svn.sourceforge.net/amsn/?rev=8154&view=rev
Author: kakaroto
Date: 2007-03-04 17:20:49 -0800 (Sun, 04 Mar 2007)
Log Message:
-----------
I think that this is the fix where we had some users have the top bar of a CW in a multi user convo with a height too small to contain all the users in the CW...
refer to http://www.amsn-project.net/forums/viewtopic.php?t=2762&postdays=0&postorder=asc&start=0 for more info.
While testing, I noticed that the 'webcam' capability icon was very very badly placed, it wouldn't be placed next to the correct user, so now it's fixed by using the same method..
the font -size option does NOT represent the size in pixels, it's just a 'size' to represent the size of the font but it has nothing to do with the pixel representation. for real size, we must use [font metrics]. sbold, size 10, has a linespacing of 18, ascent of 15 and descent of 3...
Modified Paths:
--------------
trunk/amsn/chatwindow.tcl
Modified: trunk/amsn/chatwindow.tcl
===================================================================
--- trunk/amsn/chatwindow.tcl 2007-03-04 21:59:22 UTC (rev 8153)
+++ trunk/amsn/chatwindow.tcl 2007-03-05 01:20:49 UTC (rev 8154)
@@ -2801,12 +2801,15 @@
#Get number of lines
set n [llength [split $text "\n"]]
#Multiply font size by no. lines and add gap between lines * (no. lines - 1).
- return [expr {$n * [font configure $font -size] + (($n - 1) * 7)}]
+ return [expr {$n * [font metrics $font -displayof $widget -linespace]}]
} else {
#Get number of lines
set n [llength [split $text "\n"]]
+ set f [font create -family helvetica -size 12 -weight normal]
#Multiply font size by no. lines and add gap between lines * (no. lines - 1).
- return [expr {($n * 12) + (($n - 1) * 7)}]
+ set ret [expr {$n * [font metrics $f -displayof $widget -linespace]}]
+ font delete $f
+ return $ret
}
}
}
@@ -2936,10 +2939,17 @@
#the image aligned-right to the text
set Xcoord [expr {[winfo width $top] - [image width $camicon]}]
- set Ycoord [expr {[lindex [$top coords text] 1] + ([font configure splainf -size]/2) + ([font configure splainf -size]*($nroflines-1))}]
-
+ set font [$top itemcget text -font]
+ if { $font != "" } {
+ set Ycoord [expr {[lindex [$top coords text] 1] + ([font metrics $font -displayof $top -linespace] * ($nroflines-1))}]
+ } else {
+ set f [font create -family helvetica -size 12 -weight normal]
+ set Ycoord [expr {[lindex [$top coords text] 1] + ([font metrics $f -displayof $top -linespace] * ($nroflines-1))}]
+ font delete $f
+
+ }
- $top create image $Xcoord $Ycoord -anchor w -image $camicon -tags [list camicon camicon_$user_login] -state normal
+ $top create image $Xcoord $Ycoord -anchor nw -image $camicon -tags [list camicon camicon_$user_login] -state normal
#If clicked, invite the user to send webcam
$top bind camicon_$user_login <Button-1> "::MSNCAM::AskWebcamQueue $user_login"
@@ -2963,11 +2973,12 @@
#Calculate number of lines, and set top text size
- set size [$top index text end]
-
set ::ChatWindow::titles(${win_name}) ${title}
- $top dchars text [expr {$size - 1}] end
+ # delete the last newline...
+ set last_char [$top index text end]
+ incr last_char -1
+ $top dchars text $last_char end
$top configure -height [expr {[MeasureTextCanvas $top "text" [$top itemcget text -text] "h"] + 2*[::skin::getKey topbarpady]}]
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|