Skip to content

Commit

Permalink
VST3 Popup Menu on Macros restored
Browse files Browse the repository at this point in the history
We had it on params but that was before we exposed the
macros as params. Now fully back to 1.9 state

Closes surge-synthesizer#4880
  • Loading branch information
baconpaul committed Aug 21, 2021
1 parent 8baafdc commit 232eef4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,20 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c
synth->refresh_editor = true;
});
});

auto jpm = juceEditor->hostMenuForMacro(ccid);

if (jpm.getNumItems() > 0)
{
contextMenu.addSeparator();

juce::PopupMenu::MenuItemIterator iterator(jpm);

while (iterator.next())
{
contextMenu.addItem(iterator.getItem());
}
}
}

int lfo_id = isLFO(modsource) ? modsource - ms_lfo1 : -1;
Expand Down
12 changes: 12 additions & 0 deletions src/surge_synth_juce/SurgeSynthEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,15 @@ juce::PopupMenu SurgeSynthEditor::hostMenuFor(Parameter *p)

return juce::PopupMenu();
}

juce::PopupMenu SurgeSynthEditor::hostMenuForMacro(int macro)
{
auto par = processor.macrosById[macro];
#if SURGE_JUCE_HOST_CONTEXT
if (auto *c = getHostContext())
if (auto menuInfo = c->getContextMenuForParameterIndex(par))
return menuInfo->getEquivalentPopupMenu();
#endif

return juce::PopupMenu();
}
1 change: 1 addition & 0 deletions src/surge_synth_juce/SurgeSynthEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class SurgeSynthEditor : public juce::AudioProcessorEditor,
void filesDropped(const juce::StringArray &files, int, int) override;

juce::PopupMenu hostMenuFor(Parameter *p);
juce::PopupMenu hostMenuForMacro(int macro);

friend class SurgeGUIEditor;

Expand Down

0 comments on commit 232eef4

Please sign in to comment.