-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathPluginEditor.cpp
48 lines (39 loc) · 1.49 KB
/
PluginEditor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "PluginEditor.h"
PluginEditor::PluginEditor (PluginProcessor& p)
: AudioProcessorEditor (&p), processorRef (p)
{
juce::ignoreUnused (processorRef);
addAndMakeVisible (inspectButton);
// this chunk of code instantiates and opens the melatonin inspector
inspectButton.onClick = [&] {
if (!inspector)
{
inspector = std::make_unique<melatonin::Inspector> (*this);
inspector->onClose = [this]() { inspector.reset(); };
}
inspector->setVisible (true);
};
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
setSize (400, 300);
}
PluginEditor::~PluginEditor()
{
}
void PluginEditor::paint (juce::Graphics& g)
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
auto area = getLocalBounds();
g.setColour (juce::Colours::white);
g.setFont (16.0f);
auto helloWorld = juce::String ("Hello from ") + PRODUCT_NAME_WITHOUT_VERSION + " v" VERSION + " running in " + CMAKE_BUILD_TYPE;
g.drawText (helloWorld, area.removeFromTop (150), juce::Justification::centred, false);
}
void PluginEditor::resized()
{
// layout the positions of your child components here
auto area = getLocalBounds();
area.removeFromBottom(50);
inspectButton.setBounds (getLocalBounds().withSizeKeepingCentre(100, 50));
}