* Only use the new preferred computation method if word wrap is disabled, or

else this won't work as is (this is something that could be done, better,
  though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32077 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-08-03 14:41:27 +00:00
parent 56c6c0fefb
commit 360495a3bf

View File

@ -2799,17 +2799,22 @@ BTextView::_ValidateLayoutData()
// compute our preferred size
fLayoutData->preferred.height = fTextRect.Height()
+ fLayoutData->topInset + fLayoutData->bottomInset;
float maxWidth = 0;
for (int i = 0; i < fLines->NumLines(); i++) {
float width = LineWidth(0);
if (maxWidth < width)
maxWidth = width;
}
if (maxWidth < min.width)
maxWidth = min.width;
fLayoutData->preferred.width
= maxWidth + fLayoutData->leftInset + fLayoutData->rightInset;
if (fWrap)
fLayoutData->preferred.width = min.width + 5 * lineHeight;
else {
float maxWidth = 0;
for (int i = 0; i < fLines->NumLines(); i++) {
float width = LineWidth(0);
if (maxWidth < width)
maxWidth = width;
}
if (maxWidth < min.width)
maxWidth = min.width;
fLayoutData->preferred.width
= maxWidth + fLayoutData->leftInset + fLayoutData->rightInset;
}
fLayoutData->valid = true;