Fixed bypass icon colour bug, added hoverfactor and removed text.
This commit is contained in:
parent
9cdaf6bb8a
commit
56ea97916d
@ -530,48 +530,49 @@ namespace AXIOM {
|
|||||||
class BypassButtonLookAndFeel : public juce::LookAndFeel_V4 {
|
class BypassButtonLookAndFeel : public juce::LookAndFeel_V4 {
|
||||||
public:
|
public:
|
||||||
BypassButtonLookAndFeel()
|
BypassButtonLookAndFeel()
|
||||||
|
|
||||||
{
|
{
|
||||||
// SVG aus BinaryData laden
|
svgXml = juce::XmlDocument::parse(BinaryData::bypass_icon_svg);
|
||||||
if (auto svgData = juce::XmlDocument::parse(
|
|
||||||
BinaryData::bypass_icon_svg)) // Dein Dateiname ohne Extension
|
|
||||||
{
|
|
||||||
bypassIcon = juce::Drawable::createFromSVG(*svgData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawToggleButton(juce::Graphics& g, juce::ToggleButton& button,
|
void drawToggleButton(juce::Graphics& g, juce::ToggleButton& button,
|
||||||
bool shouldDrawButtonAsHighlighted,
|
bool shouldDrawButtonAsHighlighted,
|
||||||
bool shouldDrawButtonAsDown) override
|
bool shouldDrawButtonAsDown) override
|
||||||
{
|
{
|
||||||
|
bool isHovered = button.isMouseOverOrDragging();
|
||||||
|
bool isToggled = button.getToggleState();
|
||||||
auto bounds = button.getLocalBounds().toFloat();
|
auto bounds = button.getLocalBounds().toFloat();
|
||||||
auto iconSize = juce::jmin(bounds.getWidth(), bounds.getHeight()) * 0.5f;
|
auto iconSize = juce::jmin(bounds.getWidth(), bounds.getHeight()) * 0.5f;
|
||||||
|
auto hoverFactor = isHovered ? 1.05f : 1.0f;
|
||||||
|
|
||||||
// Icon-Bereich (links vom Text)
|
auto iconBounds = juce::Rectangle<float>(iconSize * hoverFactor, iconSize * hoverFactor)
|
||||||
auto iconBounds = bounds.removeFromLeft(iconSize).reduced(4.0f);
|
.withCentre(bounds.getCentre());
|
||||||
//TODO ERKENNT TOGGLESTATE NICHT; FARBE ÄNDERT SICH NICHT.
|
|
||||||
if (bypassIcon != nullptr)
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
// Farbe basierend auf Toggle-Status
|
juce::Colour colour;
|
||||||
auto colour = button.getToggleState()
|
if (isHovered) {
|
||||||
? Colours::ACCENTCOLOUR
|
colour = isToggled ? Colours::SURFACEHOVER : Colours::ACCENTHOVER;
|
||||||
: Colours::SURFACECOLOUR;
|
} else {
|
||||||
|
colour = isToggled
|
||||||
// Icon zeichnen
|
? Colours::SURFACECOLOUR
|
||||||
bypassIcon->replaceColour(juce::Colours::black, colour);
|
: Colours::ACCENTCOLOUR;
|
||||||
bypassIcon->drawWithin(g, iconBounds,
|
|
||||||
juce::RectanglePlacement::centred, 1.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text zeichnen
|
// Icon zeichnen
|
||||||
g.setColour(button.findColour(juce::ToggleButton::textColourId));
|
icon->replaceColour(juce::Colours::black, colour);
|
||||||
g.setFont(Typography::getFont(Typography::Style::Small));
|
icon->drawWithin(g, iconBounds,
|
||||||
g.drawText(button.getButtonText(), bounds,
|
juce::RectanglePlacement::centred, 1.0f);
|
||||||
juce::Justification::centredLeft, true);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<juce::Drawable> bypassIcon;
|
std::unique_ptr<juce::XmlElement> svgXml;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ButtonStyles {
|
struct ButtonStyles {
|
||||||
|
|||||||
@ -150,19 +150,16 @@ void CrystalizerEQAudioProcessorEditor::setupDisplayNames() {
|
|||||||
peak1GainSlider.setTextValueSuffix("\ndB");
|
peak1GainSlider.setTextValueSuffix("\ndB");
|
||||||
//peak1QSlider.setTextValueSuffix("\nQ");
|
//peak1QSlider.setTextValueSuffix("\nQ");
|
||||||
peak1BypassButton.setName("peak1Bypass");
|
peak1BypassButton.setName("peak1Bypass");
|
||||||
peak1BypassButton.setButtonText("Low-Mid Bypass");
|
|
||||||
|
|
||||||
//peak2FreqSlider.setTextValueSuffix("\nHz");
|
//peak2FreqSlider.setTextValueSuffix("\nHz");
|
||||||
peak2GainSlider.setTextValueSuffix("\ndB");
|
peak2GainSlider.setTextValueSuffix("\ndB");
|
||||||
//peak2QSlider.setTextValueSuffix("\nQ");
|
//peak2QSlider.setTextValueSuffix("\nQ");
|
||||||
peak2BypassButton.setName("peak2Bypass");
|
peak2BypassButton.setName("peak2Bypass");
|
||||||
peak2BypassButton.setButtonText("Mid Bypass");
|
|
||||||
|
|
||||||
//peak3FreqSlider.setTextValueSuffix("\nHz");
|
//peak3FreqSlider.setTextValueSuffix("\nHz");
|
||||||
peak3GainSlider.setTextValueSuffix("\ndB");
|
peak3GainSlider.setTextValueSuffix("\ndB");
|
||||||
//peak3QSlider.setTextValueSuffix("\nQ");
|
//peak3QSlider.setTextValueSuffix("\nQ");
|
||||||
peak3BypassButton.setName("peak3Bypass");
|
peak3BypassButton.setName("peak3Bypass");
|
||||||
peak3BypassButton.setButtonText("High-Mid Bypass");
|
|
||||||
|
|
||||||
//highBandFreqSlider.setTextValueSuffix ("\nHz");
|
//highBandFreqSlider.setTextValueSuffix ("\nHz");
|
||||||
highBandSlopeSlider.setTextValueSuffix ("\ndB/Oct");
|
highBandSlopeSlider.setTextValueSuffix ("\ndB/Oct");
|
||||||
@ -182,7 +179,6 @@ void CrystalizerEQAudioProcessorEditor::setupDisplayNames() {
|
|||||||
resetButton.setButtonText("Reset");
|
resetButton.setButtonText("Reset");
|
||||||
|
|
||||||
masterBypassButton.setName("MasterBypass");
|
masterBypassButton.setName("MasterBypass");
|
||||||
masterBypassButton.setButtonText("Master Bypass");
|
|
||||||
|
|
||||||
savePresetButton.setName("SavePresetButton");
|
savePresetButton.setName("SavePresetButton");
|
||||||
savePresetButton.setButtonText("Save Preset");
|
savePresetButton.setButtonText("Save Preset");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user