mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-15 04:50:43 +02:00
Implement the plugin side of IContextMenu
This commit is contained in:
@@ -18,6 +18,10 @@
|
||||
|
||||
#include "plug-view-proxy.h"
|
||||
|
||||
Vst3PluginProxyImpl::ContextMenu::ContextMenu(
|
||||
Steinberg::IPtr<Steinberg::Vst::IContextMenu> menu)
|
||||
: menu(menu) {}
|
||||
|
||||
Vst3PluginProxyImpl::Vst3PluginProxyImpl(Vst3PluginBridge& bridge,
|
||||
Vst3PluginProxy::ConstructArgs&& args)
|
||||
: Vst3PluginProxy(std::move(args)), bridge(bridge) {
|
||||
|
||||
@@ -258,6 +258,26 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
*/
|
||||
Vst3PlugViewProxyImpl* last_created_plug_view = nullptr;
|
||||
|
||||
/**
|
||||
* A pointer to a context menu returned by the host as a response to a call
|
||||
* to `IComponentHandler3::createContextMenu`, as well as all targets we've
|
||||
* created for it. This way we can drop both all at once.
|
||||
*/
|
||||
struct ContextMenu {
|
||||
ContextMenu(Steinberg::IPtr<Steinberg::Vst::IContextMenu> menu);
|
||||
|
||||
Steinberg::IPtr<Steinberg::Vst::IContextMenu> menu;
|
||||
|
||||
/**
|
||||
* All targets we pass to `IContextMenu::addItem`. We'll store them per
|
||||
* item tag, so we can drop them together with the menu. We probably
|
||||
* don't have to use smart pointers for this, but the docs are missing a
|
||||
* lot of details o how this should be implemented and there's no
|
||||
* example implementation around.
|
||||
*/
|
||||
std::map<int32, Steinberg::IPtr<YaContextMenuTarget>> targets;
|
||||
};
|
||||
|
||||
/**
|
||||
* All context menus created by this object through
|
||||
* `IComponentHandler3::createContextMenu()`. We'll generate a unique
|
||||
@@ -269,8 +289,7 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
* @see Vst3PluginProxyImpl::register_context_menu
|
||||
* @see Vst3PluginProxyImpl::unregister_context_menu
|
||||
*/
|
||||
std::map<size_t, Steinberg::IPtr<Steinberg::Vst::IContextMenu>>
|
||||
context_menus;
|
||||
std::map<size_t, ContextMenu> context_menus;
|
||||
std::mutex context_menus_mutex;
|
||||
|
||||
// The following pointers are cast from `host_context` if
|
||||
|
||||
Reference in New Issue
Block a user