From e50d7582053d16c47fc2bd60bd58f8d168a160a0 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Sun, 22 May 2011 19:50:38 +0000 Subject: [PATCH] Fix layout problems in Filetypes that became apparent with the introduction of CollapsingLayouter. +alpha git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41662 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/filetypes/AttributeWindow.cpp | 9 ++++---- src/preferences/filetypes/FileTypesWindow.cpp | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/preferences/filetypes/AttributeWindow.cpp b/src/preferences/filetypes/AttributeWindow.cpp index 83e6ba672c..645ca3fb20 100644 --- a/src/preferences/filetypes/AttributeWindow.cpp +++ b/src/preferences/filetypes/AttributeWindow.cpp @@ -243,18 +243,17 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType, BLayoutBuilder::Grid<>(padding, padding / 2) .Add(fDisplayAsMenuField->CreateLabelLayoutItem(), 0, 0) .Add(fDisplayAsMenuField->CreateMenuBarLayoutItem(), 1, 0) - .Add(fEditableCheckBox, 3, 0) + .Add(fEditableCheckBox, 2, 0) .Add(fSpecialControl->CreateLabelLayoutItem(), 0, 1) - .Add(fSpecialControl->CreateTextViewLayoutItem(), 1, 1, 3) + .Add(fSpecialControl->CreateTextViewLayoutItem(), 1, 1, 2) .Add(fWidthControl->CreateLabelLayoutItem(), 0, 2) - .Add(fWidthControl->CreateTextViewLayoutItem(), 1, 2, 3) + .Add(fWidthControl->CreateTextViewLayoutItem(), 1, 2, 2) .Add(fAlignmentMenuField->CreateLabelLayoutItem(), 0, 3) - .Add(fAlignmentMenuField->CreateMenuBarLayoutItem(), 1, 3, 3) + .Add(fAlignmentMenuField->CreateMenuBarLayoutItem(), 1, 3, 2) .SetInsets(padding, padding, padding, padding) .View()) ) .AddGroup(B_HORIZONTAL, padding) - .Add(BSpaceLayoutItem::CreateGlue()) .Add(BSpaceLayoutItem::CreateGlue()) .Add(cancelButton) .Add(fAcceptButton); diff --git a/src/preferences/filetypes/FileTypesWindow.cpp b/src/preferences/filetypes/FileTypesWindow.cpp index 6812baa6f2..b8f0364d9e 100644 --- a/src/preferences/filetypes/FileTypesWindow.cpp +++ b/src/preferences/filetypes/FileTypesWindow.cpp @@ -116,6 +116,8 @@ class ExtensionListView : public DropTargetListView { uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); virtual ~ExtensionListView(); + virtual BSize MinSize(); + virtual void MessageReceived(BMessage* message); virtual bool AcceptsDrag(const BMessage* message); @@ -123,6 +125,7 @@ class ExtensionListView : public DropTargetListView { private: BMimeType fType; + BSize fMinSize; }; @@ -247,6 +250,23 @@ ExtensionListView::~ExtensionListView() } +BSize +ExtensionListView::MinSize() +{ + if (!fMinSize.IsWidthSet() || fMinSize.IsHeightSet()) { + BFont font; + GetFont(&font); + fMinSize.width = font.StringWidth(".mmmmm"); + + font_height height; + font.GetHeight(&height); + fMinSize.height = (height.ascent + height.descent + height.leading) * 3; + } + + return fMinSize; +} + + void ExtensionListView::MessageReceived(BMessage* message) { @@ -432,7 +452,6 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings) .Add(fRuleControl, 0, 4, 3, 1) .SetInsets(padding, padding, padding, padding); - recognitionBoxGrid->SetExplicitAlignment(fullAlignment); fRecognitionBox->AddChild(recognitionBoxGrid); // "Description" group