- reformat to JUCE-Guidelines
- added Matrix => half working ;)
This commit is contained in:
parent
26a2935e1c
commit
ac22ea5e75
58 changed files with 1220 additions and 799 deletions
|
|
@ -5,73 +5,87 @@
|
|||
#include "Theme.h"
|
||||
#include "ThemePresets.cpp"
|
||||
|
||||
Theme::Theme(std::shared_ptr<PropertiesFile> file) {
|
||||
Theme::Theme (std::shared_ptr<PropertiesFile> file)
|
||||
{
|
||||
m_configFile = file;
|
||||
}
|
||||
|
||||
|
||||
Theme::~Theme() {
|
||||
m_colours.clear();
|
||||
m_configFile.reset();
|
||||
Theme::~Theme ()
|
||||
{
|
||||
m_colours.clear ();
|
||||
m_configFile.reset ();
|
||||
}
|
||||
|
||||
void Theme::setColour(ThemeColour index, Colour *colour) {
|
||||
void Theme::setColour (ThemeColour index, Colour* colour)
|
||||
{
|
||||
auto c = m_colours[index];
|
||||
if (c) {
|
||||
if (c)
|
||||
{
|
||||
delete c;
|
||||
m_colours[index] = colour;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m_colours[index] = colour;
|
||||
}
|
||||
m_configFile->setValue(ThemeColourToString(index), colour->toString());
|
||||
m_configFile->save();
|
||||
m_configFile->setValue (ThemeColourToString (index), colour->toString ());
|
||||
m_configFile->save ();
|
||||
|
||||
}
|
||||
|
||||
void Theme::init() {
|
||||
getColourFromConfig(ThemeColour::bg);
|
||||
getColourFromConfig(ThemeColour::bg_two);
|
||||
getColourFromConfig(ThemeColour::accent);
|
||||
getColourFromConfig(ThemeColour::accent_two);
|
||||
getColourFromConfig(ThemeColour::warning);
|
||||
getColourFromConfig(ThemeColour::clip);
|
||||
getColourFromConfig(ThemeColour::lcd_bg);
|
||||
getColourFromConfig(ThemeColour::lcd);
|
||||
void Theme::init ()
|
||||
{
|
||||
getColourFromConfig (ThemeColour::bg);
|
||||
getColourFromConfig (ThemeColour::bg_two);
|
||||
getColourFromConfig (ThemeColour::accent);
|
||||
getColourFromConfig (ThemeColour::accent_two);
|
||||
getColourFromConfig (ThemeColour::warning);
|
||||
getColourFromConfig (ThemeColour::clip);
|
||||
getColourFromConfig (ThemeColour::lcd_bg);
|
||||
getColourFromConfig (ThemeColour::lcd);
|
||||
}
|
||||
|
||||
void Theme::getColourFromConfig(ThemeColour index) {
|
||||
std::string key = ThemeColourToString(index);
|
||||
if (m_configFile->containsKey(key)) {
|
||||
auto baseColour = Colour::fromString(m_configFile->getValue(key));
|
||||
auto *colour = new Colour(baseColour.getRed(), baseColour.getGreen(), baseColour.getBlue());
|
||||
void Theme::getColourFromConfig (ThemeColour index)
|
||||
{
|
||||
std::string key = ThemeColourToString (index);
|
||||
if (m_configFile->containsKey (key))
|
||||
{
|
||||
auto baseColour = Colour::fromString (m_configFile->getValue (key));
|
||||
auto* colour = new Colour (baseColour.getRed (), baseColour.getGreen (), baseColour.getBlue ());
|
||||
delete m_colours[index];
|
||||
m_colours[index] = colour;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// should only trigger if config is broken or empty :)
|
||||
setLEDTheme(this);
|
||||
setLEDTheme (this);
|
||||
}
|
||||
}
|
||||
|
||||
Colour Theme::getColour(ThemeColour index) {
|
||||
if (m_colours[index] != nullptr) {
|
||||
Colour Theme::getColour (ThemeColour index)
|
||||
{
|
||||
if (m_colours[index] != nullptr)
|
||||
{
|
||||
return *m_colours[index];
|
||||
}
|
||||
return Colour(255, 255, 255);
|
||||
return Colour (255, 255, 255);
|
||||
}
|
||||
|
||||
void Theme::setColourThemeById(int id) {
|
||||
switch (id) {
|
||||
void Theme::setColourThemeById (int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 1:
|
||||
setLEDTheme(this);
|
||||
setLEDTheme (this);
|
||||
break;
|
||||
case 2:
|
||||
setOrangeDreamTheme(this);
|
||||
setOrangeDreamTheme (this);
|
||||
break;
|
||||
case 3:
|
||||
setBloodTheme(this);
|
||||
setBloodTheme (this);
|
||||
break;
|
||||
case 4:
|
||||
setOceanTheme(this);
|
||||
setOceanTheme (this);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,25 +8,23 @@
|
|||
#include "JuceHeader.h"
|
||||
#include <vector>
|
||||
|
||||
enum class ThemeColour {
|
||||
enum class ThemeColour
|
||||
{
|
||||
bg = 0, bg_two, accent, accent_two, warning, clip, lcd_bg, lcd
|
||||
};
|
||||
|
||||
class Theme {
|
||||
class Theme
|
||||
{
|
||||
private:
|
||||
public:
|
||||
explicit Theme(std::shared_ptr<PropertiesFile> file);
|
||||
~Theme();
|
||||
|
||||
void setColour(ThemeColour index, Colour *colour);
|
||||
void setColourThemeById(int id);
|
||||
void init();
|
||||
void getColourFromConfig(ThemeColour index);
|
||||
Colour getColour(ThemeColour index);
|
||||
explicit Theme (std::shared_ptr<PropertiesFile> file);
|
||||
~Theme ();
|
||||
void setColour (ThemeColour index, Colour* colour);
|
||||
void setColourThemeById (int id);
|
||||
void init ();
|
||||
void getColourFromConfig (ThemeColour index);
|
||||
Colour getColour (ThemeColour index);
|
||||
protected:
|
||||
std::map<ThemeColour, Colour*> m_colours;
|
||||
std::shared_ptr<PropertiesFile> m_configFile;
|
||||
};
|
||||
|
||||
|
||||
#endif //VENO_THEME_H
|
||||
|
|
|
|||
|
|
@ -9,53 +9,58 @@
|
|||
* maybe i want a double m_look and feel... that's make it easier to implement different knob styles, slider styles and co
|
||||
*/
|
||||
|
||||
void setLEDTheme(Theme *theme) {
|
||||
theme->setColour(ThemeColour::bg, new Colour(41, 47, 54));
|
||||
theme->setColour(ThemeColour::bg_two, new Colour(217, 217, 217));
|
||||
theme->setColour(ThemeColour::accent, new Colour(169, 208, 142));
|
||||
theme->setColour(ThemeColour::accent_two, new Colour(139, 171, 117));
|
||||
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||
theme->setColour(ThemeColour::lcd_bg, new Colour(21, 21, 21));
|
||||
theme->setColour(ThemeColour::lcd, new Colour(169, 208, 142));
|
||||
void setLEDTheme (Theme* theme)
|
||||
{
|
||||
theme->setColour (ThemeColour::bg, new Colour (41, 47, 54));
|
||||
theme->setColour (ThemeColour::bg_two, new Colour (217, 217, 217));
|
||||
theme->setColour (ThemeColour::accent, new Colour (169, 208, 142));
|
||||
theme->setColour (ThemeColour::accent_two, new Colour (139, 171, 117));
|
||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
||||
theme->setColour (ThemeColour::lcd_bg, new Colour (21, 21, 21));
|
||||
theme->setColour (ThemeColour::lcd, new Colour (169, 208, 142));
|
||||
}
|
||||
|
||||
void setBloodTheme(Theme *theme) {
|
||||
theme->setColour(ThemeColour::bg, new Colour(41, 47, 54));
|
||||
theme->setColour(ThemeColour::bg_two, new Colour(64, 67, 78));
|
||||
theme->setColour(ThemeColour::accent, new Colour(180, 38, 50));
|
||||
theme->setColour(ThemeColour::accent_two, new Colour(115, 47, 64));
|
||||
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||
theme->setColour(ThemeColour::lcd_bg, new Colour(0, 0, 0));
|
||||
theme->setColour(ThemeColour::lcd, new Colour(180, 38, 78));
|
||||
void setBloodTheme (Theme* theme)
|
||||
{
|
||||
theme->setColour (ThemeColour::bg, new Colour (41, 47, 54));
|
||||
theme->setColour (ThemeColour::bg_two, new Colour (64, 67, 78));
|
||||
theme->setColour (ThemeColour::accent, new Colour (180, 38, 50));
|
||||
theme->setColour (ThemeColour::accent_two, new Colour (115, 47, 64));
|
||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
||||
theme->setColour (ThemeColour::lcd_bg, new Colour (0, 0, 0));
|
||||
theme->setColour (ThemeColour::lcd, new Colour (180, 38, 78));
|
||||
}
|
||||
|
||||
void setOrangeDreamTheme(Theme *theme) {
|
||||
theme->setColour(ThemeColour::bg, new Colour(21, 21, 21));
|
||||
theme->setColour(ThemeColour::bg_two, new Colour(42, 42, 42));
|
||||
theme->setColour(ThemeColour::accent, new Colour(255, 160, 0));
|
||||
theme->setColour(ThemeColour::accent_two, new Colour(255, 11, 0));
|
||||
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||
theme->setColour(ThemeColour::lcd_bg, new Colour(33, 33, 33));
|
||||
theme->setColour(ThemeColour::lcd, new Colour(255, 160, 0));
|
||||
void setOrangeDreamTheme (Theme* theme)
|
||||
{
|
||||
theme->setColour (ThemeColour::bg, new Colour (21, 21, 21));
|
||||
theme->setColour (ThemeColour::bg_two, new Colour (42, 42, 42));
|
||||
theme->setColour (ThemeColour::accent, new Colour (255, 160, 0));
|
||||
theme->setColour (ThemeColour::accent_two, new Colour (255, 11, 0));
|
||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
||||
theme->setColour (ThemeColour::lcd_bg, new Colour (33, 33, 33));
|
||||
theme->setColour (ThemeColour::lcd, new Colour (255, 160, 0));
|
||||
}
|
||||
|
||||
void setOceanTheme(Theme *theme) {
|
||||
theme->setColour(ThemeColour::bg, new Colour(55, 63, 81));
|
||||
theme->setColour(ThemeColour::bg_two, new Colour(64, 67, 78));
|
||||
theme->setColour(ThemeColour::accent, new Colour(0, 141, 213));
|
||||
theme->setColour(ThemeColour::accent_two, new Colour(0, 129, 194));
|
||||
theme->setColour(ThemeColour::clip, new Colour(255, 23, 68));
|
||||
theme->setColour(ThemeColour::warning, new Colour(255, 143, 0));
|
||||
theme->setColour(ThemeColour::lcd_bg, new Colour(21, 21, 21));
|
||||
theme->setColour(ThemeColour::lcd, new Colour(0, 129, 194));
|
||||
void setOceanTheme (Theme* theme)
|
||||
{
|
||||
theme->setColour (ThemeColour::bg, new Colour (55, 63, 81));
|
||||
theme->setColour (ThemeColour::bg_two, new Colour (64, 67, 78));
|
||||
theme->setColour (ThemeColour::accent, new Colour (0, 141, 213));
|
||||
theme->setColour (ThemeColour::accent_two, new Colour (0, 129, 194));
|
||||
theme->setColour (ThemeColour::clip, new Colour (255, 23, 68));
|
||||
theme->setColour (ThemeColour::warning, new Colour (255, 143, 0));
|
||||
theme->setColour (ThemeColour::lcd_bg, new Colour (21, 21, 21));
|
||||
theme->setColour (ThemeColour::lcd, new Colour (0, 129, 194));
|
||||
}
|
||||
|
||||
|
||||
std::string ThemeColourToString(ThemeColour index) {
|
||||
switch (index) {
|
||||
std::string ThemeColourToString (ThemeColour index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case ThemeColour::bg:
|
||||
return "colour_bg";
|
||||
case ThemeColour::bg_two:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue