Skip to content

Commit

Permalink
Reset modulation state when modulations are cleared (surge-synthesize…
Browse files Browse the repository at this point in the history
…r#1330)

If you RMB/Clear a modulation the item wouldn't repaint properly
until a later time (when update_lagvals were called). This corrects
that.

CLoses surge-synthesizer#1329
  • Loading branch information
baconpaul authored Nov 22, 2019
1 parent b838575 commit 0b1caaf
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,15 @@ void SurgeGUIEditor::refresh_mod()
state = mod_editor ? 2 : 1;
if (i == modsource_editor)
state |= 4;

if( gui_modsrc[i] )
{
// this could change if I cleared the last one
((CModulationSourceButton*)gui_modsrc[i])->used = synth->isModsourceUsed( (modsources)i );
((CModulationSourceButton*)gui_modsrc[i])->state = state;
((CModulationSourceButton*)gui_modsrc[i])->invalid();
}
}

// ctnvg frame->redraw();
// frame->setDirty();
}
Expand Down Expand Up @@ -1849,6 +1851,8 @@ int32_t SurgeGUIEditor::controlModifierClicked(CControl* control, CButtonState b

synth->clearModulation(md, thisms);
refresh_mod();
control->setDirty();
control->invalid();

if (resetName)
{
Expand Down Expand Up @@ -1885,7 +1889,7 @@ int32_t SurgeGUIEditor::controlModifierClicked(CControl* control, CButtonState b
for (int md = 1; md < n_total_md; md++)
synth->clearModulation(md, thisms);
refresh_mod();

// Also blank out the name and rebuild the UI
if (within_range(ms_ctrl1, thisms, ms_ctrl1 + n_customcontrollers - 1))
{
Expand All @@ -1895,11 +1899,11 @@ int32_t SurgeGUIEditor::controlModifierClicked(CControl* control, CButtonState b
synth->storage.getPatch().CustomControllerLabel[ccid][1] = 0;
((CModulationSourceButton*)control)
->setlabel(synth->storage.getPatch().CustomControllerLabel[ccid]);
control->setDirty();
control->invalid();

synth->updateDisplay();
}
control->setDirty(true);
control->invalid();
synth->updateDisplay();

});
eid++;
}
Expand Down

0 comments on commit 0b1caaf

Please sign in to comment.