Round 1 findings and fixes, all previously uncommitted: - FXProcessor per-slot DSP history repair (HEAD does not compile without it) - SynthVoice::getModulationValue, editor control-lock guard - ExactCompare.h naming the deliberate exact float comparisons - KnobLookAndFeel replacing the never-installed SerumLookAndFeel - 55 first-party compiler warnings to 0 - AGENT.md renamed to AGENTS.md across Source/ - graft repository context graph and its hooks - JANITOR_TASKS.md and UI_UX_AUDIT.md records
48 lines
1.9 KiB
C++
48 lines
1.9 KiB
C++
#include "KnobLookAndFeel.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
void KnobLookAndFeel::drawRotarySlider (juce::Graphics& g, int x, int y, int width, int height,
|
|
float sliderPos, float rotaryStartAngle, float rotaryEndAngle,
|
|
juce::Slider& slider)
|
|
{
|
|
const auto dial = juce::Rectangle<float> ((float) x, (float) y, (float) width, (float) height);
|
|
if (dial.isEmpty())
|
|
return;
|
|
|
|
const float radius = juce::jmin (dial.getWidth(), dial.getHeight()) * 0.5f - 2.0f;
|
|
if (radius <= 1.0f)
|
|
return;
|
|
|
|
const float lineW = juce::jlimit (1.5f, 5.0f, radius * 0.22f);
|
|
const float arcR = radius - lineW * 0.5f;
|
|
const float centreX = dial.getCentreX();
|
|
const float centreY = dial.getCentreY();
|
|
const float toAngle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
|
|
const bool live = slider.isEnabled();
|
|
|
|
juce::Path track;
|
|
track.addCentredArc (centreX, centreY, arcR, arcR, 0.0f, rotaryStartAngle, rotaryEndAngle, true);
|
|
g.setColour (theme::outline);
|
|
g.strokePath (track, juce::PathStrokeType (lineW, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
|
|
|
|
if (live)
|
|
{
|
|
juce::Path value;
|
|
value.addCentredArc (centreX, centreY, arcR, arcR, 0.0f, rotaryStartAngle, toAngle, true);
|
|
g.setColour (theme::accent.withAlpha (slider.isMouseOverOrDragging() ? 1.0f : 0.75f));
|
|
g.strokePath (value, juce::PathStrokeType (lineW, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
|
|
}
|
|
|
|
const float pointer = radius * 0.62f;
|
|
g.setColour (live ? theme::text : theme::textDim);
|
|
g.drawLine (centreX + std::sin (toAngle) * pointer * 0.35f,
|
|
centreY - std::cos (toAngle) * pointer * 0.35f,
|
|
centreX + std::sin (toAngle) * pointer,
|
|
centreY - std::cos (toAngle) * pointer,
|
|
juce::jmax (1.5f, lineW * 0.5f));
|
|
}
|
|
|
|
} // namespace serum
|