From 04b48a29bd06f7d697ffee3882b645dd0bfd56e4 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 4 Apr 2014 15:02:29 -0400 Subject: [PATCH] LayoutUtils: Style fix, remove leading space --- src/kits/interface/LayoutUtils.cpp | 51 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/src/kits/interface/LayoutUtils.cpp b/src/kits/interface/LayoutUtils.cpp index 67e2bccd9f..e852a9b89f 100644 --- a/src/kits/interface/LayoutUtils.cpp +++ b/src/kits/interface/LayoutUtils.cpp @@ -174,34 +174,29 @@ BLayoutUtils::AlignInFrame(BRect frame, BSize maxSize, BAlignment alignment) void BLayoutUtils::AlignInFrame(BView* view, BRect frame) { - BSize maxSize = view->MaxSize(); - BAlignment alignment = view->LayoutAlignment(); - - if (view->HasHeightForWidth()) { - // The view has height for width, so we do the horizontal alignment - // ourselves and restrict the height max constraint respectively. - - if (maxSize.width < frame.Width() - && alignment.horizontal != B_ALIGN_USE_FULL_WIDTH) { - frame.OffsetBy(floor((frame.Width() - maxSize.width) - * alignment.RelativeHorizontal()), 0); - frame.right = frame.left + maxSize.width; - } - alignment.horizontal = B_ALIGN_USE_FULL_WIDTH; - - float minHeight; - float maxHeight; - float preferredHeight; - view->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight, - &preferredHeight); - - frame.bottom = frame.top + max_c(frame.Height(), minHeight); - maxSize.height = minHeight; - } - - frame = AlignInFrame(frame, maxSize, alignment); - view->MoveTo(frame.LeftTop()); - view->ResizeTo(frame.Size()); + BSize maxSize = view->MaxSize(); + BAlignment alignment = view->LayoutAlignment(); + if (view->HasHeightForWidth()) { + // The view has height for width, so we do the horizontal alignment + // ourselves and restrict the height max constraint respectively. + if (maxSize.width < frame.Width() + && alignment.horizontal != B_ALIGN_USE_FULL_WIDTH) { + frame.OffsetBy(floor((frame.Width() - maxSize.width) + * alignment.RelativeHorizontal()), 0); + frame.right = frame.left + maxSize.width; + } + alignment.horizontal = B_ALIGN_USE_FULL_WIDTH; + float minHeight; + float maxHeight; + float preferredHeight; + view->GetHeightForWidth(frame.Width(), &minHeight, &maxHeight, + &preferredHeight); + frame.bottom = frame.top + max_c(frame.Height(), minHeight); + maxSize.height = minHeight; + } + frame = AlignInFrame(frame, maxSize, alignment); + view->MoveTo(frame.LeftTop()); + view->ResizeTo(frame.Size()); }