From 803fab4facf1bb7222728f33d8b820388dacd0ff Mon Sep 17 00:00:00 2001 From: Humdinger Date: Thu, 2 Jan 2014 10:11:00 +0100 Subject: [PATCH] Slightly improved layout of Keymap prefs * use the templated BLayoutBuilder * reduced top inset to be the same as to all sides * SetExplicitMinSize of the LayoutView so it can't shrink to illegibility * set slightly smaller window default size (on small screens) --- src/preferences/keymap/KeymapWindow.cpp | 35 ++++++++++++++----------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/preferences/keymap/KeymapWindow.cpp b/src/preferences/keymap/KeymapWindow.cpp index d43f44804a..1f4f3d4559 100644 --- a/src/preferences/keymap/KeymapWindow.cpp +++ b/src/preferences/keymap/KeymapWindow.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -82,13 +83,12 @@ compare_key_list_items(const void* a, const void* b) KeymapWindow::KeymapWindow() : - BWindow(BRect(80, 50, 880, 380), B_TRANSLATE_SYSTEM_NAME("Keymap"), + BWindow(BRect(80, 50, 650, 300), B_TRANSLATE_SYSTEM_NAME("Keymap"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS) { - SetLayout(new BGroupLayout(B_VERTICAL)); - fKeyboardLayoutView = new KeyboardLayoutView("layout"); fKeyboardLayoutView->SetKeymap(&fCurrentMap); + fKeyboardLayoutView->SetExplicitMinSize(BSize(B_SIZE_UNSET, 192)); fTextControl = new BTextControl(B_TRANSLATE("Sample and clipboard:"), "", NULL); @@ -97,27 +97,32 @@ KeymapWindow::KeymapWindow() new BMessage(kMsgSwitchShortcuts)); // controls pane - AddChild(BGroupLayoutBuilder(B_VERTICAL) + BLayoutBuilder::Group<>(this, B_VERTICAL) .Add(_CreateMenu()) - .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) + .AddGroup(B_HORIZONTAL) + .SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, + B_USE_DEFAULT_SPACING) .Add(_CreateMapLists(), 0.25) - .Add(BGroupLayoutBuilder(B_VERTICAL, 10) + .AddGroup(B_VERTICAL) .Add(fKeyboardLayoutView) - //.Add(new BStringView("text label", "Sample and clipboard:")) - .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) + .AddGroup(B_HORIZONTAL) .Add(_CreateDeadKeyMenuField(), 0.0) .AddGlue() - .Add(fSwitchShortcutsButton)) + .Add(fSwitchShortcutsButton) + .End() .Add(fTextControl) .AddGlue(0.0) - .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) + .AddGroup(B_HORIZONTAL) .Add(fDefaultsButton = new BButton("defaultsButton", B_TRANSLATE("Defaults"), new BMessage(kMsgDefaultKeymap))) .Add(fRevertButton = new BButton("revertButton", B_TRANSLATE("Revert"), new BMessage(kMsgRevertKeymap))) - .AddGlue())) - .SetInsets(10, 10, 10, 10))); + .AddGlue() + .End() + .End() + .End() + .End(); fKeyboardLayoutView->SetTarget(fTextControl->TextView()); fTextControl->MakeFocus(); @@ -554,12 +559,12 @@ KeymapWindow::_CreateMapLists() _SetListViewSize(fSystemListView); _SetListViewSize(fUserListView); - return BGroupLayoutBuilder(B_VERTICAL) + return BLayoutBuilder::Group<>(B_VERTICAL) .Add(new BStringView("system", B_TRANSLATE("System:"))) .Add(systemScroller, 3) .Add(new BStringView("user", B_TRANSLATE("User:"))) .Add(userScroller) - .TopView(); + .View(); } @@ -995,7 +1000,7 @@ KeymapWindow::_LoadSettings(BRect& windowFrame, BString& keyboardLayout) { BScreen screen(this); - windowFrame.Set(-1, -1, 799, 329); + windowFrame.Set(-1, -1, 669, 357); // See if we can use a larger default size if (screen.Frame().Width() > 1200) { windowFrame.right = 899;