diff --git a/CMakeLists.txt b/CMakeLists.txt index 4625925..1b45370 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,16 +29,50 @@ endif () include(cmake/CmakeRC.cmake) cmrc_add_resource_library(sst-jucegui-resources NAMESPACE sst::jucegui::resources - res/glyphs/step_count.svg + res/glyphs/add-mod.svg + res/glyphs/close.svg + res/glyphs/curve.svg + res/glyphs/down.svg + res/glyphs/edit.svg + res/glyphs/ellipsis-h.svg + res/glyphs/ellipsis-v.svg + res/glyphs/favorite.svg + res/glyphs/forward-backward.svg + res/glyphs/freeze.svg + res/glyphs/left-right.svg + res/glyphs/left.svg + res/glyphs/link.svg + res/glyphs/lock.svg + res/glyphs/memory.svg res/glyphs/metronome.svg - res/glyphs/mute.svg + res/glyphs/midi.svg + res/glyphs/mul-mod.svg + res/glyphs/note-priority.svg + res/glyphs/pan.svg + res/glyphs/pin.svg + res/glyphs/plus-minus.svg + res/glyphs/plus.svg + res/glyphs/polyphony.svg + res/glyphs/portamento.svg + res/glyphs/power.svg + res/glyphs/reverse.svg + res/glyphs/right.svg res/glyphs/routing-post-fader.svg res/glyphs/routing-pre-fader.svg res/glyphs/routing-pre-fx.svg - res/glyphs/heart.svg - res/glyphs/chip.svg - res/glyphs/save-as.svg - ) + res/glyphs/save.svg + res/glyphs/search.svg + res/glyphs/settings.svg + res/glyphs/shortcircuit-logo.svg + res/glyphs/speaker.svg + res/glyphs/step-count.svg + res/glyphs/surge-logo.svg + res/glyphs/tuning.svg + res/glyphs/unpin.svg + res/glyphs/up-down.svg + res/glyphs/up.svg + res/glyphs/volume.svg +) add_library(${PROJECT_NAME} STATIC src/sst/jucegui/components/ComponentBase.cpp diff --git a/examples/component-demo/GlyphDemo.h b/examples/component-demo/GlyphDemo.h index 508a241..d90aa95 100644 --- a/examples/component-demo/GlyphDemo.h +++ b/examples/component-demo/GlyphDemo.h @@ -44,8 +44,8 @@ struct GlyphDemo : public sst::jucegui::components::WindowPanel for (const auto &col : {juce::Colours::white, juce::Colours::orange, juce::Colours::red}) { - for (int i = sst::jucegui::components::GlyphPainter::PAN; - i <= sst::jucegui::components::GlyphPainter::STEREO; ++i) + for (int i = (sst::jucegui::components::GlyphPainter::GlyphType)0; + i <= sst::jucegui::components::GlyphPainter::SHORTCIRCUIT_LOGO; ++i) { sst::jucegui::components::GlyphPainter::paintGlyph( g, r, (sst::jucegui::components::GlyphPainter::GlyphType)i, col); diff --git a/include/sst/jucegui/components/GlyphPainter.h b/include/sst/jucegui/components/GlyphPainter.h index 0cb2f7d..0bfb6db 100644 --- a/include/sst/jucegui/components/GlyphPainter.h +++ b/include/sst/jucegui/components/GlyphPainter.h @@ -53,28 +53,35 @@ struct GlyphPainter : public juce::Component, */ enum GlyphType { - PAN, - VOLUME, - TUNING, - CROSS, - ARROW_L_TO_R, - ARROW_L_TO_R_WITH_MUL, - METRONOME, - JOG_UP, JOG_DOWN, JOG_LEFT, JOG_RIGHT, - BIG_PLUS, + ELLIPSIS_H, + ELLIPSIS_V, - HAMBURGER, + UP_DOWN, + LEFT_RIGHT, + PLUS, + PLUS_MINUS, + + REVERSE, + FORWARD_BACKWARD, + + PAN, + VOLUME, + TUNING, + METRONOME, KEYBOARD, + MODULATION_ADDITIVE, + MODULATION_MULTIPLICATIVE, + STEP_COUNT, - POWER_LIGHT, - POWER_LIGHT_OFF, // a special case of an off power light which isn't the + SMALL_POWER_LIGHT, + SMALL_POWER_LIGHT_OFF, // a special case of an off power light which isn't the // grayed out filled power light // Channel Strip routing icons @@ -82,14 +89,37 @@ struct GlyphPainter : public juce::Component, ROUTING_PRE_FADER, ROUTING_POST_FADER, - MUTE, - HEART, - CHIP, - SAVE_AS, + FAVORITE, + SAVE, + SEARCH, + SETTINGS, + CLOSE, + EDIT, + + LINK, + LOCK, + PIN, + UNPIN, + POWER, + + MEMORY, // a chip-like glyph + MIDI, + + SPEAKER, + PORTAMENTO, + CURVE, + POLYPHONY, + + FREEZE, + NOTE_PRIORITY, MONO, - STEREO // the order doesn't matter but we iterate in the demo so - // lets leave stereo last + STEREO, + + SURGE_LOGO, + SHORTCIRCUIT_LOGO + // the order doesn't matter but we iterate in the demo so + // lets leave shortcircuit logo last } glyph; // The glyph acts like a label so uses hte label color diff --git a/include/sst/jucegui/components/ToggleButton.h b/include/sst/jucegui/components/ToggleButton.h index 31a0a47..b5d02dd 100644 --- a/include/sst/jucegui/components/ToggleButton.h +++ b/include/sst/jucegui/components/ToggleButton.h @@ -68,7 +68,8 @@ struct ToggleButton : DiscreteParamEditor, } void setLabel(const std::string &l) { label = l; } - GlyphPainter::GlyphType type{GlyphPainter::CROSS}, offType{GlyphPainter::BIG_PLUS}; + GlyphPainter::GlyphType type{GlyphPainter::SMALL_POWER_LIGHT}, + offType{GlyphPainter::SMALL_POWER_LIGHT_OFF}; void setGlyph(GlyphPainter::GlyphType gt) { if (drawMode != DrawMode::GLYPH && drawMode != DrawMode::DUAL_GLYPH) diff --git a/res/glyphs/add-mod.svg b/res/glyphs/add-mod.svg new file mode 100644 index 0000000..0f807cb --- /dev/null +++ b/res/glyphs/add-mod.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/chip.svg b/res/glyphs/chip.svg deleted file mode 100644 index 0b4907d..0000000 --- a/res/glyphs/chip.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/res/glyphs/close.svg b/res/glyphs/close.svg new file mode 100644 index 0000000..097d5b2 --- /dev/null +++ b/res/glyphs/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/curve.svg b/res/glyphs/curve.svg new file mode 100644 index 0000000..8885131 --- /dev/null +++ b/res/glyphs/curve.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/down.svg b/res/glyphs/down.svg new file mode 100644 index 0000000..14d98c2 --- /dev/null +++ b/res/glyphs/down.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/edit.svg b/res/glyphs/edit.svg new file mode 100644 index 0000000..404a9a6 --- /dev/null +++ b/res/glyphs/edit.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/ellipsis-h.svg b/res/glyphs/ellipsis-h.svg new file mode 100644 index 0000000..0870781 --- /dev/null +++ b/res/glyphs/ellipsis-h.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/glyphs/ellipsis-v.svg b/res/glyphs/ellipsis-v.svg new file mode 100644 index 0000000..0dbfaf9 --- /dev/null +++ b/res/glyphs/ellipsis-v.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/glyphs/favorite.svg b/res/glyphs/favorite.svg new file mode 100644 index 0000000..7449089 --- /dev/null +++ b/res/glyphs/favorite.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/forward-backward.svg b/res/glyphs/forward-backward.svg new file mode 100644 index 0000000..94817d6 --- /dev/null +++ b/res/glyphs/forward-backward.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/freeze.svg b/res/glyphs/freeze.svg new file mode 100644 index 0000000..6c8075a --- /dev/null +++ b/res/glyphs/freeze.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/heart.svg b/res/glyphs/heart.svg deleted file mode 100644 index f71502b..0000000 --- a/res/glyphs/heart.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/res/glyphs/left-right.svg b/res/glyphs/left-right.svg new file mode 100644 index 0000000..7e585e9 --- /dev/null +++ b/res/glyphs/left-right.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/left.svg b/res/glyphs/left.svg new file mode 100644 index 0000000..b2abdda --- /dev/null +++ b/res/glyphs/left.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/link.svg b/res/glyphs/link.svg new file mode 100644 index 0000000..94447c9 --- /dev/null +++ b/res/glyphs/link.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/lock.svg b/res/glyphs/lock.svg new file mode 100644 index 0000000..f46ea53 --- /dev/null +++ b/res/glyphs/lock.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/memory.svg b/res/glyphs/memory.svg new file mode 100644 index 0000000..c8505a8 --- /dev/null +++ b/res/glyphs/memory.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/midi.svg b/res/glyphs/midi.svg new file mode 100644 index 0000000..f294a46 --- /dev/null +++ b/res/glyphs/midi.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/mul-mod.svg b/res/glyphs/mul-mod.svg new file mode 100644 index 0000000..00f8e35 --- /dev/null +++ b/res/glyphs/mul-mod.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/mute.svg b/res/glyphs/mute.svg deleted file mode 100644 index c4d81eb..0000000 --- a/res/glyphs/mute.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/res/glyphs/note-priority.svg b/res/glyphs/note-priority.svg new file mode 100644 index 0000000..f28c7eb --- /dev/null +++ b/res/glyphs/note-priority.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/glyphs/pan.svg b/res/glyphs/pan.svg new file mode 100644 index 0000000..ce8f047 --- /dev/null +++ b/res/glyphs/pan.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/pin.svg b/res/glyphs/pin.svg new file mode 100644 index 0000000..680f2d7 --- /dev/null +++ b/res/glyphs/pin.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/plus-minus.svg b/res/glyphs/plus-minus.svg new file mode 100644 index 0000000..9f03ff1 --- /dev/null +++ b/res/glyphs/plus-minus.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/plus.svg b/res/glyphs/plus.svg new file mode 100644 index 0000000..6a1670c --- /dev/null +++ b/res/glyphs/plus.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/polyphony.svg b/res/glyphs/polyphony.svg new file mode 100644 index 0000000..eaf1ff9 --- /dev/null +++ b/res/glyphs/polyphony.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/res/glyphs/portamento.svg b/res/glyphs/portamento.svg new file mode 100644 index 0000000..1bc00c6 --- /dev/null +++ b/res/glyphs/portamento.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/power.svg b/res/glyphs/power.svg new file mode 100644 index 0000000..e032d71 --- /dev/null +++ b/res/glyphs/power.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/reverse.svg b/res/glyphs/reverse.svg new file mode 100644 index 0000000..82f80ff --- /dev/null +++ b/res/glyphs/reverse.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/right.svg b/res/glyphs/right.svg new file mode 100644 index 0000000..1f5f95f --- /dev/null +++ b/res/glyphs/right.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/save-as.svg b/res/glyphs/save-as.svg deleted file mode 100644 index da9f520..0000000 --- a/res/glyphs/save-as.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/res/glyphs/save.svg b/res/glyphs/save.svg new file mode 100644 index 0000000..6d9b5c9 --- /dev/null +++ b/res/glyphs/save.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/search.svg b/res/glyphs/search.svg new file mode 100644 index 0000000..2230cec --- /dev/null +++ b/res/glyphs/search.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/settings.svg b/res/glyphs/settings.svg new file mode 100644 index 0000000..12767f8 --- /dev/null +++ b/res/glyphs/settings.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/shortcircuit-logo.svg b/res/glyphs/shortcircuit-logo.svg new file mode 100644 index 0000000..aa5a595 --- /dev/null +++ b/res/glyphs/shortcircuit-logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/speaker.svg b/res/glyphs/speaker.svg new file mode 100644 index 0000000..eb53627 --- /dev/null +++ b/res/glyphs/speaker.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/glyphs/step_count.svg b/res/glyphs/step-count.svg similarity index 100% rename from res/glyphs/step_count.svg rename to res/glyphs/step-count.svg diff --git a/res/glyphs/surge-logo.svg b/res/glyphs/surge-logo.svg new file mode 100644 index 0000000..5210a13 --- /dev/null +++ b/res/glyphs/surge-logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/tuning.svg b/res/glyphs/tuning.svg new file mode 100644 index 0000000..13adb8e --- /dev/null +++ b/res/glyphs/tuning.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/unpin.svg b/res/glyphs/unpin.svg new file mode 100644 index 0000000..c9f1d90 --- /dev/null +++ b/res/glyphs/unpin.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/up-down.svg b/res/glyphs/up-down.svg new file mode 100644 index 0000000..e587a1c --- /dev/null +++ b/res/glyphs/up-down.svg @@ -0,0 +1,4 @@ + + + + diff --git a/res/glyphs/up.svg b/res/glyphs/up.svg new file mode 100644 index 0000000..ccd026d --- /dev/null +++ b/res/glyphs/up.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/glyphs/volume.svg b/res/glyphs/volume.svg new file mode 100644 index 0000000..1ec33d5 --- /dev/null +++ b/res/glyphs/volume.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-envelope.svg b/res/waveform-glyphs/waveform-envelope.svg new file mode 100644 index 0000000..2ab1ec6 --- /dev/null +++ b/res/waveform-glyphs/waveform-envelope.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-formula.svg b/res/waveform-glyphs/waveform-formula.svg new file mode 100644 index 0000000..48179a9 --- /dev/null +++ b/res/waveform-glyphs/waveform-formula.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-mseg.svg b/res/waveform-glyphs/waveform-mseg.svg new file mode 100644 index 0000000..d21229d --- /dev/null +++ b/res/waveform-glyphs/waveform-mseg.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/waveform-glyphs/waveform-noise.svg b/res/waveform-glyphs/waveform-noise.svg new file mode 100644 index 0000000..271d938 --- /dev/null +++ b/res/waveform-glyphs/waveform-noise.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-sandh.svg b/res/waveform-glyphs/waveform-sandh.svg new file mode 100644 index 0000000..91ecd10 --- /dev/null +++ b/res/waveform-glyphs/waveform-sandh.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/res/waveform-glyphs/waveform-saw.svg b/res/waveform-glyphs/waveform-saw.svg new file mode 100644 index 0000000..49c3305 --- /dev/null +++ b/res/waveform-glyphs/waveform-saw.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-sine.svg b/res/waveform-glyphs/waveform-sine.svg new file mode 100644 index 0000000..3d0d256 --- /dev/null +++ b/res/waveform-glyphs/waveform-sine.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-square.svg b/res/waveform-glyphs/waveform-square.svg new file mode 100644 index 0000000..58cc109 --- /dev/null +++ b/res/waveform-glyphs/waveform-square.svg @@ -0,0 +1,3 @@ + + + diff --git a/res/waveform-glyphs/waveform-step-seq.svg b/res/waveform-glyphs/waveform-step-seq.svg new file mode 100644 index 0000000..7c8f1ec --- /dev/null +++ b/res/waveform-glyphs/waveform-step-seq.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/res/waveform-glyphs/waveform-triangle.svg b/res/waveform-glyphs/waveform-triangle.svg new file mode 100644 index 0000000..876ab9d --- /dev/null +++ b/res/waveform-glyphs/waveform-triangle.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/sst/jucegui/components/GlyphPainter.cpp b/src/sst/jucegui/components/GlyphPainter.cpp index 8fd249a..b7a6f3a 100644 --- a/src/sst/jucegui/components/GlyphPainter.cpp +++ b/src/sst/jucegui/components/GlyphPainter.cpp @@ -29,160 +29,6 @@ static juce::Rectangle centeredSquareIn(const juce::Rectangle &into) return into.withSizeKeepingCentre(sz, sz).toFloat(); } -static void paintPanGlyph(juce::Graphics &g, const juce::Rectangle &into) -{ - auto sq = centeredSquareIn(into); - auto h = sq.getHeight() / 4.f; - auto p = juce::Path(); - p.startNewSubPath(sq.getX(), sq.getY() + 3 * h); - p.lineTo(sq.getX() + sq.getWidth(), sq.getY() + h); - p.lineTo(sq.getX() + sq.getWidth(), sq.getY() + 3 * h); - p.lineTo(sq.getX(), sq.getY() + h); - p.closeSubPath(); - g.fillPath(p); -} - -static void paintVolumeGlyph(juce::Graphics &g, const juce::Rectangle &into) -{ - auto sq = centeredSquareIn(into); - auto h = sq.getHeight() / 4.f; - auto p = juce::Path(); - p.startNewSubPath(sq.getX(), sq.getY() + 3 * h); - p.lineTo(sq.getX() + sq.getWidth(), sq.getY() + 3 * h); - p.lineTo(sq.getX() + sq.getWidth(), sq.getY() + h); - p.closeSubPath(); - g.fillPath(p); -} - -static void paintTuningGlyph(juce::Graphics &g, const juce::Rectangle &into) -{ - auto sq = centeredSquareIn(into); - auto h = sq.getHeight() / 4.f; - auto stag = h / 2.0; - auto w = sq.getWidth() / 3.25f; - - auto grd = juce::Graphics::ScopedSaveState(g); - g.addTransform(juce::AffineTransform().translated(sq.getX(), sq.getY())); - - g.drawLine(w, h + stag, w, 3 * h + stag); - g.fillEllipse(w - h, 3 * h, h, h); - g.drawLine(2.5 * w, h - stag, 2.5 * w, 3 * h - stag); - g.fillEllipse(2.5 * w - h, 2 * h, h, h); -} - -static void paintCrossGlyph(juce::Graphics &g, const juce::Rectangle &into) -{ - auto sq = centeredSquareIn(into).reduced(1, 1); - auto h = sq.getHeight(); - - auto grd = juce::Graphics::ScopedSaveState(g); - g.addTransform(juce::AffineTransform().translated(sq.getX(), sq.getY())); - - g.drawLine(0, 0, h, h); - g.drawLine(0, h, h, 0); -} - -static void paintArrowLtoR(juce::Graphics &g, const juce::Rectangle &into, bool includeMul) -{ - auto sq = into.toFloat().reduced(1, 1); - auto cy = sq.getHeight() / 2.f; - auto ah = sq.getHeight() / 6.f; - - auto grd = juce::Graphics::ScopedSaveState(g); - g.addTransform(juce::AffineTransform().translated(sq.getX(), sq.getY())); - - 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 into, - GlyphPainter::GlyphType type) -{ - auto sq = centeredSquareIn(into).reduced(1, 1); - auto h = sq.getHeight(); - - auto x13 = sq.getX() + sq.getWidth() / 3.f; - auto x23 = sq.getX() + 2 * sq.getWidth() / 3.f; - - auto x14 = sq.getX() + sq.getWidth() / 4.f; - auto xct = sq.getX() + 2 * sq.getWidth() / 4.f; - auto x34 = sq.getX() + 3 * sq.getWidth() / 4.f; - - auto y13 = sq.getY() + sq.getHeight() / 3.f; - auto y23 = sq.getY() + 2 * sq.getHeight() / 3.f; - - auto y14 = sq.getY() + sq.getHeight() / 4.f; - auto yct = sq.getY() + 2 * sq.getHeight() / 4.f; - auto y34 = sq.getY() + 3 * sq.getHeight() / 4.f; - - auto p = juce::Path(); - switch (type) - { - case GlyphPainter::JOG_UP: - { - p.startNewSubPath(x14, y23); - p.lineTo(xct, y13); - p.lineTo(x34, y23); - p.closeSubPath(); - } - break; - case GlyphPainter::JOG_DOWN: - { - p.startNewSubPath(x14, y13); - p.lineTo(xct, y23); - p.lineTo(x34, y13); - p.closeSubPath(); - } - break; - case GlyphPainter::JOG_LEFT: - { - p.startNewSubPath(x23, y14); - p.lineTo(x13, yct); - p.lineTo(x23, y34); - p.closeSubPath(); - } - break; - case GlyphPainter::JOG_RIGHT: - { - p.startNewSubPath(x13, y14); - p.lineTo(x23, yct); - p.lineTo(x13, y34); - p.closeSubPath(); - } - break; - default: - // error - { - g.setColour(juce::Colours::red); - g.fillRect(sq); - return; - } - break; - } - g.fillPath(p); -} - -static void paintBigPlusGlyph(juce::Graphics &g, const juce::Rectangle &into) -{ - auto sq = centeredSquareIn(into).reduced(1, 1); - auto h = sq.getHeight(); - - auto grd = juce::Graphics::ScopedSaveState(g); - g.addTransform(juce::AffineTransform().translated(sq.getX(), sq.getY())); - - g.drawLine(0, h * 0.5, h, h * 0.5, 1.5); - g.drawLine(h * 0.5, 0, h * 0.5, h, 1.5); -} - static void paintHamburgerGlyph(juce::Graphics &g, const juce::Rectangle &into) { auto sq = centeredSquareIn(into).reduced(1, 1); @@ -333,76 +179,63 @@ void GlyphPainter::paintGlyph(juce::Graphics &g, const juce::Rectangle &int g.setColour(as); switch (glyph) { - case PAN: - paintPanGlyph(g, into); - return; - - case VOLUME: - paintVolumeGlyph(g, into); - return; - - case TUNING: - paintTuningGlyph(g, into); - return; - - case CROSS: - paintCrossGlyph(g, into); - return; - - case ARROW_L_TO_R: - paintArrowLtoR(g, into, false); - return; - - case ARROW_L_TO_R_WITH_MUL: - paintArrowLtoR(g, into, true); - return; - - case JOG_UP: - case JOG_DOWN: - case JOG_LEFT: - case JOG_RIGHT: - paintJog(g, into, glyph); - return; - - case BIG_PLUS: - paintBigPlusGlyph(g, into); - return; - - case HAMBURGER: - paintHamburgerGlyph(g, into); - return; - - case METRONOME: - paintFromSvg(g, into, "res/glyphs/metronome.svg", 0xFFAFAFAF, 24, 24, as); - return; - - case MUTE: - paintFromSvg(g, into, "res/glyphs/mute.svg", 0xFFAFAFAF, 1400, 1400, as); - return; - - case CHIP: - paintFromSvg(g, into, "res/glyphs/chip.svg", 0xFFAFAFAF, 24, 24, as); - return; - - case HEART: - paintFromSvg(g, into, "res/glyphs/heart.svg", 0xFFAFAFAF, 24, 24, as); - return; - - case SAVE_AS: - paintFromSvg(g, into, "res/glyphs/save-as.svg", 0xFFAFAFAF, 24, 24, as); - return; - - case ROUTING_PRE_FX: - paintFromSvg(g, into, "res/glyphs/routing-pre-fx.svg", 0xFFAFAFAF, 24, 24, as); - return; - case ROUTING_PRE_FADER: - paintFromSvg(g, into, "res/glyphs/routing-pre-fader.svg", 0xFFAFAFAF, 24, 24, as); +#define SVG24(k, s) \ + case k: \ + paintFromSvg(g, into, "res/glyphs/" s ".svg", 0xFFAFAFAF, 24, 24, as); \ return; - case ROUTING_POST_FADER: - paintFromSvg(g, into, "res/glyphs/routing-post-fader.svg", 0xFFAFAFAF, 24, 24, as); - return; + SVG24(METRONOME, "metronome"); + SVG24(PAN, "pan"); + SVG24(VOLUME, "volume"); + SVG24(TUNING, "tuning"); + + SVG24(MODULATION_ADDITIVE, "add-mod"); + SVG24(MODULATION_MULTIPLICATIVE, "mul-mod"); + + SVG24(JOG_DOWN, "down"); + SVG24(JOG_UP, "up"); + SVG24(JOG_LEFT, "left"); + SVG24(JOG_RIGHT, "right"); + SVG24(ROUTING_POST_FADER, "routing-post-fader"); + SVG24(ROUTING_PRE_FADER, "routing-pre-fader"); + SVG24(ROUTING_PRE_FX, "routing-pre-fx"); + SVG24(STEP_COUNT, "step-count"); + SVG24(SAVE, "save"); + SVG24(FAVORITE, "favorite"); + SVG24(MEMORY, "memory"); + + SVG24(SURGE_LOGO, "surge-logo"); + SVG24(SHORTCIRCUIT_LOGO, "shortcircuit-logo"); + SVG24(MIDI, "midi"); + + SVG24(FORWARD_BACKWARD, "forward-backward"); + SVG24(UP_DOWN, "up-down"); + SVG24(LEFT_RIGHT, "left-right"); + SVG24(PLUS_MINUS, "plus-minus"); + SVG24(PLUS, "plus"); + + SVG24(SEARCH, "search"); + SVG24(SETTINGS, "settings"); + + SVG24(LINK, "link"); + SVG24(LOCK, "lock"); + SVG24(PIN, "pin"); + SVG24(UNPIN, "unpin"); + SVG24(POWER, "power"); + + SVG24(SPEAKER, "speaker"); + SVG24(REVERSE, "reverse"); + SVG24(POLYPHONY, "polyphony"); + SVG24(PORTAMENTO, "portamento"); + + SVG24(CLOSE, "close"); + SVG24(CURVE, "curve"); + SVG24(EDIT, "edit"); + SVG24(FREEZE, "freeze"); + SVG24(ELLIPSIS_H, "ellipsis-h"); + SVG24(ELLIPSIS_V, "ellipsis-v"); + SVG24(NOTE_PRIORITY, "note-priority"); case KEYBOARD: paintKeyboardGlyph(g, into); @@ -416,13 +249,9 @@ void GlyphPainter::paintGlyph(juce::Graphics &g, const juce::Rectangle &int paintStereoGlyph(g, into); return; - case STEP_COUNT: - paintFromSvg(g, into, "res/glyphs/step_count.svg", 0xFFAFAFAF, 24, 24, as); - return; - - case POWER_LIGHT: - case POWER_LIGHT_OFF: - paintPowerLight(g, into, glyph == POWER_LIGHT); + case SMALL_POWER_LIGHT: + case SMALL_POWER_LIGHT_OFF: + paintPowerLight(g, into, glyph == SMALL_POWER_LIGHT); return; default: diff --git a/src/sst/jucegui/components/ToggleButton.cpp b/src/sst/jucegui/components/ToggleButton.cpp index f32751a..3ab8300 100644 --- a/src/sst/jucegui/components/ToggleButton.cpp +++ b/src/sst/jucegui/components/ToggleButton.cpp @@ -90,9 +90,9 @@ void ToggleButton::paint(juce::Graphics &g) } auto paintType = type; - if (type == GlyphPainter::POWER_LIGHT && !v && !isHovered) + if (type == GlyphPainter::SMALL_POWER_LIGHT && !v && !isHovered) { - paintType = GlyphPainter::POWER_LIGHT_OFF; + paintType = GlyphPainter::SMALL_POWER_LIGHT_OFF; } GlyphPainter::paintGlyph(g, getLocalBounds(), paintType, col); return;