Skip to content

Commit

Permalink
Add look and feel clases
Browse files Browse the repository at this point in the history
  • Loading branch information
FangCunWuChang committed Jan 11, 2024
1 parent dcbe715 commit 08bc778
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 69 deletions.
17 changes: 17 additions & 0 deletions src/ui/lookAndFeel/ControllerLookAndFeel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ControllerLookAndFeel.h"
#include "../misc/ColorMap.h"

ControllerLookAndFeel::ControllerLookAndFeel()
: LookAndFeel_V4() {
/** Buttons */
this->setColour(juce::TextButton::ColourIds::buttonColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->setColour(juce::TextButton::ColourIds::buttonOnColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->setColour(juce::TextButton::ColourIds::textColourOffId,
ColorMap::getInstance()->get("ThemeColorB8"));
this->setColour(juce::TextButton::ColourIds::textColourOnId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->setColour(juce::ComboBox::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
}
11 changes: 11 additions & 0 deletions src/ui/lookAndFeel/ControllerLookAndFeel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <JuceHeader.h>

class ControllerLookAndFeel : public juce::LookAndFeel_V4 {
public:
ControllerLookAndFeel();

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ControllerLookAndFeel)
};
82 changes: 13 additions & 69 deletions src/ui/lookAndFeel/LookAndFeelFactory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#include "LookAndFeelFactory.h"
#include "MainLookAndFeel.h"
#include "ToolBarLookAndFeel.h"
#include "MainMenuLookAndFeel.h"
#include "SystemStatusLookAndFeel.h"
#include "TimeLookAndFeel.h"
#include "ControllerLookAndFeel.h"
#include "ToolsLookAndFeel.h"
#include "../misc/ColorMap.h"
#include <FlowUI.h>

Expand Down Expand Up @@ -36,84 +42,22 @@ void LookAndFeelFactory::initialise() {
ColorMap::getInstance()->get("ThemeColorA2").withAlpha(0.3f));

/** ToolBar */
this->toolBarLAF = std::make_unique<juce::LookAndFeel_V4>();
this->toolBarLAF->setColour(juce::ResizableWindow::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->toolBarLAF = std::make_unique<ToolBarLookAndFeel>();

/** Main Menu */
this->mainMenuLAF = std::make_unique<juce::LookAndFeel_V4>();
this->mainMenuLAF->setColour(juce::TextButton::ColourIds::buttonColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->mainMenuLAF->setColour(juce::TextButton::ColourIds::buttonOnColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->mainMenuLAF->setColour(juce::TextButton::ColourIds::textColourOffId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->mainMenuLAF->setColour(juce::TextButton::ColourIds::textColourOnId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->mainMenuLAF->setColour(juce::ComboBox::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->mainMenuLAF = std::make_unique<MainMenuLookAndFeel>();

/** System Status */
this->sysStatusLAF = std::make_unique<juce::LookAndFeel_V4>();
this->sysStatusLAF->setColour(juce::ResizableWindow::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));

this->sysStatusLAF->setColour(juce::Label::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->sysStatusLAF->setColour(juce::Label::ColourIds::textColourId,
ColorMap::getInstance()->get("ThemeColorB9"));/**< Label Color */
this->sysStatusLAF->setColour(juce::Label::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB9"));
this->sysStatusLAF->setColour(juce::Label::ColourIds::backgroundWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->sysStatusLAF->setColour(juce::Label::ColourIds::textWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB10"));/**< Value Color */
this->sysStatusLAF->setColour(juce::Label::ColourIds::outlineWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorA2"));/**< Curve Color */
this->sysStatusLAF = std::make_unique<SystemStatusLookAndFeel>();

/** Time */
this->timeLAF = std::make_unique<juce::LookAndFeel_V4>();
this->timeLAF->setColour(juce::ResizableWindow::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));

this->timeLAF->setColour(juce::Label::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->timeLAF->setColour(juce::Label::ColourIds::textColourId,
ColorMap::getInstance()->get("ThemeColorB9"));/**< Label Color */
this->timeLAF->setColour(juce::Label::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB9"));
this->timeLAF->setColour(juce::Label::ColourIds::backgroundWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->timeLAF->setColour(juce::Label::ColourIds::textWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB10"));/**< Value Color */
this->timeLAF->setColour(juce::Label::ColourIds::outlineWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorA2"));/**< Curve Color */

this->timeLAF = std::make_unique<TimeLookAndFeel>();

/** Controller */
this->controllerLAF = std::make_unique<juce::LookAndFeel_V4>();
this->controllerLAF->setColour(juce::TextButton::ColourIds::buttonColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->controllerLAF->setColour(juce::TextButton::ColourIds::buttonOnColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->controllerLAF->setColour(juce::TextButton::ColourIds::textColourOffId,
ColorMap::getInstance()->get("ThemeColorB8"));
this->controllerLAF->setColour(juce::TextButton::ColourIds::textColourOnId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->controllerLAF->setColour(juce::ComboBox::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->controllerLAF = std::make_unique<ControllerLookAndFeel>();

/** Tools */
this->toolsLAF = std::make_unique<juce::LookAndFeel_V4>();
this->toolsLAF->setColour(juce::TextButton::ColourIds::buttonColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->toolsLAF->setColour(juce::TextButton::ColourIds::buttonOnColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->toolsLAF->setColour(juce::TextButton::ColourIds::textColourOffId,
ColorMap::getInstance()->get("ThemeColorB8"));
this->toolsLAF->setColour(juce::TextButton::ColourIds::textColourOnId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->toolsLAF->setColour(juce::ComboBox::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->toolsLAF = std::make_unique<ToolsLookAndFeel>();
}

void LookAndFeelFactory::setDefaultSansSerifTypeface(juce::Typeface::Ptr typeface) {
Expand Down
17 changes: 17 additions & 0 deletions src/ui/lookAndFeel/MainMenuLookAndFeel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "MainMenuLookAndFeel.h"
#include "../misc/ColorMap.h"

MainMenuLookAndFeel::MainMenuLookAndFeel()
: LookAndFeel_V4() {
/** Buttons */
this->setColour(juce::TextButton::ColourIds::buttonColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->setColour(juce::TextButton::ColourIds::buttonOnColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->setColour(juce::TextButton::ColourIds::textColourOffId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->setColour(juce::TextButton::ColourIds::textColourOnId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->setColour(juce::ComboBox::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
}
11 changes: 11 additions & 0 deletions src/ui/lookAndFeel/MainMenuLookAndFeel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <JuceHeader.h>

class MainMenuLookAndFeel : public juce::LookAndFeel_V4 {
public:
MainMenuLookAndFeel();

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainMenuLookAndFeel)
};
23 changes: 23 additions & 0 deletions src/ui/lookAndFeel/SystemStatusLookAndFeel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "SystemStatusLookAndFeel.h"
#include "../misc/ColorMap.h"

SystemStatusLookAndFeel::SystemStatusLookAndFeel()
: LookAndFeel_V4() {
/** Background */
this->setColour(juce::ResizableWindow::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));

/** Graph */
this->setColour(juce::Label::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->setColour(juce::Label::ColourIds::textColourId,
ColorMap::getInstance()->get("ThemeColorB9"));/**< Label Color */
this->setColour(juce::Label::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB9"));
this->setColour(juce::Label::ColourIds::backgroundWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->setColour(juce::Label::ColourIds::textWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB10"));/**< Value Color */
this->setColour(juce::Label::ColourIds::outlineWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorA2"));/**< Curve Color */
}
11 changes: 11 additions & 0 deletions src/ui/lookAndFeel/SystemStatusLookAndFeel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <JuceHeader.h>

class SystemStatusLookAndFeel : public juce::LookAndFeel_V4 {
public:
SystemStatusLookAndFeel();

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SystemStatusLookAndFeel)
};
23 changes: 23 additions & 0 deletions src/ui/lookAndFeel/TimeLookAndFeel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "TimeLookAndFeel.h"
#include "../misc/ColorMap.h"

TimeLookAndFeel::TimeLookAndFeel()
: LookAndFeel_V4() {
/** Background */
this->setColour(juce::ResizableWindow::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));

/** Graph */
this->setColour(juce::Label::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->setColour(juce::Label::ColourIds::textColourId,
ColorMap::getInstance()->get("ThemeColorB9"));
this->setColour(juce::Label::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB9"));
this->setColour(juce::Label::ColourIds::backgroundWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->setColour(juce::Label::ColourIds::textWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorB10"));/**< Value Color */
this->setColour(juce::Label::ColourIds::outlineWhenEditingColourId,
ColorMap::getInstance()->get("ThemeColorA2"));
}
11 changes: 11 additions & 0 deletions src/ui/lookAndFeel/TimeLookAndFeel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <JuceHeader.h>

class TimeLookAndFeel : public juce::LookAndFeel_V4 {
public:
TimeLookAndFeel();

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(TimeLookAndFeel)
};
9 changes: 9 additions & 0 deletions src/ui/lookAndFeel/ToolBarLookAndFeel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "ToolBarLookAndFeel.h"
#include "../misc/ColorMap.h"

ToolBarLookAndFeel::ToolBarLookAndFeel()
: LookAndFeel_V4() {
/** Background */
this->setColour(juce::ResizableWindow::ColourIds::backgroundColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
}
11 changes: 11 additions & 0 deletions src/ui/lookAndFeel/ToolBarLookAndFeel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <JuceHeader.h>

class ToolBarLookAndFeel : public juce::LookAndFeel_V4 {
public:
ToolBarLookAndFeel();

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ToolBarLookAndFeel)
};
17 changes: 17 additions & 0 deletions src/ui/lookAndFeel/ToolsLookAndFeel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "ToolsLookAndFeel.h"
#include "../misc/ColorMap.h"

ToolsLookAndFeel::ToolsLookAndFeel()
: LookAndFeel_V4() {
/** Buttons */
this->setColour(juce::TextButton::ColourIds::buttonColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
this->setColour(juce::TextButton::ColourIds::buttonOnColourId,
ColorMap::getInstance()->get("ThemeColorB1"));
this->setColour(juce::TextButton::ColourIds::textColourOffId,
ColorMap::getInstance()->get("ThemeColorB8"));
this->setColour(juce::TextButton::ColourIds::textColourOnId,
ColorMap::getInstance()->get("ThemeColorB10"));
this->setColour(juce::ComboBox::ColourIds::outlineColourId,
ColorMap::getInstance()->get("ThemeColorB2"));
}
12 changes: 12 additions & 0 deletions src/ui/lookAndFeel/ToolsLookAndFeel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <JuceHeader.h>

class ToolsLookAndFeel : public juce::LookAndFeel_V4 {
public:
ToolsLookAndFeel();

private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ToolsLookAndFeel)
};

0 comments on commit 08bc778

Please sign in to comment.