mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Implement IPlugView::onSize()
This commit is contained in:
@@ -297,6 +297,19 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPlugView::OnSize& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
// This static cast is technically not correct of course but it's
|
||||
// UTF-16, so everything's allowed
|
||||
message << request.owner_instance_id
|
||||
<< ": IPlugView::onSize(newSize = <ViewRect* with left = "
|
||||
<< request.new_size.left << ", top = " << request.new_size.top
|
||||
<< ", right = " << request.new_size.right
|
||||
<< ", bottom = " << request.new_size.bottom << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPlugView::GetSize& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
@@ -94,6 +94,7 @@ class Vst3Logger {
|
||||
bool log_request(bool is_host_vst, const YaPlugView::OnWheel&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::OnKeyDown&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::OnKeyUp&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::OnSize&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::GetSize&);
|
||||
bool log_request(bool is_host_vst, const YaPluginBase::Initialize&);
|
||||
bool log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
||||
|
||||
@@ -83,6 +83,7 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
||||
YaPlugView::OnWheel,
|
||||
YaPlugView::OnKeyDown,
|
||||
YaPlugView::OnKeyUp,
|
||||
YaPlugView::OnSize,
|
||||
YaPlugView::GetSize,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
|
||||
@@ -235,6 +235,25 @@ class YaPlugView : public Steinberg::IPlugView {
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API getSize(Steinberg::ViewRect* size) override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IPlugView::onSize(new_size)` to the
|
||||
* Wine plugin host.
|
||||
*/
|
||||
struct OnSize {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t owner_instance_id;
|
||||
|
||||
Steinberg::ViewRect new_size;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(owner_instance_id);
|
||||
s.object(new_size);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
onSize(Steinberg::ViewRect* newSize) override = 0;
|
||||
virtual tresult PLUGIN_API onFocus(TBool state) override = 0;
|
||||
|
||||
@@ -105,9 +105,14 @@ tresult PLUGIN_API Vst3PlugViewProxyImpl::getSize(Steinberg::ViewRect* size) {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Vst3PlugViewProxyImpl::onSize(Steinberg::ViewRect* newSize) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log("TODO: IPlugView::onSize()");
|
||||
return Steinberg::kNotImplemented;
|
||||
if (newSize) {
|
||||
return bridge.send_message(YaPlugView::OnSize{
|
||||
.owner_instance_id = owner_instance_id(), .new_size = *newSize});
|
||||
} else {
|
||||
bridge.logger.log(
|
||||
"WARNING: Null pointer passed to 'IPlugView::onSize()'");
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
}
|
||||
|
||||
tresult PLUGIN_API Vst3PlugViewProxyImpl::onFocus(TBool state) {
|
||||
|
||||
@@ -387,6 +387,10 @@ void Vst3Bridge::run() {
|
||||
.plug_view->onKeyUp(request.key, request.key_code,
|
||||
request.modifiers);
|
||||
},
|
||||
[&](YaPlugView::OnSize& request) -> YaPlugView::OnKeyUp::Response {
|
||||
return object_instances[request.owner_instance_id]
|
||||
.plug_view->onSize(&request.new_size);
|
||||
},
|
||||
[&](YaPlugView::GetSize& request) -> YaPlugView::GetSize::Response {
|
||||
const tresult result =
|
||||
object_instances[request.owner_instance_id]
|
||||
|
||||
Reference in New Issue
Block a user