Files
InstaDrums/Source/MasterPanel.cpp
hariel1985 20b9fe2674 GUI polish: 3D metal knobs, Rajdhani font, background texture, scaling UI
- Custom Rajdhani font (Regular/Medium/Bold) embedded via BinaryData
- Background carbon fiber noise texture overlay
- 3D metal knobs with radial gradient, rim, highlight, center cap
  - Orange type (ADSR/Master/Pitch/Pan) + Dark/blue type (FX/Filter)
  - Intense glow on value arc (5 layers: outer -> hot center)
  - Intense glow on pointer (4 layers)
  - All thicknesses scale proportionally with knob pixel size
- FX panel: bordered boxes for each section with gradient background
- Pad glow: cyan multi-pass glow on selected pad
- Pad numbers: dark background badge for contrast
- Waveform display: grid lines + center reference line
- VU meter: peak hold indicator + dB scale markers
- Buttons: gradient fill + hover highlight + rounded border
- All fonts and spacing scale proportionally with window size
- Top bar: darker header with gradient
- Double-click resets knobs to default values

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 17:09:04 +01:00

66 sor
2.4 KiB
C++

#include "MasterPanel.h"
#include "LookAndFeel.h"
MasterPanel::MasterPanel()
{
masterTitle.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::textSecondary);
addAndMakeVisible (masterTitle);
setupKnob (volumeSlider, volumeLabel, "Volume", 0.0, 2.0, 1.0, 0.01);
setupKnob (tuneSlider, tuneLabel, "Tune", -12.0, 12.0, 0.0, 0.1);
setupKnob (panSlider, panLabel, "Pan", -1.0, 1.0, 0.0, 0.01);
addAndMakeVisible (vuMeter);
}
void MasterPanel::setupKnob (juce::Slider& s, juce::Label& l, const juce::String& name,
double min, double max, double val, double step)
{
s.setSliderStyle (juce::Slider::RotaryHorizontalVerticalDrag);
s.setTextBoxStyle (juce::Slider::NoTextBox, false, 0, 0);
s.setRange (min, max, step);
s.setValue (val, juce::dontSendNotification);
s.setDoubleClickReturnValue (true, val);
addAndMakeVisible (s);
l.setText (name, juce::dontSendNotification);
l.setColour (juce::Label::textColourId, InstaDrumsLookAndFeel::textSecondary);
l.setJustificationType (juce::Justification::centred);
addAndMakeVisible (l);
}
void MasterPanel::paint (juce::Graphics& g)
{
auto bounds = getLocalBounds().toFloat();
g.setColour (InstaDrumsLookAndFeel::bgMedium.darker (0.2f));
g.fillRoundedRectangle (bounds, 4.0f);
g.setColour (InstaDrumsLookAndFeel::bgLight.withAlpha (0.3f));
g.drawRoundedRectangle (bounds, 4.0f, 1.0f);
}
void MasterPanel::resized()
{
auto area = getLocalBounds().reduced (6);
float scale = (float) getHeight() / 52.0f;
float titleSize = std::max (12.0f, 16.0f * scale);
float labelSize = std::max (9.0f, 12.0f * scale);
int labelH = (int) (labelSize + 4);
masterTitle.setFont (juce::FontOptions (titleSize, juce::Font::bold));
masterTitle.setBounds (area.removeFromLeft ((int) (65 * scale)).reduced (0, 2));
vuMeter.setBounds (area.removeFromRight ((int) (28 * scale)).reduced (0, 2));
area.removeFromRight (4);
int knobW = area.getWidth() / 3;
juce::Slider* sliders[] = { &volumeSlider, &tuneSlider, &panSlider };
juce::Label* labels[] = { &volumeLabel, &tuneLabel, &panLabel };
for (int i = 0; i < 3; ++i)
{
labels[i]->setFont (juce::FontOptions (labelSize));
auto col = area.removeFromLeft (knobW);
labels[i]->setBounds (col.removeFromBottom (labelH));
sliders[i]->setBounds (col);
}
}