From 5a7124cc80b2061292bc399b8e9802ff2a281251 Mon Sep 17 00:00:00 2001 From: James Ball Date: Fri, 28 Jul 2023 21:10:21 +0100 Subject: [PATCH] Massively overhaul the entire interface colours to make it look similar to legacy osci-render --- Source/EffectsComponent.cpp | 2 +- Source/LookAndFeel.cpp | 154 +++++++++++++++++++++ Source/LookAndFeel.h | 46 ++++++ Source/LuaComponent.cpp | 2 +- Source/MainComponent.cpp | 10 +- Source/MainComponent.h | 1 + Source/ObjComponent.cpp | 2 +- Source/PluginEditor.cpp | 32 ++++- Source/PluginEditor.h | 3 + Source/PluginProcessor.cpp | 3 +- Source/components/EffectComponent.cpp | 7 +- Source/components/EffectComponent.h | 29 ---- Source/components/EffectsListComponent.cpp | 2 +- Source/components/VisualiserComponent.cpp | 1 + Source/components/VolumeComponent.cpp | 3 +- Source/components/VolumeComponent.h | 9 +- osci-render.jucer | 2 + 17 files changed, 260 insertions(+), 48 deletions(-) create mode 100644 Source/LookAndFeel.cpp create mode 100644 Source/LookAndFeel.h diff --git a/Source/EffectsComponent.cpp b/Source/EffectsComponent.cpp index 69fca90..dc3aa31 100644 --- a/Source/EffectsComponent.cpp +++ b/Source/EffectsComponent.cpp @@ -39,7 +39,7 @@ EffectsComponent::~EffectsComponent() { } void EffectsComponent::resized() { - auto area = getLocalBounds().reduced(20); + auto area = getLocalBounds().withTrimmedTop(20).reduced(20); frequency.setBounds(area.removeFromTop(30)); area.removeFromTop(6); diff --git a/Source/LookAndFeel.cpp b/Source/LookAndFeel.cpp new file mode 100644 index 0000000..14fa660 --- /dev/null +++ b/Source/LookAndFeel.cpp @@ -0,0 +1,154 @@ +#include "LookAndFeel.h" + +OscirenderLookAndFeel::OscirenderLookAndFeel() { + setColour(juce::Slider::thumbColourId, Colours::veryDark); + setColour(juce::Slider::textBoxOutlineColourId, juce::Colours::white); + setColour(juce::Slider::textBoxBackgroundColourId, Colours::veryDark); + setColour(juce::Slider::textBoxHighlightColourId, Colours::accentColor.withMultipliedAlpha(0.5)); + setColour(juce::Slider::trackColourId, juce::Colours::grey); + setColour(juce::Slider::backgroundColourId, Colours::dark); + setColour(sliderThumbOutlineColourId, juce::Colours::white); + setColour(juce::ToggleButton::tickDisabledColourId, juce::Colours::white); + setColour(juce::ResizableWindow::backgroundColourId, Colours::dark); + setColour(groupComponentBackgroundColourId, Colours::darker); + setColour(groupComponentHeaderColourId, Colours::veryDark); + setColour(juce::PopupMenu::backgroundColourId, Colours::veryDark); + setColour(juce::PopupMenu::highlightedBackgroundColourId, Colours::darker); + setColour(juce::ComboBox::backgroundColourId, Colours::veryDark); + setColour(juce::ComboBox::outlineColourId, juce::Colours::white); + setColour(juce::ComboBox::arrowColourId, juce::Colours::white); + setColour(juce::TextButton::buttonColourId, Colours::veryDark); + setColour(juce::TextEditor::backgroundColourId, Colours::veryDark); + setColour(juce::TextEditor::outlineColourId, juce::Colours::white); + setColour(juce::ListBox::backgroundColourId, Colours::darker); + setColour(juce::ScrollBar::thumbColourId, juce::Colours::white); + setColour(juce::ScrollBar::trackColourId, Colours::veryDark); + setColour(juce::ScrollBar::backgroundColourId, Colours::veryDark); + setColour(effectComponentBackgroundColourId, juce::Colours::transparentBlack); + setColour(effectComponentHandleColourId, Colours::veryDark); + getCurrentColourScheme().setUIColour(ColourScheme::widgetBackground, Colours::veryDark); +} + +void OscirenderLookAndFeel::drawComboBox(juce::Graphics& g, int width, int height, bool, int, int, int, int, juce::ComboBox& box) { + juce::Rectangle boxBounds{0, 0, width, height}; + + g.setColour(box.findColour(juce::ComboBox::backgroundColourId)); + g.fillRect(boxBounds.toFloat()); + + g.setColour(box.findColour(juce::ComboBox::outlineColourId)); + g.drawRect(boxBounds.toFloat().reduced(0.5f, 0.5f), 1.0f); + + juce::Rectangle arrowZone{width - 15, 0, 10, height}; + juce::Path path; + path.startNewSubPath((float)arrowZone.getX(), (float)arrowZone.getCentreY() - 3.0f); + path.lineTo((float)arrowZone.getCentreX(), (float)arrowZone.getCentreY() + 4.0f); + path.lineTo((float)arrowZone.getRight(), (float)arrowZone.getCentreY() - 3.0f); + path.closeSubPath(); + + g.setColour(box.findColour(juce::ComboBox::arrowColourId).withAlpha((box.isEnabled() ? 0.9f : 0.2f))); + g.fillPath(path); +} + +void OscirenderLookAndFeel::positionComboBoxText(juce::ComboBox& box, juce::Label& label) { + label.setBounds(1, 1, box.getWidth() - 15, box.getHeight() - 2); + label.setFont(getComboBoxFont(box)); +} + +void OscirenderLookAndFeel::drawTickBox(juce::Graphics& g, juce::Component& component, + float x, float y, float w, float h, + const bool ticked, + const bool isEnabled, + const bool shouldDrawButtonAsHighlighted, + const bool shouldDrawButtonAsDown) { + juce::Rectangle tickBounds(x, y, w, h); + + g.setColour(component.findColour(juce::TextButton::buttonColourId)); + g.fillRect(tickBounds); + g.setColour(component.findColour(juce::ToggleButton::tickDisabledColourId)); + g.drawRect(tickBounds, 1.0f); + + if (ticked) { + g.setColour(component.findColour(juce::ToggleButton::tickColourId)); + auto tick = getTickShape(0.75f); + g.fillPath(tick, tick.getTransformToScaleToFit(tickBounds.reduced(4, 5).toFloat(), false)); + } +} + +void OscirenderLookAndFeel::drawGroupComponentOutline(juce::Graphics& g, int width, int height, const juce::String& text, const juce::Justification& position, juce::GroupComponent& group) { + auto bounds = group.getLocalBounds(); + + const float textH = 15.0f; + const float indent = 3.0f; + const float textEdgeGap = 4.0f; + auto cs = 5.0f; + + juce::Font f(textH); + + juce::Path p; + auto x = indent; + auto y = f.getAscent() - 3.0f; + auto w = juce::jmax(0.0f, (float)width - x * 2.0f); + auto h = juce::jmax(0.0f, (float)height - y - indent); + cs = juce::jmin(cs, w * 0.5f, h * 0.5f); + auto cs2 = 2.0f * cs; + + auto textW = text.isEmpty() ? 0 + : juce::jlimit(0.0f, + juce::jmax(0.0f, w - cs2 - textEdgeGap * 2), + (float)f.getStringWidth(text) + textEdgeGap * 2.0f); + auto textX = cs + textEdgeGap; + + if (position.testFlags(juce::Justification::horizontallyCentred)) + textX = cs + (w - cs2 - textW) * 0.5f; + else if (position.testFlags(juce::Justification::right)) + textX = w - cs - textW - textEdgeGap; + + auto alpha = group.isEnabled() ? 1.0f : 0.5f; + + g.setColour(group.findColour(groupComponentBackgroundColourId).withMultipliedAlpha(alpha)); + g.fillRect(bounds); + + auto header = bounds.removeFromTop(2 * textH); + + g.setColour(group.findColour(groupComponentHeaderColourId).withMultipliedAlpha(alpha)); + g.fillRect(header); + + g.setColour(group.findColour(juce::GroupComponent::textColourId).withMultipliedAlpha(alpha)); + g.setFont(f); + g.drawText(text, + juce::roundToInt(header.getX() + x + textX), header.getY() + 7, + juce::roundToInt(textW), + juce::roundToInt(textH), + juce::Justification::centred, true + ); +} + +void OscirenderLookAndFeel::drawLinearSlider(juce::Graphics& g, int x, int y, int width, int height, float sliderPos, float minSliderPos, float maxSliderPos, const juce::Slider::SliderStyle style, juce::Slider& slider) { + juce::LookAndFeel_V4::drawLinearSlider(g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider); + + auto kx = slider.isHorizontal() ? sliderPos : ((float)x + (float)width * 0.5f); + auto ky = slider.isHorizontal() ? ((float)y + (float)height * 0.5f) : sliderPos; + + juce::Point point = { kx, ky }; + + auto thumbWidth = getSliderThumbRadius(slider); + + g.setColour(slider.findColour(sliderThumbOutlineColourId)); + g.drawEllipse(juce::Rectangle(static_cast(thumbWidth), static_cast(thumbWidth)).withCentre(point), 1.0f); +} + +void OscirenderLookAndFeel::drawButtonBackground(juce::Graphics& g, juce::Button& button, const juce::Colour& backgroundColour, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) { + auto bounds = button.getLocalBounds().toFloat().reduced(0.5f, 0.5f); + + auto baseColour = backgroundColour.withMultipliedSaturation(button.hasKeyboardFocus(true) ? 1.3f : 0.9f) + .withMultipliedAlpha(button.isEnabled() ? 1.0f : 0.5f); + + if (shouldDrawButtonAsDown || shouldDrawButtonAsHighlighted) + baseColour = baseColour.contrasting(shouldDrawButtonAsDown ? 0.2f : 0.05f); + + g.setColour(baseColour); + g.fillRect(bounds); + + g.setColour(button.findColour(juce::ComboBox::outlineColourId)); + g.drawRect(bounds, 1.0f); +} \ No newline at end of file diff --git a/Source/LookAndFeel.h b/Source/LookAndFeel.h new file mode 100644 index 0000000..f29f4a2 --- /dev/null +++ b/Source/LookAndFeel.h @@ -0,0 +1,46 @@ +#pragma once + +#include + +enum ColourIds { + groupComponentBackgroundColourId, + groupComponentHeaderColourId, + effectComponentBackgroundColourId, + effectComponentHandleColourId, + sliderThumbOutlineColourId, +}; + +namespace Colours { + const juce::Colour dark{0xff424242}; + const juce::Colour darker{0xff212121}; + const juce::Colour veryDark{0xff111111}; + const juce::Colour grey{0xff555555}; + const juce::Colour accentColor{0xff00CC00}; +} + +class OscirenderLookAndFeel : public juce::LookAndFeel_V4 { +public: + OscirenderLookAndFeel(); + + void drawComboBox(juce::Graphics& g, int width, int height, bool, int, int, int, int, juce::ComboBox& box) override; + void positionComboBoxText(juce::ComboBox& box, juce::Label& label) override; + void drawTickBox(juce::Graphics& g, juce::Component& component, + float x, float y, float w, float h, + const bool ticked, + const bool isEnabled, + const bool shouldDrawButtonAsHighlighted, + const bool shouldDrawButtonAsDown) override; + void drawGroupComponentOutline(juce::Graphics&, int w, int h, const juce::String &text, const juce::Justification&, juce::GroupComponent&) override; + void drawLinearSlider(juce::Graphics& g, int x, int y, int width, int height, + float sliderPos, + float minSliderPos, + float maxSliderPos, + const juce::Slider::SliderStyle style, juce::Slider& slider) override; + void drawButtonBackground(juce::Graphics& g, + juce::Button& button, + const juce::Colour& backgroundColour, + bool shouldDrawButtonAsHighlighted, + bool shouldDrawButtonAsDown) override; + + +}; \ No newline at end of file diff --git a/Source/LuaComponent.cpp b/Source/LuaComponent.cpp index a42fe2a..de6edc9 100644 --- a/Source/LuaComponent.cpp +++ b/Source/LuaComponent.cpp @@ -13,6 +13,6 @@ LuaComponent::~LuaComponent() { } void LuaComponent::resized() { - auto area = getLocalBounds().reduced(20); + auto area = getLocalBounds().withTrimmedTop(20).reduced(20); sliders.setBounds(area); } diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index a0d39bd..0b02bd9 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -108,7 +108,7 @@ void MainComponent::updateFileLabel() { } void MainComponent::resized() { - auto bounds = getLocalBounds().reduced(20); + auto bounds = getLocalBounds().withTrimmedTop(20).reduced(20); auto buttonWidth = 120; auto buttonHeight = 30; auto padding = 10; @@ -136,3 +136,11 @@ void MainComponent::resized() { auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight()); visualiser.setBounds(bounds.withSizeKeepingCentre(minDim, minDim)); } + +void MainComponent::paint(juce::Graphics& g) { + juce::GroupComponent::paint(g); + + // add drop shadow to the visualiser + auto dc = juce::DropShadow(juce::Colours::black, 30, juce::Point(0, 0)); + dc.drawForRectangle(g, visualiser.getBounds()); +} diff --git a/Source/MainComponent.h b/Source/MainComponent.h index 3eca6db..4c0d0e1 100644 --- a/Source/MainComponent.h +++ b/Source/MainComponent.h @@ -14,6 +14,7 @@ public: ~MainComponent() override; void resized() override; + void paint(juce::Graphics& g) override; void updateFileLabel(); private: OscirenderAudioProcessor& audioProcessor; diff --git a/Source/ObjComponent.cpp b/Source/ObjComponent.cpp index 92dc9f8..d621e14 100644 --- a/Source/ObjComponent.cpp +++ b/Source/ObjComponent.cpp @@ -98,7 +98,7 @@ void ObjComponent::disableMouseRotation() { } void ObjComponent::resized() { - auto area = getLocalBounds().reduced(20); + auto area = getLocalBounds().withTrimmedTop(20).reduced(20); double rowHeight = 30; focalLength.setBounds(area.removeFromTop(rowHeight)); rotateX.setBounds(area.removeFromTop(rowHeight)); diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 84f0f12..7656c37 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -42,12 +42,24 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr audioProcessor.broadcaster.addChangeListener(this); } + if (audioProcessor.wrapperType == juce::AudioProcessor::WrapperType::wrapperType_Standalone) { + if (juce::TopLevelWindow::getNumTopLevelWindows() == 1) { + juce::TopLevelWindow* w = juce::TopLevelWindow::getTopLevelWindow(0); + w->setColour(juce::ResizableWindow::backgroundColourId, Colours::veryDark); + } + } + + juce::Desktop::getInstance().setDefaultLookAndFeel(&lookAndFeel); + setLookAndFeel(&lookAndFeel); + setSize(1100, 750); setResizable(true, true); setResizeLimits(500, 400, 999999, 999999); } OscirenderAudioProcessorEditor::~OscirenderAudioProcessorEditor() { + setLookAndFeel(nullptr); + juce::Desktop::getInstance().setDefaultLookAndFeel(nullptr); juce::MessageManagerLock lock; audioProcessor.broadcaster.removeChangeListener(this); } @@ -67,6 +79,16 @@ void OscirenderAudioProcessorEditor::initialiseCodeEditors() { void OscirenderAudioProcessorEditor::paint(juce::Graphics& g) { g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId)); + juce::DropShadow ds(juce::Colours::black, 10, juce::Point(0, 0)); + ds.drawForRectangle(g, main.getBounds()); + ds.drawForRectangle(g, effects.getBounds()); + if (lua.isVisible()) { + ds.drawForRectangle(g, lua.getBounds()); + } + if (obj.isVisible()) { + ds.drawForRectangle(g, obj.getBounds()); + } + g.setColour(juce::Colours::white); g.setFont(15.0f); } @@ -110,13 +132,15 @@ void OscirenderAudioProcessorEditor::resized() { } auto effectsSection = area.removeFromRight(1.2 * getWidth() / sections); - main.setBounds(area); + main.setBounds(area.reduced(5)); if (lua.isVisible() || obj.isVisible()) { auto altEffectsSection = effectsSection.removeFromBottom(juce::jmin(effectsSection.getHeight() / 2, 300)); - lua.setBounds(altEffectsSection); - obj.setBounds(altEffectsSection); + lua.setBounds(altEffectsSection.reduced(5)); + obj.setBounds(altEffectsSection.reduced(5)); } - effects.setBounds(effectsSection); + effects.setBounds(effectsSection.reduced(5)); + + repaint(); } void OscirenderAudioProcessorEditor::addCodeEditor(int index) { diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 4712ae6..baeade5 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -8,6 +8,7 @@ #include "ObjComponent.h" #include "components/VolumeComponent.h" #include "components/MainMenuBarModel.h" +#include "LookAndFeel.h" class OscirenderAudioProcessorEditor : public juce::AudioProcessorEditor, private juce::CodeDocument::Listener, public juce::AsyncUpdater, public juce::ChangeListener { @@ -34,6 +35,8 @@ public: void updateTitle(); std::atomic editingPerspective = false; + + OscirenderLookAndFeel lookAndFeel; private: OscirenderAudioProcessor& audioProcessor; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 2640ccc..fd53982 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -597,7 +597,8 @@ bool OscirenderAudioProcessor::hasEditor() const { } juce::AudioProcessorEditor* OscirenderAudioProcessor::createEditor() { - return new OscirenderAudioProcessorEditor (*this); + auto editor = new OscirenderAudioProcessorEditor(*this); + return editor; } //============================================================================== diff --git a/Source/components/EffectComponent.cpp b/Source/components/EffectComponent.cpp index a37cdc7..86b26d5 100644 --- a/Source/components/EffectComponent.cpp +++ b/Source/components/EffectComponent.cpp @@ -1,4 +1,5 @@ #include "EffectComponent.h" +#include "../LookAndFeel.h" EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect, int index) : effect(effect), index(index), audioProcessor(p) { addAndMakeVisible(slider); @@ -15,8 +16,6 @@ EffectComponent::EffectComponent(OscirenderAudioProcessor& p, Effect& effect, in lfo.addItem("Reverse Sawtooth", static_cast(LfoType::ReverseSawtooth)); lfo.addItem("Noise", static_cast(LfoType::Noise)); - lfo.setLookAndFeel(&lfoLookAndFeel); - effect.addListener(index, this); setupComponent(); } @@ -75,7 +74,7 @@ void EffectComponent::setupComponent() { lfoSlider.setSliderStyle(juce::Slider::LinearHorizontal); lfoSlider.setTextBoxStyle(juce::Slider::TextBoxRight, false, 70, lfoSlider.getTextBoxHeight()); lfoSlider.setTextValueSuffix("Hz"); - lfoSlider.setColour(juce::Slider::thumbColourId, juce::Colour(0xff00ff00)); + lfoSlider.setColour(sliderThumbOutlineColourId, juce::Colour(0xff00ff00)); lfoSlider.onValueChange = [this]() { effect.parameters[index]->lfoRate->setUnnormalisedValueNotifyingHost(lfoSlider.getValue()); @@ -142,7 +141,7 @@ void EffectComponent::resized() { } void EffectComponent::paint(juce::Graphics& g) { - g.fillAll(juce::Colours::black); + g.fillAll(findColour(effectComponentBackgroundColourId)); g.setColour(juce::Colours::white); g.drawText(effect.parameters[index]->name, textBounds, juce::Justification::left); } diff --git a/Source/components/EffectComponent.h b/Source/components/EffectComponent.h index 0b16e6e..99d54da 100644 --- a/Source/components/EffectComponent.h +++ b/Source/components/EffectComponent.h @@ -4,34 +4,6 @@ #include "../audio/Effect.h" #include "LabelledTextBox.h" -class SmallComboBoxArrow : public juce::LookAndFeel_V4 { - void drawComboBox(juce::Graphics& g, int width, int height, bool, int, int, int, int, juce::ComboBox& box) override { - auto cornerSize = box.findParentComponentOfClass() != nullptr ? 0.0f : 3.0f; - juce::Rectangle boxBounds{0, 0, width, height}; - - g.setColour(box.findColour(juce::ComboBox::backgroundColourId)); - g.fillRoundedRectangle(boxBounds.toFloat(), cornerSize); - - g.setColour(box.findColour(juce::ComboBox::outlineColourId)); - g.drawRoundedRectangle(boxBounds.toFloat().reduced(0.5f, 0.5f), cornerSize, 1.0f); - - juce::Rectangle arrowZone{width - 15, 0, 10, height}; - juce::Path path; - path.startNewSubPath((float) arrowZone.getX(), (float) arrowZone.getCentreY() - 3.0f); - path.lineTo((float) arrowZone.getCentreX(), (float) arrowZone.getCentreY() + 4.0f); - path.lineTo((float) arrowZone.getRight(), (float) arrowZone.getCentreY() - 3.0f); - path.closeSubPath(); - - g.setColour(box.findColour(juce::ComboBox::arrowColourId).withAlpha((box.isEnabled() ? 0.9f : 0.2f))); - g.fillPath(path); - } - - void positionComboBoxText(juce::ComboBox& box, juce::Label& label) { - label.setBounds(1, 1, box.getWidth() - 15, box.getHeight() - 2); - label.setFont(getComboBoxFont(box)); - } -}; - class EffectComponent : public juce::Component, public juce::AudioProcessorParameter::Listener, juce::AsyncUpdater { public: EffectComponent(OscirenderAudioProcessor& p, Effect& effect, int index); @@ -55,7 +27,6 @@ public: Effect& effect; int index; juce::ToggleButton selected; - SmallComboBoxArrow lfoLookAndFeel; juce::ComboBox lfo; private: diff --git a/Source/components/EffectsListComponent.cpp b/Source/components/EffectsListComponent.cpp index fd72d73..2ee897c 100644 --- a/Source/components/EffectsListComponent.cpp +++ b/Source/components/EffectsListComponent.cpp @@ -43,7 +43,7 @@ EffectsListComponent::~EffectsListComponent() {} void EffectsListComponent::paint(juce::Graphics& g) { auto bounds = getLocalBounds(); - g.fillAll(juce::Colours::darkgrey); + g.fillAll(findColour(effectComponentHandleColourId)); g.setColour(juce::Colours::white); bounds.removeFromLeft(20); // draw drag and drop handle using circles diff --git a/Source/components/VisualiserComponent.cpp b/Source/components/VisualiserComponent.cpp index 230e817..44b1ba4 100644 --- a/Source/components/VisualiserComponent.cpp +++ b/Source/components/VisualiserComponent.cpp @@ -27,6 +27,7 @@ void VisualiserComponent::setColours(juce::Colour bk, juce::Colour fg) { void VisualiserComponent::paint(juce::Graphics& g) { g.fillAll(backgroundColour); + g.drawRect(getLocalBounds(), 1); auto r = getLocalBounds().toFloat(); auto minDim = juce::jmin(r.getWidth(), r.getHeight()); diff --git a/Source/components/VolumeComponent.cpp b/Source/components/VolumeComponent.cpp index 606f401..3b7d151 100644 --- a/Source/components/VolumeComponent.cpp +++ b/Source/components/VolumeComponent.cpp @@ -125,5 +125,6 @@ void VolumeComponent::resized() { volumeIcon->setTransformToFit(iconRow.removeFromLeft(iconRow.getWidth() / 2).reduced(1), juce::RectanglePlacement::centred); thresholdIcon->setTransformToFit(iconRow.reduced(2), juce::RectanglePlacement::centred); volumeSlider.setBounds(r.removeFromLeft(r.getWidth() / 2)); - thresholdSlider.setBounds(r); + auto radius = volumeSlider.getLookAndFeel().getSliderThumbRadius(volumeSlider); + thresholdSlider.setBounds(r.reduced(0, radius / 2)); } diff --git a/Source/components/VolumeComponent.h b/Source/components/VolumeComponent.h index 42bc5be..6cb2c6e 100644 --- a/Source/components/VolumeComponent.h +++ b/Source/components/VolumeComponent.h @@ -3,8 +3,9 @@ #include #include "../concurrency/BufferConsumer.h" #include "../PluginProcessor.h" +#include "../LookAndFeel.h" -class ThumbRadiusLookAndFeel : public juce::LookAndFeel_V4 { +class ThumbRadiusLookAndFeel : public OscirenderLookAndFeel { public: ThumbRadiusLookAndFeel(int thumbRadius) : thumbRadius(thumbRadius) {} @@ -26,7 +27,7 @@ public: float ky = sliderPos; auto outlineThickness = slider.isEnabled() ? 0.8f : 0.3f; - auto sliderRadius = (float) (getSliderThumbRadius(slider) - 2); + auto sliderRadius = (float) getSliderThumbRadius(slider); auto diameter = sliderRadius * 2.0f; auto halfThickness = outlineThickness * 0.5f; @@ -49,7 +50,7 @@ public: g.setColour(knobColour); g.fillPath(p); - g.setColour(knobColour.brighter()); + g.setColour(slider.findColour(sliderThumbOutlineColourId)); g.strokePath(p, juce::PathStrokeType(outlineThickness)); } @@ -79,7 +80,7 @@ private: ThumbRadiusLookAndFeel thumbRadiusLookAndFeel{20}; juce::Slider volumeSlider; - ThresholdLookAndFeel thresholdLookAndFeel{20}; + ThresholdLookAndFeel thresholdLookAndFeel{7}; juce::Slider thresholdSlider; std::unique_ptr volumeIcon; diff --git a/osci-render.jucer b/osci-render.jucer index cfcb86c..3c6e03b 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -301,6 +301,8 @@ + +