From aea4a383fe7279c1a873b9361c0635ca017ae493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 11 Sep 2010 08:55:30 +0000 Subject: [PATCH] * Figure out the layout insets of the slider bar, and use them for the insets of the rest of the layout. Makes sure that the spacing is the same between all controls. * Use the system font size for figuring out the symbol size. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38604 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../interface/TransportControlGroup.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/apps/mediaplayer/interface/TransportControlGroup.cpp b/src/apps/mediaplayer/interface/TransportControlGroup.cpp index f46f4b1a61..d85184f434 100644 --- a/src/apps/mediaplayer/interface/TransportControlGroup.cpp +++ b/src/apps/mediaplayer/interface/TransportControlGroup.cpp @@ -61,7 +61,10 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons, : BGroupView(B_VERTICAL, 0) { - float symbolHeight = 9; + // Pick a symbol size based on the current system font size, but make + // sure the size is uneven, so the pointy shapes have their middle on + // a pixel instead of between two pixels. + float symbolHeight = int(be_plain_font->Size() / 1.33) | 1; BGroupView* seekGroup = new BGroupView(B_HORIZONTAL, 0); BGroupLayout* seekLayout = seekGroup->GroupLayout(); @@ -72,6 +75,15 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons, 0, kPositionFactor); seekLayout->AddView(fSeekSlider); + // Figure out the visual insets of the slider bounds towards the slider + // bar, and use that as insets for the rest of the layout. + float inset = fSeekSlider->BarFrame().left; + float hInset = inset - fSeekSlider->BarFrame().top; + if (hInset < 0.0f) + hInset = 0.0f; + + seekLayout->SetInsets(0, hInset, 0, 0); + fPositionToolTip = new PositionToolTip(); fSeekSlider->SetToolTip(fPositionToolTip); @@ -84,7 +96,7 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons, // Buttons BGroupView* controlGroup = new BGroupView(B_HORIZONTAL, 0); - controlGroup->GroupLayout()->SetInsets(7, 5, 7, 5); + controlGroup->GroupLayout()->SetInsets(inset, hInset, inset, inset); GroupLayout()->AddView(controlGroup); BGroupLayout* controlLayout = controlGroup->GroupLayout();