Skip to content

Commit

Permalink
Add an Arrow L2R with Mul for mod matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Jun 6, 2024
1 parent e5d97c4 commit 07d885a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion include/sst/jucegui/components/GlyphPainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct GlyphPainter : public juce::Component,
TUNING,
CROSS,
ARROW_L_TO_R,
ARROW_L_TO_R_WITH_MUL,
METRONOME,

JOG_UP,
Expand All @@ -75,7 +76,7 @@ struct GlyphPainter : public juce::Component,
POWER_LIGHT,

MUTE,

MONO,
STEREO // the order doesn't matter but we iterate in the demo so
// lets leave stereo last
Expand Down
18 changes: 15 additions & 3 deletions src/sst/jucegui/components/GlyphPainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void paintCrossGlyph(juce::Graphics &g, const juce::Rectangle<int> &into)
g.drawLine(0, h, h, 0);
}

static void paintArrowLtoR(juce::Graphics &g, const juce::Rectangle<int> &into)
static void paintArrowLtoR(juce::Graphics &g, const juce::Rectangle<int> &into, bool includeMul)
{
auto sq = into.toFloat().reduced(1, 1);
auto cy = sq.getHeight() / 2.f;
Expand All @@ -91,9 +91,17 @@ static void paintArrowLtoR(juce::Graphics &g, const juce::Rectangle<int> &into)
auto grd = juce::Graphics::ScopedSaveState(g);
g.addTransform(juce::AffineTransform().translated(sq.getX(), sq.getY()));

g.drawLine(0, cy, sq.getWidth(), cy);
auto wPad = sq.getWidth() * 0.4;

g.drawLine(includeMul ? wPad : 0, cy, sq.getWidth(), cy);
g.drawLine(sq.getWidth(), cy, sq.getWidth() - ah, cy - ah);
g.drawLine(sq.getWidth(), cy, sq.getWidth() - ah, cy + ah);

if (includeMul)
{
g.drawLine(0, cy - wPad * 0.5, wPad, cy + wPad * 0.5);
g.drawLine(0, cy + wPad * 0.5, wPad, cy - wPad * 0.5);
}
}

static void paintJog(juce::Graphics &g, const juce::Rectangle<int> into,
Expand Down Expand Up @@ -335,7 +343,11 @@ void GlyphPainter::paintGlyph(juce::Graphics &g, const juce::Rectangle<int> &int
return;

case ARROW_L_TO_R:
paintArrowLtoR(g, into);
paintArrowLtoR(g, into, false);
return;

case ARROW_L_TO_R_WITH_MUL:
paintArrowLtoR(g, into, true);
return;

case JOG_UP:
Expand Down

0 comments on commit 07d885a

Please sign in to comment.