reVeno/Source/PluginEditor.cpp

46 lines
1.4 KiB
C++
Raw Normal View History

2020-04-03 13:23:19 +02:00
#include "PluginProcessor.h"
#include "PluginEditor.h"
#include "Veno/Core/Config.h"
2020-06-13 10:56:20 +02:00
#include "Veno/Utils/Logger.h"
#include "Veno/Fonts/Fonts.h"
2020-06-14 21:14:28 +02:00
#include "Veno/Utils.h"
#define SIDEBAR_WIDTH 300
2020-04-03 13:23:19 +02:00
VenoAudioProcessorEditor::VenoAudioProcessorEditor (VenoAudioProcessor& p)
2020-06-14 21:14:28 +02:00
: AudioProcessorEditor(&p), processor(p)
{
m_id = p.m_id;
2020-06-14 21:14:28 +02:00
Config::getInstance()->registerEditor(this, m_id);
LookAndFeel::setDefaultLookAndFeel(m_look);
m_sidebar = std::make_unique<Sidebar>(m_id);
setSize(1200 * Config::getInstance()->getScale(), 700 * Config::getInstance()->getScale());
addAndMakeVisible(*m_sidebar);
2020-04-03 13:23:19 +02:00
}
VenoAudioProcessorEditor::~VenoAudioProcessorEditor ()
{
2020-06-14 21:14:28 +02:00
LookAndFeel::setDefaultLookAndFeel(nullptr);
m_sidebar.reset(nullptr);
delete m_look;
2020-06-14 21:14:28 +02:00
Config::getInstance()->removeEditor(m_id);
2020-04-03 13:23:19 +02:00
}
void VenoAudioProcessorEditor::paint (Graphics& g)
{
2020-06-14 21:14:28 +02:00
auto theme = Config::getInstance()->getCurrentTheme();
g.setFont(*VenoFonts::getNormal());
g.fillAll(theme->getColour(ThemeColour::bg_two));
g.setColour(theme->getColour(ThemeColour::bg));
g.fillRect(0, 0, VeNo::Utils::getCalculatedWidth(SIDEBAR_WIDTH), getHeight());
g.setColour(theme->getColour(ThemeColour::accent));
2020-04-03 13:23:19 +02:00
}
void VenoAudioProcessorEditor::resized ()
{
2020-06-14 21:14:28 +02:00
if (m_sidebar != nullptr)
{
2020-06-14 21:14:28 +02:00
m_sidebar->setBounds(0, 0, VeNo::Utils::getCalculatedWidth(SIDEBAR_WIDTH), getHeight());
2020-06-13 10:56:20 +02:00
}
2020-04-03 13:23:19 +02:00
}