Skip to content
39 changes: 0 additions & 39 deletions complete/tremolo_plugin/include/Tremolo/AboutComponent.h

This file was deleted.

43 changes: 43 additions & 0 deletions complete/tremolo_plugin/include/Tremolo/MessageOnClick.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#pragma once

namespace tremolo {
class MessageOnClick : private juce::MouseListener {
public:
MessageOnClick(juce::Component& topLevelComponent,
juce::Component& clickTarget,
juce::String messageOnClick)
: parent{topLevelComponent},
target{clickTarget},
message{std::move(messageOnClick)} {
popup.setAllowedPlacement(juce::BubbleComponent::BubblePlacement::below);
popup.setAlwaysOnTop(true);

message.setColour(
CustomLookAndFeel::getColor(CustomLookAndFeel::Colors::paleBlue));
message.setJustification(juce::Justification::centred);

target.addMouseListener(this, true);
}

~MessageOnClick() override { target.removeMouseListener(this); }

void mouseDoubleClick(const juce::MouseEvent&) override { displayPopup(); }

private:
void displayPopup() {
// only the first call to addChildComponent() has an effect
parent.addChildComponent(popup);

if (!popup.isVisible()) {
popup.showAt(&target, message, 0, true);
}
}

juce::Component& parent;
juce::Component& target;
juce::AttributedString message;
juce::BubbleMessageComponent popup;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MessageOnClick)
};
} // namespace tremolo
2 changes: 1 addition & 1 deletion complete/tremolo_plugin/include/Tremolo/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PluginEditor : public juce::AudioProcessorEditor {
juce::ButtonParameterAttachment bypassAttachment;

LfoVisualizer lfoVisualizer;
AboutComponent about;
MessageOnClick about;

CustomLookAndFeel lookAndFeel;

Expand Down
5 changes: 4 additions & 1 deletion complete/tremolo_plugin/source/CustomLookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ juce::Colour CustomLookAndFeel::getColor(Colors colorName) {
CustomLookAndFeel::CustomLookAndFeel() {
setColour(juce::ComboBox::textColourId, getColor(Colors::paleBlue));
setColour(juce::Label::textColourId, getColor(Colors::paleBlue));
setColour(juce::PopupMenu::backgroundColourId, juce::Colour{0xFF153245});
const juce::Colour darkBlue{0xFF153245};
setColour(juce::PopupMenu::backgroundColourId, darkBlue);
setColour(juce::PopupMenu::textColourId, getColor(Colors::paleBlue));
setColour(juce::PopupMenu::highlightedTextColourId, juce::Colour{0xFF0C131E});
setColour(juce::PopupMenu::highlightedBackgroundColourId,
getColor(Colors::orange));
setColour(juce::BubbleComponent::backgroundColourId, darkBlue);
setColour(juce::BubbleComponent::outlineColourId, juce::Colour{0xFF0C0E16});

// used to set the font of the default standalone plugin window
getDefaultLookAndFeel().setDefaultSansSerifTypeface(
Expand Down
12 changes: 5 additions & 7 deletions complete/tremolo_plugin/source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ PluginEditor::PluginEditor(PluginProcessor& p)
lfoVisualizer{
[&p](juce::AudioBuffer<float>& b) { p.readAllLfoSamples(b); },
[&p] { return p.getSampleRateThreadSafe(); },
[&p] { return p.getParameterRefs().bypassed.get(); }} {
[&p] { return p.getParameterRefs().bypassed.get(); }},
about{*this, logo,
JucePlugin_Manufacturer "\n" JucePlugin_Name "\n" __DATE__
"\n" __TIME__
"\nv" JucePlugin_VersionString} {
background.setImage(juce::ImageCache::getFromMemory(
assets::Background_png, assets::Background_pngSize));
addAndMakeVisible(background);
Expand Down Expand Up @@ -59,8 +63,6 @@ PluginEditor::PluginEditor(PluginProcessor& p)
lfoVisualizer.setBackgroundColor(juce::Colours::transparentBlack);
addAndMakeVisible(lfoVisualizer);

addAndMakeVisible(about);

setLookAndFeel(&lookAndFeel);

// Make sure that before the constructor has finished, you've set the
Expand Down Expand Up @@ -123,9 +125,5 @@ void PluginEditor::resized() {
bypassLabelBounds.removeFromLeft(396);

bypassLabel.setBounds(bypassLabelBounds);

constexpr auto aboutSize = 20;
about.setBounds(
getLocalBounds().removeFromRight(aboutSize).removeFromTop(aboutSize));
}
} // namespace tremolo
2 changes: 1 addition & 1 deletion complete/tremolo_plugin/tremolo_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ END_JUCE_MODULE_DECLARATION
#include "include/Tremolo/Tremolo.h"
#include "include/Tremolo/BypassTransitionSmoother.h"
#include "include/Tremolo/PluginProcessor.h"
#include "include/Tremolo/AboutComponent.h"
#include "include/Tremolo/MessageOnClick.h"
#include "include/Tremolo/PluginEditor.h"