Skip to content

Commit

Permalink
Added update when something in the Stylesheet changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ffAudio committed Jul 7, 2023
1 parent 5bf8576 commit 40d021e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Layout/foleys_RootItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ void RootItem::updateColours()
auto outline = magicBuilder.getStyleProperty (IDs::tooltipOutline, configNode);
if (! outline.isVoid())
tooltip.getLookAndFeel().setColour (juce::TooltipWindow::outlineColourId, Stylesheet::parseColour (outline));

for (const auto& child : *this)
child->updateColours();
}


Expand Down
16 changes: 14 additions & 2 deletions Layout/foleys_Stylesheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ namespace foleys
Stylesheet::Stylesheet (MagicGUIBuilder& builderToUse) : builder (builderToUse)
{
setColourPalette();

currentStyle.addListener(this);
currentPalette.addListener(this);
}

Stylesheet::~Stylesheet()
{
currentStyle.removeListener(this);
currentPalette.removeListener(this);
}

void Stylesheet::setStyle (const juce::ValueTree& node)
Expand Down Expand Up @@ -99,9 +108,12 @@ juce::ValueTree Stylesheet::getCurrentPalette()
return currentPalette;
}

void Stylesheet::valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier&)
void Stylesheet::valueTreePropertyChanged (juce::ValueTree&, const juce::Identifier& name)
{
builder.updateColours();
if (name.toString().contains("color"))
builder.updateColours();
else
builder.updateComponents();
}

void Stylesheet::updateValidRanges()
Expand Down
1 change: 1 addition & 0 deletions Layout/foleys_Stylesheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Stylesheet : private juce::ValueTree::Listener
public:

Stylesheet (MagicGUIBuilder& builder);
~Stylesheet() override;

/**
The Stylesheet node in the XML can contain several Styles to select from.
Expand Down
1 change: 1 addition & 0 deletions VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PluginGuiMagic - Versions history
- Allow setting of Tab-Bar height
- Add a property "tab-selected" to connect to a property in the state
- Avoid update feedback loop in RadioButtonManager
- Added update when something in the Stylesheet changes

1.3.8 - 31.10.2022
------------------
Expand Down

0 comments on commit 40d021e

Please sign in to comment.