Fixed icon colour on masterbypass bug.

Added Crystalize button feature with changing opacity based on 2 .svgs.
Added a border to filterarea.
Added margin to analyzer area.
This commit is contained in:
Legaeli 2025-11-07 22:47:30 +01:00
parent 56ea97916d
commit ad58381614
8 changed files with 266 additions and 26 deletions

View File

@ -534,12 +534,16 @@ namespace AXIOM {
svgXml = juce::XmlDocument::parse(BinaryData::bypass_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()) * 0.5f;
auto hoverFactor = isHovered ? 1.05f : 1.0f;
@ -547,15 +551,19 @@ namespace AXIOM {
auto iconBounds = juce::Rectangle<float>(iconSize * hoverFactor, iconSize * hoverFactor)
.withCentre(bounds.getCentre());
float bypassOpacity = 1.0f;
if (svgXml != nullptr) {
// WICHTIG: Erstelle für jeden Frame ein NEUES Drawable!
auto icon = juce::Drawable::createFromSVG(*svgXml);
//TODO ON MASTERBYPASS SET TO HOVER COLOUR
if (icon != nullptr)
{
juce::Colour colour;
if (isHovered) {
if (!isEnabled) {
colour = isToggled ? Colours::SURFACEBYPASS : Colours::ACCENTWEAKCOLOUR;
}
else if (isHovered) {
colour = isToggled ? Colours::SURFACEHOVER : Colours::ACCENTHOVER;
} else {
colour = isToggled
@ -563,10 +571,11 @@ namespace AXIOM {
: Colours::ACCENTCOLOUR;
}
// Icon zeichnen
icon->replaceColour(juce::Colours::black, colour);
icon->drawWithin(g, iconBounds,
juce::RectanglePlacement::centred, 1.0f);
juce::RectanglePlacement::centred, bypassOpacity);
}
}
}
@ -575,6 +584,49 @@ namespace AXIOM {
std::unique_ptr<juce::XmlElement> svgXml;
};
class SvgToggleButtonLookAndFeel : public juce::LookAndFeel_V4 {
public:
SvgToggleButtonLookAndFeel() {
passiveSvg = juce::XmlDocument::parse(BinaryData::crystalize_button_passive_icon_svg);
activeSvg = juce::XmlDocument::parse(BinaryData::crystalize_button_active_icon_svg);
};
float passiveIconOpacity = 1.0f;
float activeIconOpacity = 0.0f;
void drawToggleButton(juce::Graphics& g, juce::ToggleButton& button,
bool shouldDrawButtonAsHighlighted,
bool shouldDrawButtonAsDown) override {
const bool isHovered = button.isMouseOverOrDragging();
const bool isToggled = button.getToggleState();
auto bounds = button.getLocalBounds().toFloat();
auto iconSize = juce::jmin(bounds.getWidth(), bounds.getHeight()) * 0.5f;
auto hoverFactor = isHovered ? 1.05f : 1.0f;
auto iconBounds = juce::Rectangle<float>(iconSize * hoverFactor, iconSize * hoverFactor)
.withCentre(bounds.getCentre());
auto passiveIcon = juce::Drawable::createFromSVG(*passiveSvg);
auto activeIcon = juce::Drawable::createFromSVG(*activeSvg);
if (passiveIcon != nullptr && activeIcon != nullptr) {
activeIcon->drawWithin(g, iconBounds,
juce::RectanglePlacement::centred, activeIconOpacity);
passiveIcon->drawWithin(g, iconBounds,
juce::RectanglePlacement::centred, passiveIconOpacity);
}
}
private:
std::unique_ptr<juce::XmlElement> passiveSvg;
std::unique_ptr<juce::XmlElement> activeSvg;
};
struct ButtonStyles {
};

View File

@ -164,6 +164,9 @@
<None Include="..\..\Resources\Fonts\Orbitron-Bold.ttf"/>
<None Include="..\..\Resources\Fonts\Orbitron-Regular.ttf"/>
<None Include="..\..\Resources\Fonts\Roboto-Regular.ttf"/>
<None Include="..\..\Resources\Icons\preset_menu_icon.svg"/>
<None Include="..\..\Resources\Icons\crystalize_button_active_icon.svg"/>
<None Include="..\..\Resources\Icons\crystalize_button_passive_icon.svg"/>
<None Include="..\..\Resources\Icons\bypass_icon.svg"/>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>

View File

@ -74,6 +74,15 @@
<None Include="..\..\Resources\Fonts\Roboto-Regular.ttf">
<Filter>CrystalizerEQ\Resources\Fonts</Filter>
</None>
<None Include="..\..\Resources\Icons\preset_menu_icon.svg">
<Filter>CrystalizerEQ\Resources\Icons</Filter>
</None>
<None Include="..\..\Resources\Icons\crystalize_button_active_icon.svg">
<Filter>CrystalizerEQ\Resources\Icons</Filter>
</None>
<None Include="..\..\Resources\Icons\crystalize_button_passive_icon.svg">
<Filter>CrystalizerEQ\Resources\Icons</Filter>
</None>
<None Include="..\..\Resources\Icons\bypass_icon.svg">
<Filter>CrystalizerEQ\Resources\Icons</Filter>
</None>

View File

@ -21,6 +21,12 @@
file="Resources/Fonts/Roboto-Regular.ttf"/>
</GROUP>
<GROUP id="{3DCFA257-AECE-2625-016F-D02D71FFA24B}" name="Icons">
<FILE id="MWCD1t" name="preset_menu_icon.svg" compile="0" resource="1"
file="Resources/Icons/preset_menu_icon.svg"/>
<FILE id="cp2JDP" name="crystalize_button_active_icon.svg" compile="0"
resource="1" file="Resources/Icons/crystalize_button_active_icon.svg"/>
<FILE id="ROk8co" name="crystalize_button_passive_icon.svg" compile="0"
resource="1" file="Resources/Icons/crystalize_button_passive_icon.svg"/>
<FILE id="wKb70q" name="bypass_icon.svg" compile="0" resource="1" file="Resources/Icons/bypass_icon.svg"/>
</GROUP>
</GROUP>

View File

@ -11413,15 +11413,74 @@ static const unsigned char temp_binary_data_6[] =
const char* RobotoRegular_ttf = (const char*) temp_binary_data_6;
//================== bypass_icon.svg ==================
//================== preset_menu_icon.svg ==================
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 "
"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>";
const char* preset_menu_icon_svg = (const char*) temp_binary_data_7;
//================== crystalize_button_active_icon.svg ==================
static const unsigned char temp_binary_data_8[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<svg id=\"Ebene_1\" data-name=\"Ebene 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 32\">\n"
" <rect width=\"64\" height=\"32\" rx=\"5.96\" ry=\"5.96\" fill=\"#00f9ff\"/>\n"
" <g>\n"
" <path d=\"M3.73,18.88c-.18,0-.34-.04-.48-.13-.15-.09-.26-.2-.35-.35-.09-.15-.13-.31-.13-.48v-3.84c0-.18.04-.34.13-.48.08-.15.2-.26.35-.35.15-.09.31-.13.48-.13h4.78v.65H3.73c-.09,0-.16.03-.22.09s-.09.13-.09.22v3.84c0,.09.03.16.09.22.06.06.13.09.22"
".09h4.78v.65H3.73Z\" fill=\"#fff\"/>\n"
" <path d=\"M9.34,18.88v-5.75h4.8c.18,0,.34.04.48.13s.26.2.35.35c.08.14.13.3.13.48v1.69c0,.18-.04.34-.13.48-.09.14-.2.26-.35.35s-.31.13-.48.13h-4.15v2.14h-.65ZM10.3,16.08h3.84c.08,0,.16-.03.22-.09.06-.06.09-.13.09-.22v-1.69c0-.09-.03-.16-.09-.22s-."
"13-.09-.22-.09h-3.84c-.09,0-.16.03-.22.09s-.09.13-.09.22v1.69c0,.09.03.16.09.22.06.06.13.09.22.09ZM14.21,18.88l-1.88-2.24h.85l1.89,2.23h0s-.86,0-.86,0Z\" fill=\"#fff\"/>\n"
" <path d=\"M18.4,18.88v-2.17l-2.65-3.59h.74l2.23,2.82,2.21-2.82h.76l-2.65,3.59v2.17h-.65Z\" fill=\"#fff\"/>\n"
" <path d=\"M23.03,18.88c-.18,0-.34-.04-.48-.13s-.26-.2-.35-.35c-.09-.15-.13-.31-.13-.48v-.22h.65v.22c0,.09.03.16.09.22.06.06.13.09.22.09h3.84c.08,0,.16-.03.22-.09.06-.06.09-.13.09-.22v-1.29c0-.08-.03-.16-.09-.22-.06-.06-.13-.09-.22-.09h-3.84c-.18,"
"0-.34-.04-.48-.13s-.26-.2-.35-.35c-.09-.14-.13-.3-.13-.48v-1.29c0-.18.04-.34.13-.48.08-.15.2-.26.35-.35s.31-.13.48-.13h3.84c.18,0,.34.04.48.13.15.09.26.2.35.35.08.15.13.31.13.48v.22h-.65v-.22c0-.09-.03-.16-.09-.22-.06-.06-.13-.09-.22-.09h-3.84c-.09,0"
"-.16.03-.22.09-.06.06-.09.13-.09.22v1.29c0,.09.03.16.09.22s.13.09.22.09h3.84c.18,0,.34.04.48.13.15.09.26.2.35.35.08.14.13.3.13.48v1.29c0,.18-.04.34-.13.48-.09.15-.2.26-.35.35-.15.09-.31.13-.48.13h-3.84Z\" fill=\"#fff\"/>\n"
" <path d=\"M30.96,18.88v-5.11h-2.56v-.65h5.76v.65h-2.55v5.11h-.65Z\" fill=\"#fff\"/>\n"
" <path d=\"M34.78,14.08c0-.18.04-.34.13-.48.09-.15.2-.26.35-.35.15-.09.31-.13.48-.13h3.84c.18,0,.34.04.48.13s.26.2.35.35c.09.15.13.31.13.48v4.8h-.65v-2.1h-4.46v2.1h-.65v-4.8ZM39.89,16.13v-2.05c0-.09-.03-.16-.09-.22-.06-.06-.13-.09-.22-.09h-3.84c-."
"08,0-.16.03-.22.09-.06.06-.09.13-.09.22v2.05h4.46Z\" fill=\"#fff\"/>\n"
" <path d=\"M41.46,18.88v-5.77h.65v5.12h5.11v.65h-5.76Z\" fill=\"#fff\"/>\n"
" <path d=\"M47.76,18.88v-5.76h.66v5.76h-.66Z\" fill=\"#fff\"/>\n"
" <path d=\"M49.35,18.88v-.89l5.02-4.22h-5.02v-.65h5.76v.89l-5.02,4.22h5.02v.65h-5.76Z\" fill=\"#fff\"/>\n"
" <path d=\"M55.98,18.88v-5.76h5.26v.65h-4.61v1.9h3.7v.66h-3.7v1.9h4.61v.65h-5.26Z\" fill=\"#fff\"/>\n"
" </g>\n"
"</svg>";
const char* crystalize_button_active_icon_svg = (const char*) temp_binary_data_8;
//================== crystalize_button_passive_icon.svg ==================
static const unsigned char temp_binary_data_9[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<svg id=\"Ebene_2\" data-name=\"Ebene 2\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 32\">\n"
" <rect width=\"64\" height=\"32\" rx=\"5.96\" ry=\"5.96\" fill=\"#13009b\"/>\n"
" <g>\n"
" <path d=\"M3.73,18.88c-.18,0-.34-.04-.48-.13-.15-.09-.26-.2-.35-.35-.09-.15-.13-.31-.13-.48v-3.84c0-.18.04-.34.13-.48.08-.15.2-.26.35-.35.15-.09.31-.13.48-.13h4.78v.65H3.73c-.09,0-.16.03-.22.09s-.09.13-.09.22v3.84c0,.09.03.16.09.22.06.06.13.09.22"
".09h4.78v.65H3.73Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M9.34,18.88v-5.75h4.8c.18,0,.34.04.48.13s.26.2.35.35c.08.14.13.3.13.48v1.69c0,.18-.04.34-.13.48-.09.14-.2.26-.35.35s-.31.13-.48.13h-4.15v2.14h-.65ZM10.3,16.08h3.84c.08,0,.16-.03.22-.09.06-.06.09-.13.09-.22v-1.69c0-.09-.03-.16-.09-.22s-."
"13-.09-.22-.09h-3.84c-.09,0-.16.03-.22.09s-.09.13-.09.22v1.69c0,.09.03.16.09.22.06.06.13.09.22.09ZM14.21,18.88l-1.88-2.24h.85l1.89,2.23h0s-.86,0-.86,0Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M18.4,18.88v-2.17l-2.65-3.59h.74l2.23,2.82,2.21-2.82h.76l-2.65,3.59v2.17h-.65Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M23.03,18.88c-.18,0-.34-.04-.48-.13s-.26-.2-.35-.35c-.09-.15-.13-.31-.13-.48v-.22h.65v.22c0,.09.03.16.09.22.06.06.13.09.22.09h3.84c.08,0,.16-.03.22-.09.06-.06.09-.13.09-.22v-1.29c0-.08-.03-.16-.09-.22-.06-.06-.13-.09-.22-.09h-3.84c-.18,"
"0-.34-.04-.48-.13s-.26-.2-.35-.35c-.09-.14-.13-.3-.13-.48v-1.29c0-.18.04-.34.13-.48.08-.15.2-.26.35-.35s.31-.13.48-.13h3.84c.18,0,.34.04.48.13.15.09.26.2.35.35.08.15.13.31.13.48v.22h-.65v-.22c0-.09-.03-.16-.09-.22-.06-.06-.13-.09-.22-.09h-3.84c-.09,0"
"-.16.03-.22.09-.06.06-.09.13-.09.22v1.29c0,.09.03.16.09.22s.13.09.22.09h3.84c.18,0,.34.04.48.13.15.09.26.2.35.35.08.14.13.3.13.48v1.29c0,.18-.04.34-.13.48-.09.15-.2.26-.35.35-.15.09-.31.13-.48.13h-3.84Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M30.96,18.88v-5.11h-2.56v-.65h5.76v.65h-2.55v5.11h-.65Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M34.78,14.08c0-.18.04-.34.13-.48.09-.15.2-.26.35-.35.15-.09.31-.13.48-.13h3.84c.18,0,.34.04.48.13s.26.2.35.35c.09.15.13.31.13.48v4.8h-.65v-2.1h-4.46v2.1h-.65v-4.8ZM39.89,16.13v-2.05c0-.09-.03-.16-.09-.22-.06-.06-.13-.09-.22-.09h-3.84c-."
"08,0-.16.03-.22.09-.06.06-.09.13-.09.22v2.05h4.46Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M41.46,18.88v-5.77h.65v5.12h5.11v.65h-5.76Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M47.76,18.88v-5.76h.66v5.76h-.66Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M49.35,18.88v-.89l5.02-4.22h-5.02v-.65h5.76v.89l-5.02,4.22h5.02v.65h-5.76Z\" fill=\"#4c4c4c\"/>\n"
" <path d=\"M55.98,18.88v-5.76h5.26v.65h-4.61v1.9h3.7v.66h-3.7v1.9h4.61v.65h-5.26Z\" fill=\"#4c4c4c\"/>\n"
" </g>\n"
"</svg>";
const char* crystalize_button_passive_icon_svg = (const char*) temp_binary_data_9;
//================== bypass_icon.svg ==================
static const unsigned char temp_binary_data_10[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<svg id=\"Ebene_1\" data-name=\"Ebene 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 22 23\">\n"
" <rect x=\"10\" width=\"2\" height=\"12\"/>\n"
" <path d=\"M13,1.19v1.87c4.1.91,7.17,4.57,7.17,8.94,0,5.06-4.1,9.17-9.17,9.17S1.83,17.06,1.83,12C1.83,7.63,4.9,3.97,9,3.06v-1.87C3.88,2.13,0,6.61,0,12c0,6.08,4.92,11,11,11s11-4.92,11-11c0-5.39-3.88-9.87-9-10.81Z\" fill=\"black\"/>\n"
"</svg>";
const char* bypass_icon_svg = (const char*) temp_binary_data_7;
const char* bypass_icon_svg = (const char*) temp_binary_data_10;
const char* getNamedResource (const char* resourceNameUTF8, int& numBytes);
@ -11442,6 +11501,9 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)
case 0xcbceafb3: numBytes = 24668; return OrbitronBold_ttf;
case 0x9c8232dc: numBytes = 24716; return OrbitronRegular_ttf;
case 0x93fe9a1e: numBytes = 146004; return RobotoRegular_ttf;
case 0x4df4bf1e: numBytes = 337; return preset_menu_icon_svg;
case 0xd842aaab: numBytes = 2478; return crystalize_button_active_icon_svg;
case 0x885a7642: numBytes = 2508; return crystalize_button_passive_icon_svg;
case 0xe49e0f15: numBytes = 406; return bypass_icon_svg;
default: break;
}
@ -11459,6 +11521,9 @@ const char* namedResourceList[] =
"OrbitronBold_ttf",
"OrbitronRegular_ttf",
"RobotoRegular_ttf",
"preset_menu_icon_svg",
"crystalize_button_active_icon_svg",
"crystalize_button_passive_icon_svg",
"bypass_icon_svg"
};
@ -11471,6 +11536,9 @@ const char* originalFilenames[] =
"Orbitron-Bold.ttf",
"Orbitron-Regular.ttf",
"Roboto-Regular.ttf",
"preset_menu_icon.svg",
"crystalize_button_active_icon.svg",
"crystalize_button_passive_icon.svg",
"bypass_icon.svg"
};

View File

@ -29,11 +29,20 @@ namespace BinaryData
extern const char* RobotoRegular_ttf;
const int RobotoRegular_ttfSize = 146004;
extern const char* preset_menu_icon_svg;
const int preset_menu_icon_svgSize = 337;
extern const char* crystalize_button_active_icon_svg;
const int crystalize_button_active_icon_svgSize = 2478;
extern const char* crystalize_button_passive_icon_svg;
const int crystalize_button_passive_icon_svgSize = 2508;
extern const char* bypass_icon_svg;
const int bypass_icon_svgSize = 406;
// Number of elements in the namedResourceList and originalFileNames arrays.
const int namedResourceListSize = 8;
const int namedResourceListSize = 11;
// Points to the start of a list of resource names.
extern const char* namedResourceList[];

View File

@ -173,7 +173,6 @@ void CrystalizerEQAudioProcessorEditor::setupDisplayNames() {
testNoiseButton.setButtonText("Test Noise");
crystalizeButton.setName("CrystalizeButton");
crystalizeButton.setButtonText("Crystalize");
resetButton.setName("ResetButton");
resetButton.setButtonText("Reset");
@ -191,6 +190,16 @@ void CrystalizerEQAudioProcessorEditor::setupDisplayNames() {
//region setupToggleButtons
void CrystalizerEQAudioProcessorEditor::setupToggleButtons() {
bypassButtonLookAndFeel = std::make_unique<Components::BypassButtonLookAndFeel>();
svgToggleButtonLookAndFeel = std::make_unique<Components::SvgToggleButtonLookAndFeel>();
peak1BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
peak2BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
peak3BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
masterBypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
crystalizeButton.setLookAndFeel(svgToggleButtonLookAndFeel.get());
for (auto* b : {&peak1BypassButton, &peak2BypassButton, &peak3BypassButton, &crystalizeButton, &masterBypassButton}) {
b->onClick = [this, b]() {
juce::String paramID; // nimm juce::String statt std::string
@ -215,10 +224,6 @@ void CrystalizerEQAudioProcessorEditor::setupToggleButtons() {
mode = "Master";
}
b->setColour(juce::ToggleButton::textColourId, juce::Colours::black);
b->setColour(juce::ToggleButton::tickColourId, juce::Colours::black);
if (auto* param = audioProcessor.apvts.getParameter(paramID))
{
const bool isToggled = b->getToggleState();
@ -237,14 +242,15 @@ void CrystalizerEQAudioProcessorEditor::setupToggleButtons() {
else if (mode == "High-Mid") disableHighMidBand(target);
else if (mode == "Master") disableEverything(target);
}
if (b == &crystalizeButton) {
isAnimatingCrystalize = true;
isFadingToActive = (svgToggleButtonLookAndFeel->activeIconOpacity < 1.0f);
}
};
}
bypassButtonLookAndFeel = std::make_unique<Components::BypassButtonLookAndFeel>();
peak1BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
peak2BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
peak3BypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
masterBypassButton.setLookAndFeel(bypassButtonLookAndFeel.get());
}
//endregion setupToggleButtons
@ -329,6 +335,27 @@ void CrystalizerEQAudioProcessorEditor::disableEverything(const float target) {
crystalizeButton.setEnabled(isToggled);
lowBandModeBox.setEnabled(isToggled);
highBandModeBox.setEnabled(isToggled);
if (!isToggled) {
if (svgToggleButtonLookAndFeel->activeIconOpacity == 1.0f) {
svgToggleButtonLookAndFeel->activeIconOpacity = 0.7f;
crystalizeButton.repaint();
}else if (svgToggleButtonLookAndFeel->passiveIconOpacity == 1.0f) {
svgToggleButtonLookAndFeel->passiveIconOpacity = 0.7f;
crystalizeButton.repaint();
}
} else {
if (svgToggleButtonLookAndFeel->activeIconOpacity == 0.7f) {
svgToggleButtonLookAndFeel->activeIconOpacity = 1.0f;
crystalizeButton.repaint();
}else if (svgToggleButtonLookAndFeel->passiveIconOpacity == 0.7f) {
svgToggleButtonLookAndFeel->passiveIconOpacity = 1.0f;
crystalizeButton.repaint();
}
}
}
//endregion disableEverything
@ -560,6 +587,10 @@ void CrystalizerEQAudioProcessorEditor::setupEventListeners() {
resetAllCheckboxes();
presetBox.setSelectedId(1, juce::dontSendNotification);
};
}
//endregion setupEventListeners
@ -636,6 +667,7 @@ CrystalizerEQAudioProcessorEditor::~CrystalizerEQAudioProcessorEditor() {
peak2BypassButton.setLookAndFeel(nullptr);
peak3BypassButton.setLookAndFeel(nullptr);
masterBypassButton.setLookAndFeel(nullptr);
crystalizeButton.setLookAndFeel(nullptr);
};
//region paintAnalyzer
@ -814,8 +846,21 @@ void CrystalizerEQAudioProcessorEditor::paint (juce::Graphics& g)
g.fillRoundedRectangle(pAX, pAY - 10.f, pAWidth, pAHeight + 10.f, 10.0f);
paintBorderLines(g);
g.setColour(Colours::BACKGROUNDBYPASS);
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);
@ -823,6 +868,7 @@ void CrystalizerEQAudioProcessorEditor::paint (juce::Graphics& g)
//region paintBorderLines
void CrystalizerEQAudioProcessorEditor::paintBorderLines(juce::Graphics &g) {
//TODO: BRODER LINES DONT ALIGN WITH MARGIN FROM ANALYZERAREA AND FILTERAREA
g.setColour(DesignSystem::Colours::BACKGROUNDCOLOUR);
auto prevRight = (float) lowFilterArea.getRight();
@ -885,6 +931,40 @@ void CrystalizerEQAudioProcessorEditor::setKnobVisibility() {
}
//endregion setKnobVisibility
//region animateCrystalizeButton
void CrystalizerEQAudioProcessorEditor::animateCrystalizeButton() {
if (isAnimatingCrystalize) {
const float step = 0.1f;
if (isFadingToActive)
{
svgToggleButtonLookAndFeel->activeIconOpacity += step;
svgToggleButtonLookAndFeel->passiveIconOpacity -= step;
if (svgToggleButtonLookAndFeel->activeIconOpacity >= 1.0f)
{
svgToggleButtonLookAndFeel->activeIconOpacity = 1.0f;
svgToggleButtonLookAndFeel->passiveIconOpacity = 0.0f;
isAnimatingCrystalize = false;
}
}
else
{
svgToggleButtonLookAndFeel->activeIconOpacity -= step;
svgToggleButtonLookAndFeel->passiveIconOpacity += step;
if (svgToggleButtonLookAndFeel->passiveIconOpacity >= 1.0f)
{
svgToggleButtonLookAndFeel->activeIconOpacity = 0.0f;
svgToggleButtonLookAndFeel->passiveIconOpacity = 1.0f;
isAnimatingCrystalize = false;
}
}
crystalizeButton.repaint();
}
}
//endregion animateCrystalizeButton
//region timerCallback
void CrystalizerEQAudioProcessorEditor::timerCallback()
{
@ -892,6 +972,7 @@ void CrystalizerEQAudioProcessorEditor::timerCallback()
spectrumAnalyzer.processSamples();
repaint(analyzerRect);
resized();
animateCrystalizeButton();
}
//endregion timerCallback
@ -1022,6 +1103,7 @@ void CrystalizerEQAudioProcessorEditor::setupBody() {
const auto bodyHeight = static_cast<float>(bounds.getHeight());
const auto bodyWidth = static_cast<float>(bounds.getWidth());
const auto bodyColWidth = bodyWidth / 5.0f;
const int margin = 15;
Layout::GridSpec bodySpec{
/* cols */ { Layout::fr(1), Layout::pxTrack(bodyColWidth), Layout::pxTrack(bodyColWidth), Layout::pxTrack(bodyColWidth), Layout::fr(1) },
@ -1031,9 +1113,12 @@ void CrystalizerEQAudioProcessorEditor::setupBody() {
/* pad */ Layout::padding(Spacing::SizeMode::XS)
};
Layout::grid(bounds, bodySpec, {
Layout::area(analyzerArea, 1, 2, 2, 5),
Layout::area(analyzerArea, 1, 2, 2, 5)
.withMargin(juce::GridItem::Margin(margin, 0, margin, 0)),
Layout::area(crystalizeButton, 1, 5, 2, 6),
Layout::area(filterArea, 2, 1, 3, 6)
.withMargin(juce::GridItem::Margin(0, margin, 0, margin))
});
const auto analyzerAreaBounds = analyzerArea.getLocalBounds();

View File

@ -144,13 +144,6 @@ public:
void resized() override;
void resetAllCheckboxes();
private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
CrystalizerEQAudioProcessor& audioProcessor;
using SliderAttach = juce::AudioProcessorValueTreeState::SliderAttachment;
using ButtonAttach = juce::AudioProcessorValueTreeState::ButtonAttachment;
@ -210,7 +203,20 @@ private:
juce::TextEditor presetNameInput;
private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
CrystalizerEQAudioProcessor& audioProcessor;
void setKnobVisibility();
void animateCrystalizeButton();
void setupModeBoxes();
void setupSliders();
@ -247,6 +253,7 @@ private:
std::unique_ptr<DesignSystem::Components::FreqQSliderLookAndFeel> freqQLookAndFeel;
std::unique_ptr<DesignSystem::Components::GlobalSliderLookAndFeel> globalLookAndFeel;
std::unique_ptr<Components::BypassButtonLookAndFeel> bypassButtonLookAndFeel;
std::unique_ptr<Components::SvgToggleButtonLookAndFeel> svgToggleButtonLookAndFeel;
//SPECRTRUM ANALYZER
@ -299,7 +306,8 @@ private:
const float slopeMod = SliderStyles::Size::getSliderSizeMod(SliderStyles::Size::SizeMode::Slope);
const float globalMod = SliderStyles::Size::getSliderSizeMod(SliderStyles::Size::SizeMode::Global);
bool isAnimatingCrystalize = false;
bool isFadingToActive = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CrystalizerEQAudioProcessorEditor)
};