From b90d36ccd650b99f5010c6637ec8ffe878bb2628 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Thu, 24 Mar 2016 16:01:31 -0700 Subject: [PATCH] DataTranslations: Make window not resize As you scroll through the list of translators keep the window width constant by setting a minimum width. A little too narrow at 8pt, and the window is too wide at 24pt, but at 12pt it is just right. (at least for 1024x768). The window width and height were not chosen arbitrarily, 598px is just about 600px and almost exactly fits the width of our widest translator (PNG translator). The height is 369px which comes from the golden ratio of 1.62:1. The width of the translators are set to exactly match this at 12pt font size. This way you don't get any unexpected window resizing. At other font sizes the window does resize, but, the contents still fit (mostly) nicely. See screenshot for details: http://insightfactory.tumblr.com/image/141980518317 --- .../DataTranslationsWindow.cpp | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/preferences/datatranslations/DataTranslationsWindow.cpp b/src/preferences/datatranslations/DataTranslationsWindow.cpp index bf00221014..0ba3615068 100644 --- a/src/preferences/datatranslations/DataTranslationsWindow.cpp +++ b/src/preferences/datatranslations/DataTranslationsWindow.cpp @@ -13,6 +13,8 @@ #include "DataTranslationsWindow.h" #include + +#include #include #include @@ -52,7 +54,7 @@ const uint32 kMsgSelectedTranslator = 'trsl'; DataTranslationsWindow::DataTranslationsWindow() : - BWindow(BRect(0.0f, 0.0f, 550.0f, 350.0f), + BWindow(BRect(0.0f, 0.0f, 597.0f, 368.0f), B_TRANSLATE_SYSTEM_NAME("DataTranslations"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), @@ -172,6 +174,11 @@ DataTranslationsWindow::_ShowConfigView(int32 id) // force config views to all have the same color fRightBox->AddChild(fConfigView); + // for default 12pt font size: 597 ≈ (0.85 * 12 * 49) + fConfigView->SetExplicitMinSize( + BSize(ceilf(be_control_look->DefaultItemSpacing() * 49) + - fTranslatorListView->Frame().Width(), B_SIZE_UNSET)); + // Make sure the translator's image doesn't get unloaded while we are still // showing a config view whose code is in the image fRelease = roster->AcquireTranslator(id); @@ -250,11 +257,15 @@ DataTranslationsWindow::_SetupViews() BLayoutBuilder::Group<>(this, B_HORIZONTAL) .SetInsets(B_USE_WINDOW_SPACING) .Add(scrollView, 3) - .AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, 6) - .SetInsets(0, 0, 0, 0) - .Add(fRightBox, 0, 0, 3, 1) - .Add(fIconView, 0, 1) - .Add(fButton, 2, 1); + .AddGroup(B_VERTICAL) + .Add(fRightBox) + .AddGroup(B_HORIZONTAL) + .Add(fIconView) + .AddGlue() + .Add(fButton) + .End() + .End() + .End(); fTranslatorListView->MakeFocus(); _ShowInfoView();