Skip to content

Commit

Permalink
Correct a Slider State which interacted with Index (#5423)
Browse files Browse the repository at this point in the history
Slider Modulatable State didnt' survive modsource index
changes properly. Clean it up to restore working hovers etc

Closes #5380
  • Loading branch information
baconpaul authored Nov 17, 2021
1 parent 5fbb25d commit ade3319
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
10 changes: 9 additions & 1 deletion scripts/pyauto-tests/mod-create.py
Original file line number Diff line number Diff line change
Expand Up @@ -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>");
7 changes: 6 additions & 1 deletion src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -4705,7 +4710,7 @@ SurgeGUIEditor::layoutComponentForSkin(std::shared_ptr<Surge::GUI::Skin::Control
break;

default:
std::cout << tag << std::endl;
std::cout << "Unable to figure out home for tag = " << tag << std::endl;
jassert(false);
addAndMakeVisibleWithTracking(frame.get(), *hsw);
break;
Expand Down
3 changes: 1 addition & 2 deletions src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c

auto cb = [this, parameter, use_scene, bvf, thisms, modidx,
clearOp](Surge::Widgets::ModMenuCustomComponent::OpType op) {
std::cout << op << std::endl;
auto ptag = parameter->id;
switch (op)
{
Expand Down Expand Up @@ -927,7 +926,7 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c
if (cms->needsHamburger())
{
auto hamSub = juce::PopupMenu();
cms->buildHamburgerMenu(hamSub, false);
cms->buildHamburgerMenu(hamSub, true);
contextMenu.addSubMenu(Surge::GUI::toOSCaseForMenu("Switch To"), hamSub);
contextMenu.addSeparator();
}
Expand Down
10 changes: 3 additions & 7 deletions src/surge-xt/gui/widgets/ModulationSourceButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,10 @@ void ModulationSourceButton::buildHamburgerMenu(juce::PopupMenu &menu,
{
auto modName = std::get<3>(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();
Expand Down

0 comments on commit ade3319

Please sign in to comment.