reVeno/Source/Veno/GUI/Components/LCD/SidebarLCD.cpp

62 lines
1.7 KiB
C++
Raw Normal View History

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"
SidebarLCD::SidebarLCD (const std::string& process_id) : BaseComponent (process_id)
{
waveform = std::make_unique<Waveforms> (process_id);
addAndMakeVisible (*waveform);
2020-06-13 10:56:20 +02:00
}
SidebarLCD::~SidebarLCD ()
{
waveform.reset (nullptr);
2020-06-13 10:56:20 +02:00
}
void SidebarLCD::drawHeadline (Graphics& g)
{
float fontSize = VeNo::Utils::setFontSize (12.0f, g) + 2;
2020-06-13 10:56:20 +02:00
int line = m_innerY + fontSize + 2;
g.drawText (">>> VeNo <<<", 0, m_innerY, getWidth () - m_width, fontSize,
Justification::centred,
true);
g.drawLine (0, line, getWidth (), line);
2020-06-13 10:56:20 +02:00
}
void SidebarLCD::drawFooter (Graphics& g)
{
float fontSize = VeNo::Utils::setFontSize (8.0f, g) + 4;
2020-06-13 10:56:20 +02:00
int space = m_innerY + fontSize;
int line = getHeight () - space;
g.drawText ("by VersusTuneZ", 0, line, getWidth () - m_width, fontSize,
Justification::horizontallyCentred,
true);
g.drawLine (0, line - 4, getWidth (), line - 4);
2020-06-13 10:56:20 +02:00
}
void SidebarLCD::resized ()
{
float topSpace = (12 * Config::getInstance ()->getScale ()) + 4 + m_innerY;
if (waveform != nullptr)
{
waveform->setBounds (0, topSpace * 2, getWidth (), getHeight () - (topSpace * 4));
2020-06-13 10:56:20 +02:00
}
}
void SidebarLCD::paint (Graphics& g)
{
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
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
}