Audacity 3.2.0
LV2UIFeaturesList.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file LV2UIFeaturesList.cpp
6
7 Paul Licameli split from LV2Effect.cpp
8
9 Audacity(R) is copyright (c) 1999-2008 Audacity Team.
10 License: GPL v2 or later. See License.txt.
11
12**********************************************************************/
13
14#include "LV2UIFeaturesList.h"
16#include "lv2/instance-access/instance-access.h"
17
19 const LV2WrapperFeaturesList &baseFeatures, UIHandler *pHandler,
20 const LilvNode *node, LilvInstance *pInstance, wxWindow *pParent
21) : ExtendedLV2FeaturesList{ WithBase, baseFeatures }
22 , mpHandler{ pHandler }
23 , mOk{ InitializeFeatures(node, pInstance, pParent) }
24{
25}
26
27bool LV2UIFeaturesList::InitializeFeatures(const LilvNode *node,
28 LilvInstance *pInstance, wxWindow *pParent)
29{
30 AddFeature(LV2_UI__resize, &mUIResizeFeature);
31 mExtensionDataFeature = { pInstance
32 ? lilv_instance_get_descriptor(pInstance)->extension_data
33 : nullptr
34 };
35 AddFeature(LV2_DATA_ACCESS_URI, &mExtensionDataFeature);
38 AddFeature(LV2_INSTANCE_ACCESS_URI,
39 pInstance ? lilv_instance_get_handle(pInstance) : nullptr);
40 AddFeature(LV2_UI__parent, pParent ? pParent->GetHandle() : nullptr);
41 return ValidateFeatures(node);
42}
43
44int LV2UIFeaturesList::ui_resize(LV2UI_Feature_Handle handle,
45 int width, int height)
46{
47 return static_cast<UIHandler*>(handle)->ui_resize(width, height);
48}
49
50void LV2UIFeaturesList::ui_closed(LV2UI_Controller controller)
51{
52 return static_cast<UIHandler*>(controller)->ui_closed();
53}
54
56 SuilController controller, const char *port_symbol)
57{
58 return static_cast<UIHandler *>(controller)->suil_port_index(port_symbol);
59}
60
61void LV2UIFeaturesList::suil_port_write(SuilController controller,
62 uint32_t port_index, uint32_t buffer_size, uint32_t protocol,
63 const void *buffer)
64{
65 return static_cast<UIHandler *>(controller)
66 ->suil_port_write(port_index, buffer_size, protocol, buffer);
67}
68
constexpr WithBase_t WithBase
Extends one (immutable) feature list (whose lifetime contains this one's)
void AddFeature(const char *uri, const void *data)
bool ValidateFeatures(const LilvNode *subject)
#define LV2_EXTERNAL_UI_DEPRECATED_URI
#define LV2_EXTERNAL_UI__Host
Abstraction of host services that a plug-ins native UI needs.
static uint32_t suil_port_index(SuilController controller, const char *port_symbol)
bool InitializeFeatures(const LilvNode *node, LilvInstance *pInstance, wxWindow *pParent)
const LV2UI_Resize mUIResizeFeature
static int ui_resize(LV2UI_Feature_Handle handle, int width, int height)
static void suil_port_write(SuilController controller, uint32_t port_index, uint32_t buffer_size, uint32_t protocol, const void *buffer)
const LV2_External_UI_Host mExternalUIHost
static void ui_closed(LV2UI_Controller controller)
LV2UIFeaturesList(const LV2WrapperFeaturesList &baseFeatures, UIHandler *pHandler, const LilvNode *node, LilvInstance *pInstance=nullptr, wxWindow *pParent=nullptr)
LV2_Extension_Data_Feature mExtensionDataFeature