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
This commit is contained in:
parent
571cffc10e
commit
b90d36ccd6
@ -13,6 +13,8 @@
|
|||||||
#include "DataTranslationsWindow.h"
|
#include "DataTranslationsWindow.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@ -52,7 +54,7 @@ const uint32 kMsgSelectedTranslator = 'trsl';
|
|||||||
|
|
||||||
DataTranslationsWindow::DataTranslationsWindow()
|
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_TRANSLATE_SYSTEM_NAME("DataTranslations"),
|
||||||
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
|
B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE
|
||||||
| B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS),
|
| 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
|
// force config views to all have the same color
|
||||||
fRightBox->AddChild(fConfigView);
|
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
|
// Make sure the translator's image doesn't get unloaded while we are still
|
||||||
// showing a config view whose code is in the image
|
// showing a config view whose code is in the image
|
||||||
fRelease = roster->AcquireTranslator(id);
|
fRelease = roster->AcquireTranslator(id);
|
||||||
@ -250,11 +257,15 @@ DataTranslationsWindow::_SetupViews()
|
|||||||
BLayoutBuilder::Group<>(this, B_HORIZONTAL)
|
BLayoutBuilder::Group<>(this, B_HORIZONTAL)
|
||||||
.SetInsets(B_USE_WINDOW_SPACING)
|
.SetInsets(B_USE_WINDOW_SPACING)
|
||||||
.Add(scrollView, 3)
|
.Add(scrollView, 3)
|
||||||
.AddGrid(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, 6)
|
.AddGroup(B_VERTICAL)
|
||||||
.SetInsets(0, 0, 0, 0)
|
.Add(fRightBox)
|
||||||
.Add(fRightBox, 0, 0, 3, 1)
|
.AddGroup(B_HORIZONTAL)
|
||||||
.Add(fIconView, 0, 1)
|
.Add(fIconView)
|
||||||
.Add(fButton, 2, 1);
|
.AddGlue()
|
||||||
|
.Add(fButton)
|
||||||
|
.End()
|
||||||
|
.End()
|
||||||
|
.End();
|
||||||
|
|
||||||
fTranslatorListView->MakeFocus();
|
fTranslatorListView->MakeFocus();
|
||||||
_ShowInfoView();
|
_ShowInfoView();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user