LV2 options for UI theme
Inform plugins about host theme (fg, bg colors) and UI scale-factor. The latter follows an implementation already present in Carla and DPF. These extension use proposed official URLs.
This commit is contained in:
@@ -175,6 +175,17 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||
Variant get_property_value (uint32_t) const;
|
||||
void announce_property_values();
|
||||
|
||||
/* LV2 Option Options */
|
||||
static void set_global_ui_background_color (uint32_t c) {
|
||||
_ui_background_color = c;
|
||||
}
|
||||
static void set_global_ui_foreground_color (uint32_t c) {
|
||||
_ui_foreground_color = c;
|
||||
}
|
||||
static void set_global_ui_scale_factor (float s) {
|
||||
_ui_scale_factor = s;
|
||||
}
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
Impl* _impl;
|
||||
@@ -298,7 +309,6 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||
if (chn > 15) return UINT32_MAX;
|
||||
return _bankpatch[chn];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
@@ -320,7 +330,10 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||
#endif
|
||||
|
||||
// Options passed to plugin
|
||||
int32_t _seq_size;
|
||||
int32_t _seq_size;
|
||||
static uint32_t _ui_background_color;
|
||||
static uint32_t _ui_foreground_color;
|
||||
static float _ui_scale_factor;
|
||||
|
||||
mutable unsigned _state_version;
|
||||
|
||||
|
||||
@@ -128,7 +128,10 @@ using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
|
||||
bool LV2Plugin::force_state_save = false;
|
||||
bool LV2Plugin::force_state_save = false;
|
||||
uint32_t LV2Plugin::_ui_background_color = 0x000000ff; // RGBA
|
||||
uint32_t LV2Plugin::_ui_foreground_color = 0xffffffff; // RGBA
|
||||
float LV2Plugin::_ui_scale_factor = 1.0;
|
||||
|
||||
class LV2World : boost::noncopyable {
|
||||
public:
|
||||
@@ -501,7 +504,9 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
|
||||
_features[n_features++] = &_bankpatch_feature;
|
||||
#endif
|
||||
|
||||
LV2_URID atom_Int = _uri_map.uri_to_id(LV2_ATOM__Int);
|
||||
LV2_URID atom_Int = _uri_map.uri_to_id(LV2_ATOM__Int);
|
||||
LV2_URID atom_Float = _uri_map.uri_to_id(LV2_ATOM__Float);
|
||||
|
||||
static const int32_t _min_block_length = 1; // may happen during split-cycles
|
||||
static const int32_t _max_block_length = 8192; // max possible (with all engines and during export)
|
||||
static const int32_t rt_policy = PBD_SCHED_FIFO;
|
||||
@@ -526,6 +531,12 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
|
||||
sizeof(int32_t), atom_Int, &rt_policy },
|
||||
{ LV2_OPTIONS_INSTANCE, 0, _uri_map.uri_to_id("http://ardour.org/lv2/threads/#schedPriority"),
|
||||
sizeof(int32_t), atom_Int, &rt_priority },
|
||||
{ LV2_OPTIONS_INSTANCE, 0, _uri_map.uri_to_id("http://lv2plug.in/ns/extensions/ui#backgroundColor"),
|
||||
sizeof(int32_t), atom_Int, &_ui_background_color },
|
||||
{ LV2_OPTIONS_INSTANCE, 0, _uri_map.uri_to_id("http://lv2plug.in/ns/extensions/ui#foregroundColor"),
|
||||
sizeof(int32_t), atom_Int, &_ui_foreground_color },
|
||||
{ LV2_OPTIONS_INSTANCE, 0, _uri_map.uri_to_id("http://lv2plug.in/ns/extensions/ui#scaleFactor"),
|
||||
sizeof(int32_t), atom_Float, &_ui_scale_factor },
|
||||
{ LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user