mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Implement IPlugView::checkSizeConstraint()
With this the whole of `IPlugView` and thus also `IEditController` is implemented.
This commit is contained in:
@@ -19,7 +19,6 @@ incomplete list of things that still have to be done before this can be used:
|
||||
- `IHostApplication::createComponent()`
|
||||
- `IConnectionPoint::notify()`, and support for indirectly connecting
|
||||
components through message passing proxies
|
||||
- The rest of `IPlugView`
|
||||
- `IEditController2`
|
||||
- All other mandatory interfaces
|
||||
- All other optional interfaces
|
||||
|
||||
@@ -333,6 +333,18 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPlugView::CheckSizeConstraint& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << request.owner_instance_id
|
||||
<< ": IPlugView::checkSizeConstraint(rect = "
|
||||
"<ViewRect* with left = "
|
||||
<< request.rect.left << ", top = " << request.rect.top
|
||||
<< ", right = " << request.rect.right
|
||||
<< ", bottom = " << request.rect.bottom << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPluginBase::Initialize& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
@@ -99,6 +99,7 @@ class Vst3Logger {
|
||||
bool log_request(bool is_host_vst, const YaPlugView::OnFocus&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::SetFrame&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::CanResize&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::CheckSizeConstraint&);
|
||||
bool log_request(bool is_host_vst, const YaPluginBase::Initialize&);
|
||||
bool log_request(bool is_host_vst, const YaPluginBase::Terminate&);
|
||||
bool log_request(bool is_host_vst, const YaPluginFactory::Construct&);
|
||||
|
||||
@@ -90,6 +90,7 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
||||
YaPlugView::OnFocus,
|
||||
YaPlugView::SetFrame,
|
||||
YaPlugView::CanResize,
|
||||
YaPlugView::CheckSizeConstraint,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
|
||||
@@ -319,6 +319,25 @@ class YaPlugView : public Steinberg::IPlugView {
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API canResize() override = 0;
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IPlugView::checkSizeConstraint(rect)`
|
||||
* to the Wine plugin host.
|
||||
*/
|
||||
struct CheckSizeConstraint {
|
||||
using Response = UniversalTResult;
|
||||
|
||||
native_size_t owner_instance_id;
|
||||
|
||||
Steinberg::ViewRect rect;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(owner_instance_id);
|
||||
s.object(rect);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
checkSizeConstraint(Steinberg::ViewRect* rect) override = 0;
|
||||
|
||||
|
||||
@@ -145,7 +145,13 @@ tresult PLUGIN_API Vst3PlugViewProxyImpl::canResize() {
|
||||
|
||||
tresult PLUGIN_API
|
||||
Vst3PlugViewProxyImpl::checkSizeConstraint(Steinberg::ViewRect* rect) {
|
||||
// TODO: Implement
|
||||
bridge.logger.log("TODO: IPlugView::checkSizeConstraint()");
|
||||
return Steinberg::kNotImplemented;
|
||||
if (rect) {
|
||||
return bridge.send_message(YaPlugView::CheckSizeConstraint{
|
||||
.owner_instance_id = owner_instance_id(), .rect = *rect});
|
||||
} else {
|
||||
bridge.logger.log(
|
||||
"WARNING: Null pointer passed to "
|
||||
"'IPlugView::checkSizeConstraint()'");
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +425,11 @@ void Vst3Bridge::run() {
|
||||
return object_instances[request.owner_instance_id]
|
||||
.plug_view->canResize();
|
||||
},
|
||||
[&](YaPlugView::CheckSizeConstraint& request)
|
||||
-> YaPlugView::CheckSizeConstraint::Response {
|
||||
return object_instances[request.owner_instance_id]
|
||||
.plug_view->checkSizeConstraint(&request.rect);
|
||||
},
|
||||
[&](YaPluginBase::Initialize& request)
|
||||
-> YaPluginBase::Initialize::Response {
|
||||
// We'll create a proxy object for the host context passed by
|
||||
|
||||
Reference in New Issue
Block a user