diff --git a/libs/tote_bag/juce_gui/utilities/GraphicsUtilities.cpp b/libs/tote_bag/juce_gui/utilities/GraphicsUtilities.cpp index 51df95ee..3d50374c 100644 --- a/libs/tote_bag/juce_gui/utilities/GraphicsUtilities.cpp +++ b/libs/tote_bag/juce_gui/utilities/GraphicsUtilities.cpp @@ -22,14 +22,13 @@ void drawRoundedRect (juce::Graphics& g, auto h = croppedBounds.getHeight(); auto lineThickness = h * .025f; - auto cornerSize = h * .25f; + auto cornerSize = h * .075f; g.setColour (colour.darker()); g.drawRoundedRectangle (croppedBounds, cornerSize, lineThickness); g.setColour (colour); - juce::Path p; p.addRoundedRectangle (croppedBounds, cornerSize); g.fillPath (p); diff --git a/src/gui/panels/ValentineCenterPanel.cpp b/src/gui/panels/ValentineCenterPanel.cpp index e265af97..510f6b1a 100644 --- a/src/gui/panels/ValentineCenterPanel.cpp +++ b/src/gui/panels/ValentineCenterPanel.cpp @@ -1,13 +1,19 @@ // 2023 Tote Bag Labs #include "ValentineCenterPanel.h" +#include "BinaryData.h" #include "PluginProcessor.h" +#include "tote_bag/juce_gui/lookandfeel/LookAndFeelConstants.h" +#include "tote_bag/juce_gui/utilities/GraphicsUtilities.h" + namespace tote_bag { namespace valentine { CenterPanel::CenterPanel (ValentineAudioProcessor& processor) + : borderLineThickness (0.0f) + , borderCornerSize (0.0f) { } @@ -15,12 +21,48 @@ CenterPanel::~CenterPanel() { } -void CenterPanel::paint (juce::Graphics&) +void CenterPanel::paint (juce::Graphics& g) { + g.setColour (juce::Colours::black); + + g.drawRoundedRectangle (topRowBorder.toFloat(), + borderCornerSize, + borderLineThickness); + + g.drawRoundedRectangle (bottomRowBorder.toFloat(), + borderCornerSize, + borderLineThickness); + + g.fillRect (bottomRowDivider); } void CenterPanel::resized() { + auto localBounds = getLocalBounds(); + const auto margin = juce::roundToInt (localBounds.getHeight() * .025f); + + const auto topRowHeight = localBounds.getHeight() * .55f; + const auto topRowWidth = localBounds.getWidth(); + + auto topRowBounds = localBounds.removeFromTop (juce::roundToInt (topRowHeight)); + topRowBorder = topRowBounds.reduced (margin); + + const auto topRowBorderHeight = topRowBorder.getHeight(); + borderLineThickness = topRowBorderHeight * .01f; + borderCornerSize = topRowBorderHeight * .060f; + + localBounds.removeFromTop (margin); + bottomRowBorder = localBounds.reduced (margin); + + const auto bottomRowBorderWidth = bottomRowBorder.getWidth(); + const auto bottomRowBorderY = bottomRowBorder.getY(); + const auto bottomRowBorderHeight = bottomRowBorder.getHeight(); + bottomRowDivider = + juce::Rectangle (juce::roundToInt (bottomRowBorderWidth * .6f), + bottomRowBorderY, + juce::roundToInt (borderLineThickness), + bottomRowBorderHeight) + .reduced (0, bottomRowBorderHeight * .1f); } } // namespace tote_bag } // namespace valentine diff --git a/src/gui/panels/ValentineCenterPanel.h b/src/gui/panels/ValentineCenterPanel.h index 3010c06d..c9f50cf0 100644 --- a/src/gui/panels/ValentineCenterPanel.h +++ b/src/gui/panels/ValentineCenterPanel.h @@ -16,10 +16,17 @@ class CenterPanel : public juce::Component CenterPanel (ValentineAudioProcessor& processor); ~CenterPanel() override; - void paint (juce::Graphics&) override; + void paint (juce::Graphics& g) override; void resized() override; private: + juce::Rectangle topRowBorder; + juce::Rectangle bottomRowBorder; + juce::Rectangle bottomRowDivider; + + float borderLineThickness; + float borderCornerSize; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CenterPanel) }; } // namespace valentine diff --git a/src/gui/panels/ValentineMainPanel.cpp b/src/gui/panels/ValentineMainPanel.cpp index d9dbe18c..43574a2c 100644 --- a/src/gui/panels/ValentineMainPanel.cpp +++ b/src/gui/panels/ValentineMainPanel.cpp @@ -19,15 +19,15 @@ VMainPanel::VMainPanel (ValentineAudioProcessor& processor) FFCompParameterLabel()[getParameterIndex (VParameter::bypass)], FFCompParameterID()[getParameterIndex (VParameter::bypass)], processor.treeState) - , inputMeterPanel (ReductionMeterPlacement::Right, - &processor.getInputMeterSource()) + , inputMeterPanel (ReductionMeterPlacement::Right, &processor.getInputMeterSource()) , outputMeterPanel (ReductionMeterPlacement::Left, &processor.getOutputMeterSource(), &processor.getGrMeterSource()) , centerPanel (processor) + , newCenterPanel (processor) { addAndMakeVisible (presetPanel); - addAndMakeVisible (centerPanel); + addAndMakeVisible (newCenterPanel); addAndMakeVisible (inputMeterPanel); addAndMakeVisible (outputMeterPanel); @@ -48,7 +48,8 @@ void VMainPanel::resized() { auto panelBounds = getLocalBounds(); - const auto presetBounds = panelBounds.removeFromTop (juce::roundToInt (panelBounds.getHeight() * .075f)); + const auto presetBounds = + panelBounds.removeFromTop (juce::roundToInt (panelBounds.getHeight() * .075f)); presetPanel.setBounds (presetBounds); const auto resizerMargin = juce::roundToInt (panelBounds.getHeight() * .03f); @@ -66,5 +67,5 @@ void VMainPanel::resized() inputMeterPanel.setBounds (inMeterBounds); outputMeterPanel.setBounds (outMeterBounds); - centerPanel.setBounds (panelBounds); + newCenterPanel.setBounds (panelBounds); } diff --git a/src/gui/panels/ValentineMainPanel.h b/src/gui/panels/ValentineMainPanel.h index ef5bad53..7787da5a 100644 --- a/src/gui/panels/ValentineMainPanel.h +++ b/src/gui/panels/ValentineMainPanel.h @@ -39,4 +39,5 @@ class VMainPanel : public juce::Component VerticalMeterPanel inputMeterPanel; VerticalMeterPanel outputMeterPanel; CenterPanel centerPanel; + tote_bag::valentine::CenterPanel newCenterPanel; };