Skip to content

Commit

Permalink
WIP get the top row in there
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Dec 13, 2023
1 parent 7815b21 commit fa0c1f7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
40 changes: 30 additions & 10 deletions src/gui/panels/ValentineCenterPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,33 @@ namespace valentine
namespace detail
{
inline const juce::String kCrushSliderText = "CRUSH";
inline const juce::String kCompressSliderText = "COMPRESS";
inline const juce::String kSaturateSliderText = "SATURATE";
} // namespace detail

CenterPanel::CenterPanel (ValentineAudioProcessor& processor)
: borderLineThickness (0.0f)
, borderCornerSize (0.0f)
, crushEnableButton (parameterID (VParameter::crushEnable), processor.treeState)
, crushSlider (detail::kCrushSliderText,
parameterID (VParameter::bitCrush),
processor.treeState)
, crushEnableButton (parameterID (VParameter::crushEnable), processor.treeState)
, compressSlider (detail::kCompressSliderText,
parameterID (VParameter::inputGain),
processor.treeState)
, saturateEnableButton (parameterID (VParameter::saturateEnable), processor.treeState)
, saturateSlider (detail::kSaturateSliderText,
parameterID (VParameter::saturation),
processor.treeState)
, valentineLogo (
juce::Drawable::createFromImageData (BinaryData::logo_218x40_svg,
BinaryData::logo_218x40_svgSize))
{
addAndMakeVisible (crushEnableButton);
addAndMakeVisible (crushSlider);
addAndMakeVisible (compressSlider);
addAndMakeVisible (saturateEnableButton);
addAndMakeVisible (saturateSlider);
addAndMakeVisible (valentineLogo.get());
}

Expand Down Expand Up @@ -74,16 +86,24 @@ void CenterPanel::resized()
// Adjust button width to make room
topRowSliderWidth -= topRowButtonWidth;

auto crushButtonBounds = topRowSliders.removeFromLeft (topRowButtonWidth);
auto crushButtonSpacer = juce::roundToInt (
(crushButtonBounds.getHeight() - crushButtonBounds.getWidth()) * .5f);
crushButtonBounds.removeFromTop (crushButtonSpacer);
crushButtonBounds.removeFromBottom (crushButtonSpacer);
// We want the buttons to be centered vertically, and need the button bounds to
// be square;
const auto buttonSpacer =
juce::roundToInt ((topRowSliders.getHeight() - topRowButtonWidth) * .5f);

crushEnableButton.setBounds (crushButtonBounds);

const auto crushSliderBounds = topRowSliders.removeFromLeft (topRowSliderWidth);
crushSlider.setBounds (crushSliderBounds);
auto crushButtonBounds = topRowSliders.removeFromLeft (topRowButtonWidth);
// auto crushButtonSpacer = juce::roundToInt (
// (crushButtonBounds.getHeight() - crushButtonBounds.getWidth()) * .5f);
// crushButtonBounds.removeFromTop (crushButtonSpacer);
// crushButtonBounds.removeFromBottom (crushButtonSpacer);

crushEnableButton.setBounds (crushButtonBounds.reduced (0, buttonSpacer));

crushSlider.setBounds (topRowSliders.removeFromLeft (topRowSliderWidth));
compressSlider.setBounds (topRowSliders.removeFromLeft (topRowSliderWidth));
saturateEnableButton.setBounds (
topRowSliders.removeFromLeft (topRowButtonWidth).reduced (0, buttonSpacer));
saturateSlider.setBounds (topRowSliders.removeFromLeft (topRowSliderWidth));

const auto logoHeight = juce::roundToInt (topRowComponents.getHeight() * .25f);
topRowComponents.removeFromTop (logoHeight * 1.45f);
Expand Down
5 changes: 4 additions & 1 deletion src/gui/panels/ValentineCenterPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ class CenterPanel : public juce::Component
float borderLineThickness;
float borderCornerSize;

LabelSlider crushSlider;
ToggleButton crushEnableButton;
LabelSlider crushSlider;
LabelSlider compressSlider;
ToggleButton saturateEnableButton;
LabelSlider saturateSlider;

std::unique_ptr<juce::Drawable> valentineLogo;

Expand Down

0 comments on commit fa0c1f7

Please sign in to comment.