Skip to content

Commit

Permalink
WIP got the piping in
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Feb 25, 2024
1 parent d301f2c commit b59f580
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libs/tote_bag/juce_gui/components/panels/InfoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ InfoPanel::~InfoPanel()
void InfoPanel::paint (juce::Graphics& g)
{
g.setColour (colours::plainWhite);
g.fillRect (getBounds());
g.fillRect (getLocalBounds());
}

void InfoPanel::mouseUp (const juce::MouseEvent& e)
Expand Down
4 changes: 4 additions & 0 deletions libs/tote_bag/juce_gui/components/panels/PresetPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ constexpr auto kTotieHWRatio = kTotieHeight / kTotieWidth;
PresetPanel::PresetPanel (ToteBagPresetManager& pManager,
const juce::String& bypassButtonText,
const juce::String& bypassParameterId,
std::function<void()> infoButtonCallback,
juce::AudioProcessorValueTreeState& treeState)
: borderThickness (0.0f)
, mInfoButton ("ValentineInfo", juce::DrawableButton::ButtonStyle::ImageStretched)
Expand All @@ -36,9 +37,12 @@ PresetPanel::PresetPanel (ToteBagPresetManager& pManager,
, mNextPreset ("NextPreset", juce::DrawableButton::ButtonStyle::ImageStretched)
, mBypassButton (bypassButtonText, bypassParameterId, treeState)
, presetManager (pManager)
, minfoButtonCallback (infoButtonCallback)
{
presetManager.setPresetSavedCallback ([this]() { updatePresetDisplay(); });

mInfoButton.onClick = [this]() { minfoButtonCallback(); };

setupValentineInfoButton();
setupBypassButton();
setupSaveAndLoadButtons();
Expand Down
5 changes: 5 additions & 0 deletions libs/tote_bag/juce_gui/components/panels/PresetPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@

#include <juce_gui_basics/juce_gui_basics.h>

#include <memory>

class ToteBagPresetManager;
class PresetPanel : public juce::Component, public juce::Timer
{
public:
PresetPanel (ToteBagPresetManager& pManager,
const juce::String& bypassButtonText,
const juce::String& bypassParameterId,
std::function<void()> infoButtonCallback,
juce::AudioProcessorValueTreeState& treeState);
~PresetPanel() override;

Expand Down Expand Up @@ -61,5 +64,7 @@ class PresetPanel : public juce::Component, public juce::Timer

ToteBagPresetManager& presetManager;

std::function<void()> minfoButtonCallback;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PresetPanel)
};
14 changes: 10 additions & 4 deletions src/gui/panels/ValentineMainPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@
#endif // JUCE_ENABLE_LIVE_CONSTANT_EDITOR

VMainPanel::VMainPanel (ValentineAudioProcessor& processor)
: presetPanel (processor.getPresetManager(),
FFCompParameterLabel()[getParameterIndex (VParameter::bypass)],
tote_bag::valentine::parameterID (VParameter::bypass),
processor.treeState)
: presetPanel (
processor.getPresetManager(),
FFCompParameterLabel()[getParameterIndex (VParameter::bypass)],
tote_bag::valentine::parameterID (VParameter::bypass),
[this]() { infoPanel.setVisible (true); },
processor.treeState)
, inputMeterPanel (ReductionMeterPlacement::Right, &processor.getInputMeterSource())
, outputMeterPanel (ReductionMeterPlacement::Left,
&processor.getOutputMeterSource(),
&processor.getGrMeterSource())
, centerPanel (processor)
, infoPanel ([this]() { infoPanel.setVisible (false); })
{
addAndMakeVisible (presetPanel);
addAndMakeVisible (centerPanel);
addAndMakeVisible (inputMeterPanel);
addAndMakeVisible (outputMeterPanel);
addChildComponent (infoPanel, -1);

setLookAndFeel (&lookAndFeel);
}
Expand All @@ -51,6 +55,8 @@ void VMainPanel::resized()
{
auto panelBounds = getLocalBounds();

infoPanel.setBounds (panelBounds);

const auto presetBounds =
panelBounds.removeFromTop (juce::roundToInt (panelBounds.getHeight() * .11f));
presetPanel.setBounds (presetBounds);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/panels/ValentineMainPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "ValentineCenterPanel.h"

#include "tote_bag/juce_gui/components/panels/InfoPanel.h"
#include "tote_bag/juce_gui/components/panels/PresetPanel.h"
#include "tote_bag/juce_gui/components/panels/VerticalMeterPanel.h"
#include "tote_bag/juce_gui/lookandfeel/LookAndFeel.h"
Expand All @@ -38,4 +39,5 @@ class VMainPanel : public juce::Component
VerticalMeterPanel inputMeterPanel;
VerticalMeterPanel outputMeterPanel;
tote_bag::valentine::CenterPanel centerPanel;
tote_bag::InfoPanel infoPanel;
};

0 comments on commit b59f580

Please sign in to comment.