Skip to content

Commit

Permalink
Formula/MSEG follows mod button
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Jul 5, 2021
1 parent e0ea814 commit 4e6247d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
38 changes: 24 additions & 14 deletions src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,11 @@ void SurgeGUIEditor::openOrRecreateEditor()

#endif

for (const auto &el : juceOverlays)
{
frame->addAndMakeVisible(*(el.second));
}

if (showMSEGEditorOnNextIdleOrOpen)
{
showMSEGEditor();
Expand Down Expand Up @@ -4371,6 +4376,8 @@ void SurgeGUIEditor::swapFX(int source, int target, SurgeSynthesizer::FXReorderM

void SurgeGUIEditor::lfoShapeChanged(int prior, int curr)
{
std::cout << "lfoShapeChanged" << prior << " " << curr << std::endl;

if (prior != curr || prior == lt_mseg || curr == lt_mseg || prior == lt_formula ||
curr == lt_formula)
{
Expand All @@ -4381,26 +4388,29 @@ void SurgeGUIEditor::lfoShapeChanged(int prior, int curr)
}
}

if (curr == lt_mseg && isAnyOverlayPresent(MSEG_EDITOR))
{
// We have the MSEGEditor open and have swapped to the MSEG here
showMSEGEditor();
}
else if (prior == lt_mseg && curr != lt_mseg && isAnyOverlayPresent(MSEG_EDITOR))
bool hadExtendedEditor = false;
if (isAnyOverlayPresent(MSEG_EDITOR))
{
// We can choose to not do this too; if we do we are editing an MSEG which isn't used though
closeMSEGEditor();
hadExtendedEditor = true;
}

if (curr == lt_formula && isAnyOverlayPresent(FORMULA_EDITOR))
if (isAnyOverlayPresent(FORMULA_EDITOR))
{
// We have the MSEGEditor open and have swapped to the MSEG here
showFormulaEditorDialog();
closeFormulaEditorDialog();
hadExtendedEditor = true;
}
else if (prior == lt_formula && curr != lt_formula && isAnyOverlayPresent(FORMULA_EDITOR))
std::cout << _D(prior) << _D(curr) << _D(hadExtendedEditor) << std::endl;

if (hadExtendedEditor)
{
// We can choose to not do this too; if we do we are editing an MSEG which isn't used though
closeFormulaEditorDialog();
if (curr == lt_mseg)
{
showMSEGEditor();
}
if (curr == lt_formula)
{
showFormulaEditorDialog();
}
}

// update the LFO title label
Expand Down
15 changes: 13 additions & 2 deletions src/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2225,17 +2225,28 @@ void SurgeGUIEditor::valueChanged(Surge::GUI::IComponentTagValue *control)
}
}

bool hadExtendedOverlay = false;
if (isAnyOverlayPresent(MSEG_EDITOR))
{
closeMSEGEditor();
hadExtendedOverlay = true;
}
if (isAnyOverlayPresent(FORMULA_EDITOR))
{
closeFormulaEditorDialog();
hadExtendedOverlay = true;
}
if (hadExtendedOverlay)
{
auto ld = &(synth->storage.getPatch().scene[current_scene].lfo[newsource -
ms_lfo1]);
if (ld->shape.val.i == lt_mseg)
{
showMSEGEditor();
}
else
if (ld->shape.val.i == lt_formula)
{
closeMSEGEditor();
showFormulaEditorDialog();
}
}

Expand Down

0 comments on commit 4e6247d

Please sign in to comment.