49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
#include "PluginProcessor.h"
|
|
#include "PluginEditor.h"
|
|
|
|
|
|
|
|
LampshadeAudioProcessorEditor::LampshadeAudioProcessorEditor (LampshadeAudioProcessor& p)
|
|
: AudioProcessorEditor (&p), processor (p), lineThickness(4)
|
|
{
|
|
lines = {
|
|
LampshadeLine(LampshadeLine::Horizontal, 1./3., 1./3.),
|
|
LampshadeLine(LampshadeLine::Horizontal, 2./3., 2./3.),
|
|
LampshadeLine(LampshadeLine::Vertical, 1./3., 1./3.),
|
|
LampshadeLine(LampshadeLine::Vertical, 2./3., 2./3.)
|
|
};
|
|
component.setTextBoxStyle(Slider::NoTextBox, true, 0, 0);
|
|
setSize(400, 300);
|
|
component.setLookAndFeel(gui);
|
|
addAndMakeVisible(component);
|
|
}
|
|
|
|
LampshadeAudioProcessorEditor::~LampshadeAudioProcessorEditor()
|
|
{
|
|
}
|
|
|
|
void LampshadeAudioProcessorEditor::paint (Graphics& g)
|
|
{
|
|
g.fillAll(Colours::white);
|
|
|
|
for (auto line : lines) {
|
|
if (line.orientation == LampshadeLine::Horizontal) {
|
|
g.drawLine(0, getHeight()*line.x, getWidth(), getHeight()*line.y, lineThickness);
|
|
} else {
|
|
g.drawLine(getWidth()*line.x, 0, getWidth()*line.y, getHeight(), lineThickness);
|
|
}
|
|
}
|
|
}
|
|
|
|
void LampshadeAudioProcessorEditor::resized()
|
|
{
|
|
int h = 1;
|
|
int w = 1;
|
|
|
|
for (auto l : lines) { l.orientation == LampshadeLine::Horizontal ? w++ : h++; }
|
|
|
|
w = getWidth() / w;
|
|
h = getHeight() / h;
|
|
component.setBounds(w+lineThickness/2, h+lineThickness/2, w-lineThickness+1, h-lineThickness);
|
|
}
|