|
|
|
@@ -1472,8 +1472,9 @@ private: |
|
|
|
class EditorContextMenu : public HostProvidedContextMenu
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
EditorContextMenu (VSTComSmartPtr<Steinberg::Vst::IContextMenu> contextMenuIn)
|
|
|
|
: contextMenu (contextMenuIn) {}
|
|
|
|
EditorContextMenu (AudioProcessorEditor& editorIn,
|
|
|
|
VSTComSmartPtr<Steinberg::Vst::IContextMenu> contextMenuIn)
|
|
|
|
: editor (editorIn), contextMenu (contextMenuIn) {}
|
|
|
|
|
|
|
|
PopupMenu getEquivalentPopupMenu() const override
|
|
|
|
{
|
|
|
|
@@ -1542,10 +1543,12 @@ private: |
|
|
|
|
|
|
|
void showNativeMenu (Point<int> pos) const override
|
|
|
|
{
|
|
|
|
contextMenu->popup (pos.x, pos.y);
|
|
|
|
const auto scaled = pos * Component::getApproximateScaleFactorForComponent (&editor);
|
|
|
|
contextMenu->popup (scaled.x, scaled.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
AudioProcessorEditor& editor;
|
|
|
|
VSTComSmartPtr<Steinberg::Vst::IContextMenu> contextMenu;
|
|
|
|
};
|
|
|
|
|
|
|
|
@@ -1553,9 +1556,10 @@ private: |
|
|
|
{
|
|
|
|
public:
|
|
|
|
EditorHostContext (JuceAudioProcessor& processorIn,
|
|
|
|
AudioProcessorEditor& editorIn,
|
|
|
|
Steinberg::Vst::IComponentHandler* handler,
|
|
|
|
Steinberg::IPlugView* viewIn)
|
|
|
|
: processor (processorIn), componentHandler (handler), view (viewIn) {}
|
|
|
|
: processor (processorIn), editor (editorIn), componentHandler (handler), view (viewIn) {}
|
|
|
|
|
|
|
|
std::unique_ptr<HostProvidedContextMenu> getContextMenuForParameterIndex (const AudioProcessorParameter* parameter) const override
|
|
|
|
{
|
|
|
|
@@ -1569,11 +1573,12 @@ private: |
|
|
|
|
|
|
|
const auto idToUse = parameter != nullptr ? processor.getVSTParamIDForIndex (parameter->getParameterIndex()) : 0;
|
|
|
|
const auto menu = VSTComSmartPtr<Steinberg::Vst::IContextMenu> (handler->createContextMenu (view, &idToUse));
|
|
|
|
return std::make_unique<EditorContextMenu> (menu);
|
|
|
|
return std::make_unique<EditorContextMenu> (editor, menu);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
JuceAudioProcessor& processor;
|
|
|
|
AudioProcessorEditor& editor;
|
|
|
|
Steinberg::Vst::IComponentHandler* componentHandler = nullptr;
|
|
|
|
Steinberg::IPlugView* view = nullptr;
|
|
|
|
};
|
|
|
|
@@ -1586,7 +1591,6 @@ private: |
|
|
|
public:
|
|
|
|
JuceVST3Editor (JuceVST3EditController& ec, JuceAudioProcessor& p)
|
|
|
|
: EditorView (&ec, nullptr),
|
|
|
|
editorHostContext (p, ec.getComponentHandler(), this),
|
|
|
|
owner (&ec),
|
|
|
|
pluginInstance (*p.get())
|
|
|
|
{
|
|
|
|
@@ -1925,7 +1929,12 @@ private: |
|
|
|
|
|
|
|
if (pluginEditor != nullptr)
|
|
|
|
{
|
|
|
|
pluginEditor->setHostContext (&owner.editorHostContext);
|
|
|
|
editorHostContext = std::make_unique<EditorHostContext> (*owner.owner->audioProcessor,
|
|
|
|
*pluginEditor,
|
|
|
|
owner.owner->getComponentHandler(),
|
|
|
|
&owner);
|
|
|
|
|
|
|
|
pluginEditor->setHostContext (editorHostContext.get());
|
|
|
|
|
|
|
|
addAndMakeVisible (pluginEditor.get());
|
|
|
|
pluginEditor->setTopLeftPosition (0, 0);
|
|
|
|
@@ -2071,6 +2080,7 @@ private: |
|
|
|
|
|
|
|
private:
|
|
|
|
JuceVST3Editor& owner;
|
|
|
|
std::unique_ptr<EditorHostContext> editorHostContext;
|
|
|
|
FakeMouseMoveGenerator fakeMouseGenerator;
|
|
|
|
Rectangle<int> lastBounds;
|
|
|
|
bool resizingChild = false, resizingParent = false;
|
|
|
|
@@ -2094,8 +2104,6 @@ private: |
|
|
|
//==============================================================================
|
|
|
|
ScopedJuceInitialiser_GUI libraryInitialiser;
|
|
|
|
|
|
|
|
EditorHostContext editorHostContext;
|
|
|
|
|
|
|
|
#if JUCE_LINUX || JUCE_BSD
|
|
|
|
SharedResourcePointer<MessageThread> messageThread;
|
|
|
|
SharedResourcePointer<EventHandler> eventHandler;
|
|
|
|
|