diff --git a/src/gui/SkinSupport.cpp b/src/gui/SkinSupport.cpp index 861bd3b995c..5ebd7c3c061 100644 --- a/src/gui/SkinSupport.cpp +++ b/src/gui/SkinSupport.cpp @@ -985,6 +985,7 @@ bool Skin::recursiveGroupParse(ControlGroup::ptr_t parent, TiXmlElement *control } controls.push_back(control); + sessionIds.insert(control->sessionid); parent->childControls.push_back(control); } else diff --git a/src/gui/SkinSupport.h b/src/gui/SkinSupport.h index 5a130011509..0041ef6c018 100644 --- a/src/gui/SkinSupport.h +++ b/src/gui/SkinSupport.h @@ -234,6 +234,12 @@ class Skin bool hasColor(const Surge::Skin::Color &col) const { return hasColor(col.name); } + std::unordered_set sessionIds; + bool containsControlWithSessionId(const Control::sessionid_t &sid) + { + return (sessionIds.find(sid) != sessionIds.end()); + } + Skin::Control::ptr_t controlForUIID(const std::string &ui_id) const { // FIXME don't be stupid like this of course @@ -261,6 +267,7 @@ class Skin res->copyFromConnector(c, getVersion()); // resolveBaseParentOffsets( res ); controls.push_back(res); + sessionIds.insert(res->sessionid); } return res; } diff --git a/src/gui/SurgeGUIEditor.cpp b/src/gui/SurgeGUIEditor.cpp index 48069806646..ddaae4b617c 100644 --- a/src/gui/SurgeGUIEditor.cpp +++ b/src/gui/SurgeGUIEditor.cpp @@ -690,6 +690,23 @@ void SurgeGUIEditor::idle() */ } #endif + + if (scanJuceSkinComponents) + { + std::vector toRemove; + for (const auto &c : juceSkinComponents) + { + if (!currentSkin->containsControlWithSessionId(c.first)) + { + toRemove.push_back(c.first); + } + } + for (const auto &sid : toRemove) + { + juceSkinComponents.erase(sid); + } + scanJuceSkinComponents = false; + } } void SurgeGUIEditor::toggle_mod_editing() @@ -3283,6 +3300,9 @@ void SurgeGUIEditor::reloadFromSkin() setJUCEColour(juce::ComboBox::backgroundColourId, juce::Colour(32, 32, 32)); setJUCEColour(juce::PopupMenu::backgroundColourId, juce::Colour(48, 48, 48)); setJUCEColour(juce::PopupMenu::highlightedBackgroundColourId, juce::Colour(96, 96, 96)); + + synth->refresh_editor = true; + scanJuceSkinComponents = true; } juce::PopupMenu SurgeGUIEditor::makeDevMenu(const juce::Point &where) diff --git a/src/gui/SurgeGUIEditor.h b/src/gui/SurgeGUIEditor.h index 4d5d3369287..81ce90f9798 100644 --- a/src/gui/SurgeGUIEditor.h +++ b/src/gui/SurgeGUIEditor.h @@ -505,6 +505,7 @@ class SurgeGUIEditor : public Surge::GUI::IComponentTagValue::Listener, */ std::array, 15> effectLabels; + bool scanJuceSkinComponents{false}; std::unordered_map> juceSkinComponents; template