2020-06-13 10:56:20 +02:00
|
|
|
//
|
|
|
|
// Created by versustune on 11.06.20.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "SidebarLCD.h"
|
|
|
|
#include "../../../Utils.h"
|
|
|
|
#include "../../../Core/Config.h"
|
|
|
|
#include "../../../Fonts/Fonts.h"
|
|
|
|
|
2020-06-14 21:14:28 +02:00
|
|
|
SidebarLCD::SidebarLCD (const std::string& process_id) : BaseComponent(process_id)
|
2020-06-13 16:52:16 +02:00
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
waveform = std::make_unique<Waveforms>(process_id);
|
|
|
|
addAndMakeVisible(*waveform);
|
2020-06-13 10:56:20 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
SidebarLCD::~SidebarLCD ()
|
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
waveform.reset(nullptr);
|
2020-06-13 10:56:20 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void SidebarLCD::drawHeadline (Graphics& g)
|
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
float fontSize = VeNo::Utils::setFontSize(12.0f, g) + 2;
|
2020-06-13 10:56:20 +02:00
|
|
|
int line = m_innerY + fontSize + 2;
|
2020-06-29 22:47:45 +02:00
|
|
|
// should draw random stuff? or draw current selected preset :)
|
|
|
|
g.drawText(">>> INIT <<<", 0, m_innerY, getWidth() - m_width, fontSize,
|
2020-06-14 21:14:28 +02:00
|
|
|
Justification::centred,
|
|
|
|
true);
|
|
|
|
g.drawLine(0, line, getWidth(), line);
|
2020-06-13 10:56:20 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void SidebarLCD::drawFooter (Graphics& g)
|
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
float fontSize = VeNo::Utils::setFontSize(8.0f, g) + 4;
|
2020-06-13 10:56:20 +02:00
|
|
|
int space = m_innerY + fontSize;
|
2020-06-14 21:14:28 +02:00
|
|
|
int line = getHeight() - space;
|
2020-06-29 22:47:45 +02:00
|
|
|
g.drawText("by VersusTuneZ for " + SystemStats::getFullUserName(), 0, line, getWidth() - m_width, fontSize,
|
2020-06-14 21:14:28 +02:00
|
|
|
Justification::horizontallyCentred,
|
|
|
|
true);
|
|
|
|
g.drawLine(0, line - 4, getWidth(), line - 4);
|
2020-06-13 10:56:20 +02:00
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void SidebarLCD::resized ()
|
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
float topSpace = (12 * Config::getInstance()->getScale()) + 4 + m_innerY;
|
2020-06-13 16:52:16 +02:00
|
|
|
if (waveform != nullptr)
|
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
waveform->setBounds(0, topSpace * 2, getWidth(), getHeight() - (topSpace * 4));
|
2020-06-13 10:56:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-13 16:52:16 +02:00
|
|
|
void SidebarLCD::paint (Graphics& g)
|
|
|
|
{
|
2020-06-14 21:14:28 +02:00
|
|
|
std::shared_ptr<Theme> theme = Config::getInstance()->getCurrentTheme();
|
|
|
|
auto colour = theme->getColour(ThemeColour::lcd_bg);
|
|
|
|
g.fillAll(colour);
|
2020-06-13 10:56:20 +02:00
|
|
|
// background
|
2020-06-14 21:14:28 +02:00
|
|
|
auto accent = theme->getColour(ThemeColour::lcd);
|
|
|
|
g.setColour(accent);
|
|
|
|
g.setFont(*VenoFonts::getLCD());
|
|
|
|
drawHeadline(g);
|
|
|
|
drawFooter(g);
|
2020-06-13 10:56:20 +02:00
|
|
|
}
|