Skip to content

Commit

Permalink
Refactor output clip buttonwq and slider bounds setting
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Apr 22, 2024
1 parent b1d3ce2 commit 9eb2774
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/gui/panels/ValentineBottomRowPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,27 @@ void BottomRowPanel::resized()
.withX (dividerCentreX)
.withWidth (dividerThickness);

const auto buttonSpacer =
juce::roundToInt ((bounds.getHeight() - clipButtonWidth) * .5f);

const auto buttonNudge = juce::roundToInt (clipButtonWidth / 8.0f);

const auto clipButtonInitialX = bounds.getX();
const auto clipButtonBounds = bounds.removeFromLeft (clipButtonWidth)
.reduced (0, buttonSpacer)
.withX (clipButtonInitialX + buttonNudge);
const auto clipButtonX = clipButtonInitialX + buttonNudge;
const auto clipButtonY = bounds.getCentreY() - clipButtonWidth / 2;

clipEnableButton.setBounds (bounds.removeFromLeft (clipButtonWidth)
.withX (clipButtonX)
.withY (clipButtonY)
.withHeight (clipButtonWidth));

const auto outputSliderArea = bounds.removeFromLeft (sliderWidth);

// We have to do this because the slider will otherwise intercept
// button clips.
const auto outputSliderWidth = sliderWidth - buttonNudge;
const auto outputSliderX = outputSliderArea.getCentreX() - outputSliderWidth / 2;

outputSlider.setBounds (
outputSliderArea.withX (outputSliderX).withWidth (outputSliderWidth));

clipEnableButton.setBounds (clipButtonBounds);
outputSlider.setBounds (bounds.removeFromLeft (sliderWidth).reduced (buttonNudge, 0));
mixSlider.setBounds (bounds.removeFromLeft (sliderWidth));
}

Expand Down

0 comments on commit 9eb2774

Please sign in to comment.