- save
This commit is contained in:
parent
ac22ea5e75
commit
a27c62f062
49 changed files with 1171 additions and 385 deletions
77
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.cpp
Normal file
77
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#include "ConfigComponent.h"
|
||||
#include <utility>
|
||||
|
||||
ConfigComponent::ConfigComponent (std::string pid)
|
||||
{
|
||||
m_pid = std::move(pid);
|
||||
m_colors.resize(8);
|
||||
auto theme = Config::getInstance()->getCurrentTheme();
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
m_colors[i] = std::make_unique<VeNoColour>(pid, getColorForId(i));
|
||||
m_colors[i]->setName(m_names[i]);
|
||||
addAndMakeVisible(m_colors[i].get());
|
||||
}
|
||||
m_preColours = std::make_unique<VenoPreColours>(pid);
|
||||
addAndMakeVisible(*m_preColours);
|
||||
flexBox.flexDirection = FlexBox::Direction::row;
|
||||
flexBox.justifyContent = FlexBox::JustifyContent::flexStart;
|
||||
flexBox.flexWrap = FlexBox::Wrap::wrap;
|
||||
auto w = 200;
|
||||
auto h = 100;
|
||||
for (auto& color : m_colors)
|
||||
{
|
||||
auto item = FlexItem(w, h, *color);
|
||||
item.margin = FlexItem::Margin(5, 5, 5, 5);
|
||||
flexBox.items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
ConfigComponent::~ConfigComponent ()
|
||||
{
|
||||
for (auto& color : m_colors)
|
||||
{
|
||||
color.reset();
|
||||
}
|
||||
m_colors.clear();
|
||||
}
|
||||
|
||||
ThemeColour ConfigComponent::getColorForId (int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
default:
|
||||
return ThemeColour::bg;
|
||||
case 1:
|
||||
return ThemeColour::bg_two;
|
||||
case 2:
|
||||
return ThemeColour::accent;
|
||||
case 3:
|
||||
return ThemeColour::accent_two;
|
||||
case 4:
|
||||
return ThemeColour::warning;
|
||||
case 5:
|
||||
return ThemeColour::clip;
|
||||
case 6:
|
||||
return ThemeColour::lcd_bg;
|
||||
case 7:
|
||||
return ThemeColour::lcd;
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigComponent::paint (Graphics& g)
|
||||
{
|
||||
g.fillAll(Colours::black);
|
||||
}
|
||||
|
||||
void ConfigComponent::resized ()
|
||||
{
|
||||
auto bounds = Rectangle<int>();
|
||||
bounds.setBounds(0,0,getWidth(), getHeight()-200);
|
||||
flexBox.performLayout(bounds);
|
||||
m_preColours->setBounds(0, getHeight() - 200, getWidth(), 200);
|
||||
}
|
||||
30
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.h
Normal file
30
Source/Veno/GUI/GUIParts/ConfigScreen/ConfigComponent.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#ifndef VENO_CONFIGCOMPONENT_H
|
||||
#define VENO_CONFIGCOMPONENT_H
|
||||
|
||||
#include "JuceHeader.h"
|
||||
#include "../../../Core/Config.h"
|
||||
#include "../../Components/Config/VeNoColour.h"
|
||||
#include "../../Components/Config/VenoPreColours.h"
|
||||
|
||||
class ConfigComponent : public Component
|
||||
{
|
||||
public:
|
||||
explicit ConfigComponent(std::string pid);
|
||||
~ConfigComponent() override;
|
||||
void paint (Graphics& g) override;
|
||||
void resized () override;
|
||||
protected:
|
||||
static ThemeColour getColorForId(int id);
|
||||
std::string m_pid;
|
||||
std::string m_names[8]{
|
||||
"Background", "BackgroundTwo", "Accent", "Accent Two", "Warning", "Clip", "LCD Background", "LCD"
|
||||
};
|
||||
std::vector<std::unique_ptr<VeNoColour>> m_colors;
|
||||
std::unique_ptr<VenoPreColours> m_preColours;
|
||||
FlexBox flexBox;
|
||||
};
|
||||
#endif //VENO_CONFIGCOMPONENT_H
|
||||
49
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.cpp
Normal file
49
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#include "VenoConfigScreen.h"
|
||||
#include "../../../VenoInstance.h"
|
||||
|
||||
VenoConfigScreen::VenoConfigScreen (const std::string& pid) : DocumentWindow("VeNo Config", Colours::black,
|
||||
DocumentWindow::closeButton, true)
|
||||
{
|
||||
m_pid = pid;
|
||||
auto w = 840;
|
||||
auto h = 800;
|
||||
component = std::make_shared<ConfigComponent>(pid);
|
||||
component->setSize(w, h);
|
||||
m_lookHandler = std::make_unique<LookHandler>();
|
||||
component->setLookAndFeel(m_lookHandler->getLook());
|
||||
centreWithSize(w, h);
|
||||
setAlwaysOnTop(true);
|
||||
setContentOwned(component.get(), false);
|
||||
setResizable(false, false);
|
||||
setUsingNativeTitleBar(true);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
VenoConfigScreen::~VenoConfigScreen ()
|
||||
{
|
||||
component->setLookAndFeel(nullptr);
|
||||
m_lookHandler.reset();
|
||||
component.reset();
|
||||
}
|
||||
|
||||
void VenoConfigScreen::closeButtonPressed ()
|
||||
{
|
||||
auto state = VenoInstance::getInstance(m_pid)->state;
|
||||
if (state != nullptr && state->configScreen != nullptr)
|
||||
{
|
||||
delete state->configScreen;
|
||||
state->configScreen = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void VenoConfigScreen::paint (Graphics& graphics)
|
||||
{
|
||||
}
|
||||
|
||||
void VenoConfigScreen::resized ()
|
||||
{
|
||||
}
|
||||
28
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.h
Normal file
28
Source/Veno/GUI/GUIParts/ConfigScreen/VenoConfigScreen.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// Created by versustune on 14.06.20.
|
||||
//
|
||||
|
||||
#ifndef VENO_VENOCONFIGSCREEN_H
|
||||
#define VENO_VENOCONFIGSCREEN_H
|
||||
|
||||
#include "JuceHeader.h"
|
||||
#include "../../../Core/Config.h"
|
||||
#include "../../Components/Config/VeNoColour.h"
|
||||
#include "ConfigComponent.h"
|
||||
|
||||
class VenoConfigScreen : public DocumentWindow
|
||||
{
|
||||
public:
|
||||
explicit VenoConfigScreen (const std::string& pid);
|
||||
~VenoConfigScreen () override;
|
||||
void closeButtonPressed () override;
|
||||
void paint (Graphics& graphics) override;
|
||||
void resized () override;
|
||||
private:
|
||||
std::string m_pid;
|
||||
std::shared_ptr<ConfigComponent> component;
|
||||
std::unique_ptr<LookHandler> m_lookHandler;
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VenoConfigScreen)
|
||||
|
||||
};
|
||||
#endif //VENO_VENOCONFIGSCREEN_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue