Patch by Philippe Saint-Pierre: Don't use BTextView::LineHeight() when the font

has not yet been set... Thanks a lot!

D'oh, this one made me slap my hand against my forehead!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30101 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-04-10 08:29:05 +00:00
parent da4c99002d
commit 160f5f5e2f
+6 -5
View File
@@ -6,6 +6,7 @@
* Authors:
* Timothy Wayper <[email protected]>
* Stephan Aßmus <[email protected]>
* Philippe Saint-Pierre, [email protected]
*/
#include "CalcView.h"
@@ -656,16 +657,16 @@ CalcView::FrameResized(float width, float height)
fExpressionTextView->MoveTo(frame.LeftTop());
fExpressionTextView->ResizeTo(frame.Width(), frame.Height());
frame.OffsetTo(B_ORIGIN);
float inset = (frame.Height() - fExpressionTextView->LineHeight(0)) / 2;
frame.InsetBy(inset, inset);
fExpressionTextView->SetTextRect(frame);
// configure expression text view font size and color
float sizeDisp = fShowKeypad ? fHeight * kDisplayScaleY : fHeight;
BFont font(be_bold_font);
font.SetSize(sizeDisp * kExpressionFontScaleY);
fExpressionTextView->SetFontAndColor(&font, B_FONT_ALL);
frame.OffsetTo(B_ORIGIN);
float inset = (frame.Height() - fExpressionTextView->LineHeight(0)) / 2;
frame.InsetBy(inset, inset);
fExpressionTextView->SetTextRect(frame);
}