From f95ad070fb803f2550d88621dfe0d12ac03d61c0 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 27 Jun 2014 23:27:01 -0400 Subject: [PATCH] MidiPlayer: Rework layout #9882 comment:8 suggested applying a similar fix to MidiPlayer as the one to Backgrounds, which makes the menu fields variable width and isn't affected by the check box. In addition this replaces BGroupLayoutBuilder and BGridLayoutBuilder with BLayoutBuilder templates and replaces hardcoded spacing units with B_USE_ spacing constants. I also put the Volume slider on its own line and tightened up the spacing around the scope view. picture: http://31.media.tumblr.com/74d93b806033d9adee83eeb2adead48d/tumblr_n7v06onPdl1r0f0hfo1_250.png --- src/apps/midiplayer/MidiPlayerWindow.cpp | 53 ++++++++++++++---------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/apps/midiplayer/MidiPlayerWindow.cpp b/src/apps/midiplayer/MidiPlayerWindow.cpp index a574be3bcc..ed82038637 100644 --- a/src/apps/midiplayer/MidiPlayerWindow.cpp +++ b/src/apps/midiplayer/MidiPlayerWindow.cpp @@ -25,8 +25,7 @@ #include "MidiPlayerWindow.h" #include -#include -#include +#include #include #include #include @@ -259,33 +258,41 @@ MidiPlayerWindow::CreateViews() BStringView* volumeLabel = new BStringView(NULL, B_TRANSLATE("Volume:")); volumeLabel->SetAlignment(B_ALIGN_LEFT); - volumeLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); // Build the layout - SetLayout(new BGroupLayout(B_HORIZONTAL)); - - AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) + BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_SMALL_SPACING) .Add(fScopeView) - .Add(BGridLayoutBuilder(10, 10) - .Add(BSpaceLayoutItem::CreateGlue(), 0, 0) - .Add(fShowScopeCheckBox, 1, 0) + .AddGroup(B_VERTICAL, B_USE_SMALL_SPACING) + .AddGroup(B_HORIZONTAL, 0.0f) + .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) + .Add(fShowScopeCheckBox, 1, 0) - .Add(fReverbMenuField->CreateLabelLayoutItem(), 0, 1) - .Add(fReverbMenuField->CreateMenuBarLayoutItem(), 1, 1) + .Add(fReverbMenuField->CreateLabelLayoutItem(), 0, 1) + .AddGroup(B_HORIZONTAL, 0.0f, 1, 1) + .Add(fReverbMenuField->CreateMenuBarLayoutItem()) + .AddGlue() + .End() - .Add(fInputMenuField->CreateLabelLayoutItem(), 0, 2) - .Add(fInputMenuField->CreateMenuBarLayoutItem(), 1, 2) + .Add(fInputMenuField->CreateLabelLayoutItem(), 0, 2) + .AddGroup(B_HORIZONTAL, 0.0f, 1, 2) + .Add(fInputMenuField->CreateMenuBarLayoutItem()) + .AddGlue() + .End() - .Add(volumeLabel, 0, 3) - .Add(fVolumeSlider, 1, 3) - ) - .AddGlue() - .Add(divider) - .AddGlue() - .Add(fPlayButton) - .AddGlue() - .SetInsets(5, 5, 5, 5) - ); + .Add(volumeLabel, 0, 3) + .Add(fVolumeSlider, 0, 4, 2, 1) + .End() + .AddGlue() + .End() + .AddGlue() + .Add(divider) + .AddGlue() + .Add(fPlayButton) + .AddGlue() + .SetInsets(B_USE_WINDOW_INSETS) + .End() + .SetInsets(0) + .End(); }