Added preset menu button.
This commit is contained in:
parent
ad58381614
commit
857e0655fd
@ -531,8 +531,7 @@ namespace AXIOM {
|
|||||||
public:
|
public:
|
||||||
BypassButtonLookAndFeel()
|
BypassButtonLookAndFeel()
|
||||||
{
|
{
|
||||||
svgXml = juce::XmlDocument::parse(BinaryData::bypass_icon_svg);
|
svgXml = juce::XmlDocument::parse(BinaryData::bypass_icon_svg);}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -578,12 +577,64 @@ namespace AXIOM {
|
|||||||
juce::RectanglePlacement::centred, bypassOpacity);
|
juce::RectanglePlacement::centred, bypassOpacity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<juce::XmlElement> svgXml;
|
std::unique_ptr<juce::XmlElement> svgXml;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PresetMenuButtonLookAndFeel : public juce::LookAndFeel_V4 {
|
||||||
|
public:
|
||||||
|
PresetMenuButtonLookAndFeel()
|
||||||
|
{
|
||||||
|
presetMenuButton = juce::XmlDocument::parse(BinaryData::preset_menu_icon_svg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawToggleButton(juce::Graphics& g, juce::ToggleButton& button,
|
||||||
|
bool shouldDrawButtonAsHighlighted,
|
||||||
|
bool shouldDrawButtonAsDown) override
|
||||||
|
{
|
||||||
|
|
||||||
|
bool isHovered = button.isMouseOverOrDragging();
|
||||||
|
bool isToggled = button.getToggleState();
|
||||||
|
bool isEnabled = button.isEnabled();
|
||||||
|
auto bounds = button.getLocalBounds().toFloat();
|
||||||
|
auto iconSize = juce::jmin(bounds.getWidth(), bounds.getHeight()) * 1.5f;
|
||||||
|
auto hoverFactor = isHovered ? 1.05f : 1.0f;
|
||||||
|
|
||||||
|
auto iconBounds = juce::Rectangle<float>(iconSize * hoverFactor, iconSize * hoverFactor)
|
||||||
|
.withCentre(bounds.getCentre())
|
||||||
|
.withX(bounds.getX());
|
||||||
|
// ganz links im Button starten
|
||||||
|
;
|
||||||
|
|
||||||
|
float bypassOpacity = 1.0f;
|
||||||
|
|
||||||
|
if (presetMenuButton != nullptr) {
|
||||||
|
auto menuIcon = juce::Drawable::createFromSVG(*presetMenuButton);
|
||||||
|
juce::Colour colour;
|
||||||
|
if (isHovered) {
|
||||||
|
colour = isToggled ? Colours::ACCENTHOVER : Colours::BACKGROUNDHOVER;
|
||||||
|
} else {
|
||||||
|
colour = isToggled
|
||||||
|
? Colours::ACCENTCOLOUR
|
||||||
|
: Colours::BACKGROUNDCOLOUR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Icon zeichnen
|
||||||
|
menuIcon->replaceColour(juce::Colours::black, colour);
|
||||||
|
menuIcon->drawWithin(g, iconBounds,
|
||||||
|
juce::RectanglePlacement::centred, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<juce::XmlElement> presetMenuButton;
|
||||||
|
};
|
||||||
|
|
||||||
class SvgToggleButtonLookAndFeel : public juce::LookAndFeel_V4 {
|
class SvgToggleButtonLookAndFeel : public juce::LookAndFeel_V4 {
|
||||||
public:
|
public:
|
||||||
SvgToggleButtonLookAndFeel() {
|
SvgToggleButtonLookAndFeel() {
|
||||||
@ -982,7 +1033,9 @@ namespace AXIOM {
|
|||||||
int rowStart, int colStart,
|
int rowStart, int colStart,
|
||||||
int rowEnd, int colEnd)
|
int rowEnd, int colEnd)
|
||||||
{
|
{
|
||||||
return juce::GridItem(c).withArea(rowStart, colStart, rowEnd, colEnd);
|
return juce::GridItem(c)
|
||||||
|
.withArea(rowStart, colStart, rowEnd, colEnd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void grid(juce::Rectangle<int> bounds,
|
static void grid(juce::Rectangle<int> bounds,
|
||||||
|
|||||||
@ -11416,7 +11416,7 @@ const char* RobotoRegular_ttf = (const char*) temp_binary_data_6;
|
|||||||
//================== preset_menu_icon.svg ==================
|
//================== preset_menu_icon.svg ==================
|
||||||
static const unsigned char temp_binary_data_7[] =
|
static const unsigned char temp_binary_data_7[] =
|
||||||
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 30 30\" width=\"60px\" height=\"60px\"><path d=\"M 3 7 A 1.0001 1.0001 0 1 0 3 9 L 27 9 A 1.0001 1.0001 0 1 0 27 7 L 3 7 z M 3 14 A 1.0001 1.0001 0 1 0 3 16 L 27 16 A 1.0001 1.0001 0 1 0 27 14 "
|
"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 30 30\" width=\"60px\" height=\"60px\"><path d=\"M 3 7 A 1.0001 1.0001 0 1 0 3 9 L 27 9 A 1.0001 1.0001 0 1 0 27 7 L 3 7 z M 3 14 A 1.0001 1.0001 0 1 0 3 16 L 27 16 A 1.0001 1.0001 0 1 0 27 14 "
|
||||||
"L 3 14 z M 3 21 A 1.0001 1.0001 0 1 0 3 23 L 27 23 A 1.0001 1.0001 0 1 0 27 21 L 3 21 z\"/></svg>";
|
"L 3 14 z M 3 21 A 1.0001 1.0001 0 1 0 3 23 L 27 23 A 1.0001 1.0001 0 1 0 27 21 L 3 21 z\" fill=\"black\"/></svg>";
|
||||||
|
|
||||||
const char* preset_menu_icon_svg = (const char*) temp_binary_data_7;
|
const char* preset_menu_icon_svg = (const char*) temp_binary_data_7;
|
||||||
|
|
||||||
@ -11501,7 +11501,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)
|
|||||||
case 0xcbceafb3: numBytes = 24668; return OrbitronBold_ttf;
|
case 0xcbceafb3: numBytes = 24668; return OrbitronBold_ttf;
|
||||||
case 0x9c8232dc: numBytes = 24716; return OrbitronRegular_ttf;
|
case 0x9c8232dc: numBytes = 24716; return OrbitronRegular_ttf;
|
||||||
case 0x93fe9a1e: numBytes = 146004; return RobotoRegular_ttf;
|
case 0x93fe9a1e: numBytes = 146004; return RobotoRegular_ttf;
|
||||||
case 0x4df4bf1e: numBytes = 337; return preset_menu_icon_svg;
|
case 0x4df4bf1e: numBytes = 350; return preset_menu_icon_svg;
|
||||||
case 0xd842aaab: numBytes = 2478; return crystalize_button_active_icon_svg;
|
case 0xd842aaab: numBytes = 2478; return crystalize_button_active_icon_svg;
|
||||||
case 0x885a7642: numBytes = 2508; return crystalize_button_passive_icon_svg;
|
case 0x885a7642: numBytes = 2508; return crystalize_button_passive_icon_svg;
|
||||||
case 0xe49e0f15: numBytes = 406; return bypass_icon_svg;
|
case 0xe49e0f15: numBytes = 406; return bypass_icon_svg;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace BinaryData
|
|||||||
const int RobotoRegular_ttfSize = 146004;
|
const int RobotoRegular_ttfSize = 146004;
|
||||||
|
|
||||||
extern const char* preset_menu_icon_svg;
|
extern const char* preset_menu_icon_svg;
|
||||||
const int preset_menu_icon_svgSize = 337;
|
const int preset_menu_icon_svgSize = 350;
|
||||||
|
|
||||||
extern const char* crystalize_button_active_icon_svg;
|
extern const char* crystalize_button_active_icon_svg;
|
||||||
const int crystalize_button_active_icon_svgSize = 2478;
|
const int crystalize_button_active_icon_svgSize = 2478;
|
||||||
|
|||||||
@ -192,6 +192,7 @@ void CrystalizerEQAudioProcessorEditor::setupDisplayNames() {
|
|||||||
void CrystalizerEQAudioProcessorEditor::setupToggleButtons() {
|
void CrystalizerEQAudioProcessorEditor::setupToggleButtons() {
|
||||||
bypassButtonLookAndFeel = std::make_unique<Components::BypassButtonLookAndFeel>();
|
bypassButtonLookAndFeel = std::make_unique<Components::BypassButtonLookAndFeel>();
|
||||||
svgToggleButtonLookAndFeel = std::make_unique<Components::SvgToggleButtonLookAndFeel>();
|
svgToggleButtonLookAndFeel = std::make_unique<Components::SvgToggleButtonLookAndFeel>();
|
||||||
|
presetMenuButtonLookAndFeel = std::make_unique<Components::PresetMenuButtonLookAndFeel>();
|
||||||
|
|
||||||
peak1BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
|
peak1BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
|
||||||
peak2BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
|
peak2BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
|
||||||
@ -199,6 +200,7 @@ void CrystalizerEQAudioProcessorEditor::setupToggleButtons() {
|
|||||||
masterBypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
|
masterBypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
|
||||||
|
|
||||||
crystalizeButton.setLookAndFeel(svgToggleButtonLookAndFeel.get());
|
crystalizeButton.setLookAndFeel(svgToggleButtonLookAndFeel.get());
|
||||||
|
presetMenuButton.setLookAndFeel(presetMenuButtonLookAndFeel.get());
|
||||||
|
|
||||||
for (auto* b : {&peak1BypassButton, &peak2BypassButton, &peak3BypassButton, &crystalizeButton, &masterBypassButton}) {
|
for (auto* b : {&peak1BypassButton, &peak2BypassButton, &peak3BypassButton, &crystalizeButton, &masterBypassButton}) {
|
||||||
b->onClick = [this, b]() {
|
b->onClick = [this, b]() {
|
||||||
@ -601,7 +603,6 @@ void CrystalizerEQAudioProcessorEditor::initPresetSystem() {
|
|||||||
presetBox.setSelectedId(1, juce::dontSendNotification);
|
presetBox.setSelectedId(1, juce::dontSendNotification);
|
||||||
|
|
||||||
presetMenuButton.setName("PresetMenuButton");
|
presetMenuButton.setName("PresetMenuButton");
|
||||||
presetMenuButton.setButtonText("Preset Menu");
|
|
||||||
presetMenuButton.setColour (juce::ToggleButton::textColourId, juce::Colours::black);
|
presetMenuButton.setColour (juce::ToggleButton::textColourId, juce::Colours::black);
|
||||||
presetMenuButton.setColour(juce::ToggleButton::tickColourId, juce::Colours::black);
|
presetMenuButton.setColour(juce::ToggleButton::tickColourId, juce::Colours::black);
|
||||||
presetMenuButton.setToggleState(false, juce::dontSendNotification);
|
presetMenuButton.setToggleState(false, juce::dontSendNotification);
|
||||||
@ -668,6 +669,7 @@ CrystalizerEQAudioProcessorEditor::~CrystalizerEQAudioProcessorEditor() {
|
|||||||
peak3BypassButton.setLookAndFeel(nullptr);
|
peak3BypassButton.setLookAndFeel(nullptr);
|
||||||
masterBypassButton.setLookAndFeel(nullptr);
|
masterBypassButton.setLookAndFeel(nullptr);
|
||||||
crystalizeButton.setLookAndFeel(nullptr);
|
crystalizeButton.setLookAndFeel(nullptr);
|
||||||
|
presetMenuButton.setLookAndFeel(nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
//region paintAnalyzer
|
//region paintAnalyzer
|
||||||
@ -695,6 +697,55 @@ void CrystalizerEQAudioProcessorEditor::paint (juce::Graphics& g)
|
|||||||
g.fillAll (Colours::BACKGROUNDCOLOUR);
|
g.fillAll (Colours::BACKGROUNDCOLOUR);
|
||||||
g.setColour (AXIOM::DesignSystem::Colours::FOREGROUNDCOLOUR);
|
g.setColour (AXIOM::DesignSystem::Colours::FOREGROUNDCOLOUR);
|
||||||
|
|
||||||
|
|
||||||
|
const auto mP = getLocalArea(&mainPanel, mainPanel.getLocalBounds());
|
||||||
|
auto mPX = mP.getX();
|
||||||
|
auto mPY = mP.getY();
|
||||||
|
auto mPW = mP.getWidth();
|
||||||
|
auto mPH = mP.getHeight();
|
||||||
|
|
||||||
|
paintAnalyzer(g);
|
||||||
|
g.setColour(Colours::SURFACEBYPASS);
|
||||||
|
const auto hB = getLocalArea(&headerBar, headerBar.getLocalBounds());
|
||||||
|
auto hBX = hB.getX();
|
||||||
|
auto hBY = hB.getY();
|
||||||
|
auto hBW = hB.getWidth();
|
||||||
|
auto hBH = hB.getHeight();
|
||||||
|
auto hBPad = ((hBY + mPY) - hBH) / 2;
|
||||||
|
g.fillRect(hBX, hBY, hBW, mPY - hBPad);
|
||||||
|
paintBorderLines(g);
|
||||||
|
|
||||||
|
|
||||||
|
g.setColour(Colours::SURFACECOLOUR);
|
||||||
|
const auto pA = getLocalArea(&presetArea, presetArea.getLocalBounds());
|
||||||
|
auto pAX = pA.getX();
|
||||||
|
auto pAY = pA.getY();
|
||||||
|
auto pAWidth = pA.getWidth();
|
||||||
|
auto pAHeight = pA.getHeight();
|
||||||
|
g.fillRoundedRectangle(pAX, pAY - 10.f, pAWidth, pAHeight + 10.f, 10.0f);
|
||||||
|
paintBorderLines(g);
|
||||||
|
|
||||||
|
const auto fA = getLocalArea(&filterArea, filterArea.getLocalBounds());
|
||||||
|
const int fABorderWidth = 3;
|
||||||
|
auto fABorder = fA.withSizeKeepingCentre(fA.getWidth() + fABorderWidth, fA.getHeight() + fABorderWidth);
|
||||||
|
fABorder = fABorder.withX(fABorder.getX() + fABorderWidth).withY(fABorder.getY() + fABorderWidth);
|
||||||
|
|
||||||
|
|
||||||
|
g.setColour(Colours::SURFACECOLOUR);
|
||||||
|
g.fillRect(fABorder);
|
||||||
|
|
||||||
|
fABorder = fABorder.withX(fABorder.getX() - 2* fABorderWidth).withY(fABorder.getY() - 2 * fABorderWidth);
|
||||||
|
//g.setColour(Colours::FOREGROUNDBYPASS);
|
||||||
|
g.fillRect(fABorder);
|
||||||
|
|
||||||
|
g.setColour(Colours::BACKGROUNDBYPASS);
|
||||||
|
g.fillRect(fA);
|
||||||
|
paintBorderLines(g);
|
||||||
|
|
||||||
|
g.setColour(Colours::SURFACEBYPASS);
|
||||||
|
const auto fB = getLocalArea(&footerBar, footerBar.getLocalBounds());
|
||||||
|
g.fillRect(fB);
|
||||||
|
|
||||||
if constexpr (false) // -> auf false setzen, wenn nicht gebraucht
|
if constexpr (false) // -> auf false setzen, wenn nicht gebraucht
|
||||||
{
|
{
|
||||||
for (auto* c : getChildren()) // headerBar, mainPanel, footerBar
|
for (auto* c : getChildren()) // headerBar, mainPanel, footerBar
|
||||||
@ -819,51 +870,6 @@ void CrystalizerEQAudioProcessorEditor::paint (juce::Graphics& g)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
const auto mP = getLocalArea(&mainPanel, mainPanel.getLocalBounds());
|
|
||||||
auto mPX = mP.getX();
|
|
||||||
auto mPY = mP.getY();
|
|
||||||
auto mPW = mP.getWidth();
|
|
||||||
auto mPH = mP.getHeight();
|
|
||||||
|
|
||||||
paintAnalyzer(g);
|
|
||||||
g.setColour(Colours::SURFACEBYPASS);
|
|
||||||
const auto hB = getLocalArea(&headerBar, headerBar.getLocalBounds());
|
|
||||||
auto hBX = hB.getX();
|
|
||||||
auto hBY = hB.getY();
|
|
||||||
auto hBW = hB.getWidth();
|
|
||||||
auto hBH = hB.getHeight();
|
|
||||||
auto hBPad = ((hBY + mPY) - hBH) / 2;
|
|
||||||
g.fillRect(hBX, hBY, hBW, mPY - hBPad);
|
|
||||||
paintBorderLines(g);
|
|
||||||
|
|
||||||
|
|
||||||
g.setColour(Colours::SURFACECOLOUR);
|
|
||||||
const auto pA = getLocalArea(&presetArea, presetArea.getLocalBounds());
|
|
||||||
auto pAX = pA.getX();
|
|
||||||
auto pAY = pA.getY();
|
|
||||||
auto pAWidth = pA.getWidth();
|
|
||||||
auto pAHeight = pA.getHeight();
|
|
||||||
g.fillRoundedRectangle(pAX, pAY - 10.f, pAWidth, pAHeight + 10.f, 10.0f);
|
|
||||||
paintBorderLines(g);
|
|
||||||
|
|
||||||
const auto fA = getLocalArea(&filterArea, filterArea.getLocalBounds());
|
|
||||||
const int fABorderWidth = 3;
|
|
||||||
//TODO: BORDER OF FILTERAREA
|
|
||||||
auto fABorder = fA.withSizeKeepingCentre(fA.getWidth() + fABorderWidth, fA.getHeight() + fABorderWidth);
|
|
||||||
fABorder = fABorder.withX(fABorder.getX() + fABorderWidth).withY(fABorder.getY() + fABorderWidth);
|
|
||||||
|
|
||||||
|
|
||||||
g.setColour(Colours::SURFACECOLOUR);
|
|
||||||
g.fillRect(fABorder);
|
|
||||||
|
|
||||||
fABorder = fABorder.withX(fABorder.getX() - 2* fABorderWidth).withY(fABorder.getY() - 2 * fABorderWidth);
|
|
||||||
//g.setColour(Colours::FOREGROUNDBYPASS);
|
|
||||||
g.fillRect(fABorder);
|
|
||||||
|
|
||||||
g.setColour(Colours::BACKGROUNDBYPASS);
|
|
||||||
g.fillRect(fA);
|
|
||||||
paintBorderLines(g);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//region paintBorderLines
|
//region paintBorderLines
|
||||||
@ -1088,7 +1094,8 @@ void CrystalizerEQAudioProcessorEditor::setupHeader() {
|
|||||||
Layout::area(presetBox, 2, 2, 3, 3),
|
Layout::area(presetBox, 2, 2, 3, 3),
|
||||||
Layout::area(resetButton, 2, 1, 2, 2),
|
Layout::area(resetButton, 2, 1, 2, 2),
|
||||||
// Menütaste unten rechts (row2, col2)
|
// Menütaste unten rechts (row2, col2)
|
||||||
Layout::area(presetMenuButton, 2, 3, 3, 4),
|
Layout::area(presetMenuButton, 2, 3, 3, 4)
|
||||||
|
,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -253,8 +253,11 @@ private:
|
|||||||
std::unique_ptr<DesignSystem::Components::FreqQSliderLookAndFeel> freqQLookAndFeel;
|
std::unique_ptr<DesignSystem::Components::FreqQSliderLookAndFeel> freqQLookAndFeel;
|
||||||
std::unique_ptr<DesignSystem::Components::GlobalSliderLookAndFeel> globalLookAndFeel;
|
std::unique_ptr<DesignSystem::Components::GlobalSliderLookAndFeel> globalLookAndFeel;
|
||||||
std::unique_ptr<Components::BypassButtonLookAndFeel> bypassButtonLookAndFeel;
|
std::unique_ptr<Components::BypassButtonLookAndFeel> bypassButtonLookAndFeel;
|
||||||
|
std::unique_ptr<Components::PresetMenuButtonLookAndFeel> presetMenuButtonLookAndFeel;
|
||||||
|
|
||||||
std::unique_ptr<Components::SvgToggleButtonLookAndFeel> svgToggleButtonLookAndFeel;
|
std::unique_ptr<Components::SvgToggleButtonLookAndFeel> svgToggleButtonLookAndFeel;
|
||||||
|
|
||||||
|
|
||||||
//SPECRTRUM ANALYZER
|
//SPECRTRUM ANALYZER
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user