mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Implement IPlugView::getSize()
This commit is contained in:
@@ -461,6 +461,13 @@ bool Vst3Logger::log_request(bool is_host_vst,
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPlugView::GetSize& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << request.owner_instance_id << ": IPlugView::getSize(size*)";
|
||||
});
|
||||
}
|
||||
|
||||
bool Vst3Logger::log_request(bool is_host_vst,
|
||||
const YaPluginBase::Initialize& request) {
|
||||
return log_request_base(is_host_vst, [&](auto& message) {
|
||||
@@ -725,6 +732,19 @@ void Vst3Logger::log_response(
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaPlugView::GetSizeResponse& response) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
message << response.result.string();
|
||||
if (response.result == Steinberg::kResultOk) {
|
||||
message << ", <ViewRect* with left = " << response.updated_size.left
|
||||
<< ", top = " << response.updated_size.top
|
||||
<< ", right = " << response.updated_size.right
|
||||
<< ", bottom = " << response.updated_size.bottom << ">";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_response(bool is_host_vst,
|
||||
const YaPluginFactory::ConstructArgs& args) {
|
||||
log_response_base(is_host_vst, [&](auto& message) {
|
||||
|
||||
@@ -111,6 +111,7 @@ class Vst3Logger {
|
||||
bool log_request(bool is_host_vst,
|
||||
const YaPlugView::IsPlatformTypeSupported&);
|
||||
bool log_request(bool is_host_vst, const YaPlugView::Attached&);
|
||||
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&);
|
||||
bool log_request(bool is_host_vst, const YaPluginFactory::Construct&);
|
||||
@@ -147,6 +148,7 @@ class Vst3Logger {
|
||||
const YaEditController::GetParamValueByStringResponse&);
|
||||
void log_response(bool is_host_vst,
|
||||
const YaEditController::CreateViewResponse&);
|
||||
void log_response(bool is_host_vst, const YaPlugView::GetSizeResponse&);
|
||||
void log_response(bool is_host_vst, const YaPluginFactory::ConstructArgs&);
|
||||
void log_response(bool is_host_vst, const Configuration&);
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ using ControlRequest = std::variant<Vst3PlugViewProxy::Destruct,
|
||||
YaEditController::CreateView,
|
||||
YaPlugView::IsPlatformTypeSupported,
|
||||
YaPlugView::Attached,
|
||||
YaPlugView::GetSize,
|
||||
YaPluginBase::Initialize,
|
||||
YaPluginBase::Terminate,
|
||||
YaPluginFactory::Construct,
|
||||
|
||||
@@ -120,6 +120,39 @@ class YaPlugView : public Steinberg::IPlugView {
|
||||
virtual tresult PLUGIN_API onKeyUp(char16 key,
|
||||
int16 keyCode,
|
||||
int16 modifiers) override = 0;
|
||||
|
||||
/**
|
||||
* The response code and editor size returned by a call to
|
||||
* `IPlugView::getSize(&size)`.
|
||||
*/
|
||||
struct GetSizeResponse {
|
||||
UniversalTResult result;
|
||||
Steinberg::ViewRect updated_size;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.object(result);
|
||||
s.object(updated_size);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IPlugView::getSize(&size)`.
|
||||
*/
|
||||
struct GetSize {
|
||||
using Response = GetSizeResponse;
|
||||
|
||||
native_size_t owner_instance_id;
|
||||
|
||||
Steinberg::ViewRect size;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(owner_instance_id);
|
||||
s.object(size);
|
||||
}
|
||||
};
|
||||
|
||||
virtual tresult PLUGIN_API getSize(Steinberg::ViewRect* size) override = 0;
|
||||
virtual tresult PLUGIN_API
|
||||
onSize(Steinberg::ViewRect* newSize) override = 0;
|
||||
@@ -135,3 +168,13 @@ class YaPlugView : public Steinberg::IPlugView {
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
namespace Steinberg {
|
||||
template <typename S>
|
||||
void serialize(S& s, ViewRect& rect) {
|
||||
s.value4b(rect.left);
|
||||
s.value4b(rect.top);
|
||||
s.value4b(rect.right);
|
||||
s.value4b(rect.bottom);
|
||||
}
|
||||
} // namespace Steinberg
|
||||
|
||||
Reference in New Issue
Block a user