From 360495a3bf0264d238db1caf795304307a93e577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 3 Aug 2009 14:41:27 +0000 Subject: [PATCH] * 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 --- src/kits/interface/TextView.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index 29d60590d6..25a4b315bb 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -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;