mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-19 18:03:56 +02:00
Split up a ConstructArgs from YaContextMenuTarget
So we can send this as a payload when the plugin adds a context menu item.
This commit is contained in:
@@ -16,12 +16,16 @@
|
|||||||
|
|
||||||
#include "context-menu-target.h"
|
#include "context-menu-target.h"
|
||||||
|
|
||||||
YaContextMenuTarget::YaContextMenuTarget(native_size_t owner_instance_id,
|
YaContextMenuTarget::ConstructArgs::ConstructArgs(
|
||||||
native_size_t context_menu_id,
|
native_size_t owner_instance_id,
|
||||||
int32 tag)
|
native_size_t context_menu_id,
|
||||||
|
int32 tag)
|
||||||
: owner_instance_id(owner_instance_id),
|
: owner_instance_id(owner_instance_id),
|
||||||
context_menu_id(context_menu_id),
|
context_menu_id(context_menu_id),
|
||||||
tag(tag){FUNKNOWN_CTOR}
|
tag(tag) {}
|
||||||
|
|
||||||
|
YaContextMenuTarget::YaContextMenuTarget(const ConstructArgs&& args)
|
||||||
|
: arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||||
|
|
||||||
YaContextMenuTarget::~YaContextMenuTarget() {
|
YaContextMenuTarget::~YaContextMenuTarget() {
|
||||||
FUNKNOWN_DTOR
|
FUNKNOWN_DTOR
|
||||||
|
|||||||
@@ -32,19 +32,44 @@
|
|||||||
*/
|
*/
|
||||||
class YaContextMenuTarget : public Steinberg::Vst::IContextMenuTarget {
|
class YaContextMenuTarget : public Steinberg::Vst::IContextMenuTarget {
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* These are the arguments for constructing a
|
||||||
|
* `YaContextMenuTargetImpl`.
|
||||||
|
*/
|
||||||
|
struct ConstructArgs {
|
||||||
|
ConstructArgs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read from an existing object. We will try to mimic this object, so
|
||||||
|
* we'll support any interfaces this object also supports.
|
||||||
|
*
|
||||||
|
* @param owner_instance_id The object instance that this target's
|
||||||
|
* context menu belongs to.
|
||||||
|
* @param context_menu_id The unique ID of the context menu requested by
|
||||||
|
* `owwner_instance_id`.
|
||||||
|
* @param tag The tag of the menu item this target belongs to.
|
||||||
|
*/
|
||||||
|
ConstructArgs(native_size_t owner_instance_id,
|
||||||
|
native_size_t context_menu_id,
|
||||||
|
int32 tag);
|
||||||
|
|
||||||
|
native_size_t owner_instance_id;
|
||||||
|
native_size_t context_menu_id;
|
||||||
|
int32 tag;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(owner_instance_id);
|
||||||
|
s.value8b(context_menu_id);
|
||||||
|
s.value4b(tag);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create context menu target that when called, calls the corresponding
|
* Create context menu target that when called, calls the corresponding
|
||||||
* context menu target provided by the object.
|
* context menu target provided by the object.
|
||||||
*
|
|
||||||
* @param owner_instance_id The object instance that this target's context
|
|
||||||
* menu belongs to.
|
|
||||||
* @param context_menu_id The unique ID of the context menu requested by
|
|
||||||
* `owwner_instance_id`.
|
|
||||||
* @param tag The tag of the menu item this target belongs to.
|
|
||||||
*/
|
*/
|
||||||
YaContextMenuTarget(native_size_t owner_instance_id,
|
YaContextMenuTarget(const ConstructArgs&& args);
|
||||||
native_size_t context_menu_id,
|
|
||||||
int32 tag);
|
|
||||||
|
|
||||||
~YaContextMenuTarget();
|
~YaContextMenuTarget();
|
||||||
|
|
||||||
@@ -53,9 +78,7 @@ class YaContextMenuTarget : public Steinberg::Vst::IContextMenuTarget {
|
|||||||
virtual tresult PLUGIN_API executeMenuItem(int32 tag) override = 0;
|
virtual tresult PLUGIN_API executeMenuItem(int32 tag) override = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
native_size_t owner_instance_id;
|
ConstructArgs arguments;
|
||||||
native_size_t context_menu_id;
|
|
||||||
int32 tag;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|||||||
@@ -16,13 +16,9 @@
|
|||||||
|
|
||||||
#include "context-menu-target.h"
|
#include "context-menu-target.h"
|
||||||
|
|
||||||
YaContextMenuTargetImpl::YaContextMenuTargetImpl(
|
YaContextMenuTargetImpl::YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
|
||||||
Vst3PluginBridge& bridge,
|
const ConstructArgs&& args)
|
||||||
native_size_t owner_instance_id,
|
: YaContextMenuTarget(std::move(args)), bridge(bridge) {}
|
||||||
native_size_t context_menu_id,
|
|
||||||
int32 tag)
|
|
||||||
: YaContextMenuTarget(owner_instance_id, context_menu_id, tag),
|
|
||||||
bridge(bridge) {}
|
|
||||||
|
|
||||||
tresult PLUGIN_API
|
tresult PLUGIN_API
|
||||||
YaContextMenuTargetImpl::queryInterface(const Steinberg::TUID _iid,
|
YaContextMenuTargetImpl::queryInterface(const Steinberg::TUID _iid,
|
||||||
|
|||||||
@@ -20,13 +20,8 @@
|
|||||||
|
|
||||||
class YaContextMenuTargetImpl : public YaContextMenuTarget {
|
class YaContextMenuTargetImpl : public YaContextMenuTarget {
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @override
|
|
||||||
*/
|
|
||||||
YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
|
YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
|
||||||
native_size_t owner_instance_id,
|
const ConstructArgs&& args);
|
||||||
native_size_t context_menu_id,
|
|
||||||
int32 tag);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We'll override the query interface to log queries for interfaces we do
|
* We'll override the query interface to log queries for interfaces we do
|
||||||
|
|||||||
Reference in New Issue
Block a user