Skip to content

Commit

Permalink
Get in there totie
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Feb 22, 2024
1 parent 8852a7f commit b9166b6
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions libs/tote_bag/juce_gui/components/panels/PresetPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@

#include <BinaryData.h>

namespace detail
{
constexpr auto kTotieWidth = 144.22f;
constexpr auto kTotieHeight = 135.51;
constexpr auto kTotieHWRatio = kTotieHeight / kTotieWidth;
}

PresetPanel::PresetPanel (ToteBagPresetManager& pManager,
const juce::String& bypassButtonText,
const juce::String& bypassParameterId,
juce::AudioProcessorValueTreeState& treeState)
: borderThickness (0.0f)
, mInfoButton ("ValentineInfo", juce::DrawableButton::ButtonStyle::ImageFitted)
, mInfoButton ("ValentineInfo", juce::DrawableButton::ButtonStyle::ImageStretched)
, mPreviousPreset ("PreviousPreset",
juce::DrawableButton::ButtonStyle::ImageStretched)
, mNextPreset ("NextPreset", juce::DrawableButton::ButtonStyle::ImageStretched)
Expand Down Expand Up @@ -75,9 +82,10 @@ void PresetPanel::resized()

const auto presetBoundsWidth = presetBounds.getWidth();
const auto presetBoundsHeight = presetBounds.getHeight();
const auto presetBoundsCentreY = presetBounds.getCentreY();

const auto leftInfoButtonGapWidth = juce::roundToInt (presetBoundsWidth * .026f);
const auto infoButtonWidth = juce::roundToInt (presetBoundsWidth * 0.05f);

const auto infoButtonBypassGapWidth = juce::roundToInt (presetBoundsWidth * 0.0027f);
const auto bypassButtonWidth = juce::roundToInt (presetBoundsWidth * .134f);
const auto bypassSaveGapWidth = juce::roundToInt (presetBoundsWidth * .0825f);
Expand All @@ -89,7 +97,15 @@ void PresetPanel::resized()
const auto presetBoxWidth = juce::roundToInt (presetBoundsWidth * .27f);

presetBounds.removeFromLeft (leftInfoButtonGapWidth);
mInfoButton.setBounds (presetBounds.removeFromLeft (infoButtonWidth));

const auto infoButtonWidth = juce::roundToInt (presetBoundsWidth * 0.05f);
const auto infoButtonHeight =
juce::roundToInt (infoButtonWidth * detail::kTotieHWRatio);
const auto infoButtonY = presetBoundsCentreY - infoButtonHeight / 2;
mInfoButton.setBounds (presetBounds.removeFromLeft (infoButtonWidth)
.withY (infoButtonY)
.withHeight (infoButtonHeight));

presetBounds.removeFromLeft (infoButtonBypassGapWidth);
mBypassButton.setBounds (presetBounds.removeFromLeft (bypassButtonWidth));
presetBounds.removeFromLeft (bypassSaveGapWidth);
Expand All @@ -99,7 +115,7 @@ void PresetPanel::resized()
presetBounds.removeFromLeft (loadPrevGapWidth);

const auto prevNextButtonHeight = juce::roundToInt (presetBoundsHeight * .2f);
const auto prevNextButtonY = presetBounds.getCentreY() - prevNextButtonHeight / 2;
const auto prevNextButtonY = presetBoundsCentreY - prevNextButtonHeight / 2;
mPreviousPreset.setBounds (presetBounds.removeFromLeft (prevNextButtonWidth)
.withY (prevNextButtonY)
.withHeight (prevNextButtonHeight));
Expand Down

0 comments on commit b9166b6

Please sign in to comment.