From 3a14d2275f0f40e34694e10c4773959993822318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 28 Feb 2006 21:18:24 +0000 Subject: [PATCH] * Fixed various minor font sensitivity issues with larger fonts. * Fixed build on Dano. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16552 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/filetypes/AttributeWindow.cpp | 4 +- src/preferences/filetypes/AttributeWindow.h | 2 + src/preferences/filetypes/ExtensionWindow.cpp | 3 +- .../filetypes/NewFileTypeWindow.cpp | 46 +++++++++---------- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/preferences/filetypes/AttributeWindow.cpp b/src/preferences/filetypes/AttributeWindow.cpp index e6d37266b8..0e74fed3a7 100644 --- a/src/preferences/filetypes/AttributeWindow.cpp +++ b/src/preferences/filetypes/AttributeWindow.cpp @@ -117,7 +117,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType, topView->AddChild(menuField); rect.OffsetBy(0.0f, rect.Height() + 4.0f); - rect.bottom = rect.top + fAttributeControl->Bounds().Height() * 5.0f + 22.0f; + rect.bottom = rect.top + fAttributeControl->Bounds().Height() * 2.0f + 18.0f; BBox* box = new BBox(rect, "", B_FOLLOW_LEFT_RIGHT); topView->AddChild(box); @@ -210,6 +210,8 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType, fAlignmentMenuField->SetAlignment(B_ALIGN_RIGHT); fAlignmentMenuField->ResizeTo(rect.Width(), height); box->AddChild(fAlignmentMenuField); + box->ResizeBy(0.0f, fAlignmentMenuField->Bounds().Height() * 2.0f + + fVisibleCheckBox->Bounds().Height()); fAcceptButton = new BButton(rect, "add", item ? "Done" : "Add", new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); diff --git a/src/preferences/filetypes/AttributeWindow.h b/src/preferences/filetypes/AttributeWindow.h index 025baee714..a986c8c559 100644 --- a/src/preferences/filetypes/AttributeWindow.h +++ b/src/preferences/filetypes/AttributeWindow.h @@ -14,7 +14,9 @@ #include class BButton; +class BCheckBox; class BMenu; +class BMenuField; class BTextControl; class FileTypesWindow; diff --git a/src/preferences/filetypes/ExtensionWindow.cpp b/src/preferences/filetypes/ExtensionWindow.cpp index a90e3386c8..536ad0c7bb 100644 --- a/src/preferences/filetypes/ExtensionWindow.cpp +++ b/src/preferences/filetypes/ExtensionWindow.cpp @@ -90,7 +90,8 @@ ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type, fAcceptButton->Frame().top); topView->AddChild(button); - ResizeTo(labelWidth * 4.0f + 24.0f, fExtensionControl->Bounds().Height() * 2.0f + 30.0f); + ResizeTo(labelWidth * 4.0f + 24.0f, fExtensionControl->Bounds().Height() + + fAcceptButton->Bounds().Height() + 28.0f); SetSizeLimits(button->Bounds().Width() + fAcceptButton->Bounds().Width() + 26.0f, 32767.0f, Frame().Height(), Frame().Height()); diff --git a/src/preferences/filetypes/NewFileTypeWindow.cpp b/src/preferences/filetypes/NewFileTypeWindow.cpp index e084cfbc79..a6216b1d49 100644 --- a/src/preferences/filetypes/NewFileTypeWindow.cpp +++ b/src/preferences/filetypes/NewFileTypeWindow.cpp @@ -36,28 +36,9 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(topView); - rect.InsetBy(8.0f, 8.0f); - fNameControl = new BTextControl(rect, "internal", "Internal Name:", "", - NULL, B_FOLLOW_LEFT_RIGHT); - - float labelWidth = fNameControl->StringWidth(fNameControl->Label()) + 2.0f; - fNameControl->SetModificationMessage(new BMessage(kMsgNameUpdated)); - fNameControl->SetDivider(labelWidth); - fNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); - - // filter out invalid characters that can't be part of a MIME type name - BTextView* textView = fNameControl->TextView(); - const char* disallowedCharacters = "/<>@,;:\"()[]?="; - for (int32 i = 0; disallowedCharacters[i]; i++) { - textView->DisallowChar(disallowedCharacters[i]); - } - - float width, height; - fNameControl->GetPreferredSize(&width, &height); - fNameControl->ResizeTo(rect.Width(), height); - fNameControl->MoveTo(8.0f, 12.0f + fNameControl->Bounds().Height()); - topView->AddChild(fNameControl); + float labelWidth = be_plain_font->StringWidth("Internal Name:") + 2.0f; + rect.InsetBy(8.0f, 6.0f); fSupertypesMenu = new BPopUpMenu("supertypes"); BMenuItem* item; BMessage types; @@ -82,15 +63,33 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren fSupertypesMenu->AddItem(new BMenuItem("Add New Group", new BMessage(kMsgNewSupertypeChosen))); - rect.bottom = rect.top + fNameControl->Bounds().Height() + 2.0f; BMenuField* menuField = new BMenuField(rect, "supertypes", "Group:", fSupertypesMenu); menuField->SetDivider(labelWidth); menuField->SetAlignment(B_ALIGN_RIGHT); + float width, height; menuField->GetPreferredSize(&width, &height); menuField->ResizeTo(rect.Width(), height); topView->AddChild(menuField); + fNameControl = new BTextControl(rect, "internal", "Internal Name:", "", + NULL, B_FOLLOW_LEFT_RIGHT); + fNameControl->SetModificationMessage(new BMessage(kMsgNameUpdated)); + fNameControl->SetDivider(labelWidth); + fNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); + + // filter out invalid characters that can't be part of a MIME type name + BTextView* textView = fNameControl->TextView(); + const char* disallowedCharacters = "/<>@,;:\"()[]?="; + for (int32 i = 0; disallowedCharacters[i]; i++) { + textView->DisallowChar(disallowedCharacters[i]); + } + + fNameControl->GetPreferredSize(&width, &height); + fNameControl->ResizeTo(rect.Width(), height); + fNameControl->MoveTo(8.0f, 12.0f + menuField->Bounds().Height()); + topView->AddChild(fNameControl); + fAddButton = new BButton(rect, "add", "Add Type", new BMessage(kMsgAddType), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fAddButton->ResizeToPreferred(); @@ -106,7 +105,8 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target, const char* curren fAddButton->Frame().top); topView->AddChild(button); - ResizeTo(labelWidth * 4.0f + 24.0f, fNameControl->Bounds().Height() * 3.0f + 34.0f); + ResizeTo(labelWidth * 4.0f + 24.0f, fNameControl->Bounds().Height() + + menuField->Bounds().Height() + fAddButton->Bounds().Height() + 30.0f); SetSizeLimits(button->Bounds().Width() + fAddButton->Bounds().Width() + 26.0f, 32767.0f, Frame().Height(), Frame().Height());