#include "MasterPanel.h" MasterPanel::MasterPanel() { titleLabel.setText ("MASTER", juce::dontSendNotification); titleLabel.setJustificationType (juce::Justification::centredLeft); titleLabel.setColour (juce::Label::textColourId, InstaGrainLookAndFeel::textPrimary); addAndMakeVisible (titleLabel); volumeKnob.setSliderStyle (juce::Slider::RotaryHorizontalVerticalDrag); volumeKnob.setTextBoxStyle (juce::Slider::TextBoxBelow, false, 55, 14); volumeKnob.setRange (0.0, 2.0); volumeKnob.setValue (1.0); volumeKnob.getProperties().set (InstaGrainLookAndFeel::knobTypeProperty, "orange"); addAndMakeVisible (volumeKnob); volLabel.setText ("Volume", juce::dontSendNotification); volLabel.setJustificationType (juce::Justification::centred); volLabel.setColour (juce::Label::textColourId, InstaGrainLookAndFeel::textSecondary); addAndMakeVisible (volLabel); addAndMakeVisible (vuMeter); } void MasterPanel::resized() { auto bounds = getLocalBounds().reduced (4); titleLabel.setBounds (bounds.removeFromTop (20)); int halfW = bounds.getWidth() / 2; // Volume knob auto knobArea = bounds.removeFromLeft (halfW); auto knobRect = knobArea.withTrimmedBottom (16); volumeKnob.setBounds (knobRect.reduced (2)); volLabel.setBounds (knobArea.getX(), knobRect.getBottom() - 2, knobArea.getWidth(), 16); // VU meter vuMeter.setBounds (bounds.reduced (8, 4)); } void MasterPanel::paint (juce::Graphics& g) { auto bounds = getLocalBounds().toFloat(); g.setColour (InstaGrainLookAndFeel::bgMedium.withAlpha (0.5f)); g.fillRoundedRectangle (bounds, 4.0f); g.setColour (InstaGrainLookAndFeel::bgLight.withAlpha (0.3f)); g.drawRoundedRectangle (bounds, 4.0f, 1.0f); }