From ade331930d1349a2fc5c5b031451ebb41c198f8a Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 17 Nov 2021 18:01:26 -0500 Subject: [PATCH] Correct a Slider State which interacted with Index (#5423) Slider Modulatable State didnt' survive modsource index changes properly. Clean it up to restore working hovers etc Closes #5380 --- scripts/pyauto-tests/mod-create.py | 10 +++++++++- src/surge-xt/gui/SurgeGUIEditor.cpp | 7 ++++++- src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp | 3 +-- src/surge-xt/gui/widgets/ModulationSourceButton.cpp | 10 +++------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/scripts/pyauto-tests/mod-create.py b/scripts/pyauto-tests/mod-create.py index 89535c7d864..999b8e64a65 100644 --- a/scripts/pyauto-tests/mod-create.py +++ b/scripts/pyauto-tests/mod-create.py @@ -10,4 +10,12 @@ sxttest.loadPatchByPath(sxt, ["Templates", "Init Sine"]) time.sleep(1) -sxttest.recursiveDump(mf, "") +mods = sxttest.firstChildByTitle(mf, "Modulators") + +sxttest.recursiveDump(mods, "MOD>") +l1 = sxttest.firstChildByTitle(mods, "LFO 1"); +arm = sxttest.firstChildByTitle(l1, "Select"); +arm.Press() +arm.Press() + +sxttest.recursiveDump(mf, "TOP>"); diff --git a/src/surge-xt/gui/SurgeGUIEditor.cpp b/src/surge-xt/gui/SurgeGUIEditor.cpp index 10738a5054f..7d525726e6b 100644 --- a/src/surge-xt/gui/SurgeGUIEditor.cpp +++ b/src/surge-xt/gui/SurgeGUIEditor.cpp @@ -1020,6 +1020,11 @@ void SurgeGUIEditor::refresh_mod() { auto s = param[i]; + auto p = synth->storage.getPatch().param_ptr[i]; + if (p) + { + s->setIsValidToModulate(synth->isValidModulation(p->id, thisms)); + } if (s->getIsValidToModulate()) { auto use_scene = 0; @@ -4705,7 +4710,7 @@ SurgeGUIEditor::layoutComponentForSkin(std::shared_ptr(e); - if (this->modlistIndex != idx) + if (this->modlistIndex != idx || !addedToModbuttonContextMenu) { - if (addedToModbuttonContextMenu) - { - modName = "Switch to " + modName; - } - - menu.addItem(modName, [this, idx]() { + bool ticked = !addedToModbuttonContextMenu && this->modlistIndex == idx; + menu.addItem(modName, true, ticked, [this, idx]() { this->modlistIndex = idx; mouseMode = HAMBURGER; notifyValueChanged();