_ardour_buttons_box.set_spacing (6);
_ardour_buttons_box.set_border_width (6);
_ardour_buttons_box.pack_end (focus_button, false, false);
- _ardour_buttons_box.pack_end (bypass_button, false, false, 10);
+ _ardour_buttons_box.pack_end (bypass_button, false, false, 4);
+ _ardour_buttons_box.pack_end (reset_button, false, false, 4);
_ardour_buttons_box.pack_end (delete_button, false, false);
_ardour_buttons_box.pack_end (save_button, false, false);
_ardour_buttons_box.pack_end (add_button, false, false);
_lv2->enable_ui_emission();
}
- const LilvUI* ui = (const LilvUI*)_lv2->c_ui();
+ const LilvUI* ui = (const LilvUI*)_lv2->c_ui();
+ const LilvNode* bundle = lilv_ui_get_bundle_uri(ui);
+ const LilvNode* binary = lilv_ui_get_binary_uri(ui);
+#ifdef HAVE_LILV_0_21_3
+ char* ui_bundle_path = lilv_file_uri_parse(lilv_node_as_uri(bundle), NULL);
+ char* ui_binary_path = lilv_file_uri_parse(lilv_node_as_uri(binary), NULL);
+#else
+ char* ui_bundle_path = strdup(lilv_uri_to_path(lilv_node_as_uri(bundle)));
+ char* ui_binary_path = strdup(lilv_uri_to_path(lilv_node_as_uri(binary)));
+#endif
+ if (!ui_bundle_path || !ui_binary_path) {
+ error << _("failed to get path for UI bindle or binary") << endmsg;
+ free(ui_bundle_path);
+ free(ui_binary_path);
+ free(features);
+ return;
+ }
+
_inst = suil_instance_new(
ui_host,
this,
_lv2->uri(),
lilv_node_as_uri(lilv_ui_get_uri(ui)),
lilv_node_as_uri((const LilvNode*)_lv2->c_ui_type()),
- lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
- lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
+ ui_bundle_path,
+ ui_binary_path,
features);
+ free(ui_bundle_path);
+ free(ui_binary_path);
free(features);
+ if (!_inst) {
+ error << _("failed to instantiate LV2 GUI") << endmsg;
+ return;
+ }
+
#define GET_WIDGET(inst) suil_instance_get_widget((SuilInstance*)inst);
const uint32_t num_ports = _lv2->num_ports();
}
_external_ui_ptr = NULL;
- if (_inst) {
- if (!is_external_ui) {
- GtkWidget* c_widget = (GtkWidget*)GET_WIDGET(_inst);
- if (!c_widget) {
- error << _("failed to get LV2 UI widget") << endmsg;
- suil_instance_free((SuilInstance*)_inst);
- _inst = NULL;
- return;
- }
- if (!container->get_child()) {
- // Suil didn't add the UI to the container for us, so do it now
- container->add(*Gtk::manage(Glib::wrap(c_widget)));
- }
- container->show_all();
- } else {
- _external_ui_ptr = (struct lv2_external_ui*)GET_WIDGET(_inst);
+ if (!is_external_ui) {
+ GtkWidget* c_widget = (GtkWidget*)GET_WIDGET(_inst);
+ if (!c_widget) {
+ error << _("failed to get LV2 UI widget") << endmsg;
+ suil_instance_free((SuilInstance*)_inst);
+ _inst = NULL;
+ return;
+ }
+ if (!container->get_child()) {
+ // Suil didn't add the UI to the container for us, so do it now
+ container->add(*Gtk::manage(Glib::wrap(c_widget)));
}
+ container->show_all();
+ gtk_widget_set_can_focus(c_widget, true);
+ gtk_widget_grab_focus(c_widget);
+ } else {
+ _external_ui_ptr = (struct lv2_external_ui*)GET_WIDGET(_inst);
}
_values = new float[num_ports];
}
}
+void
+LV2PluginUI::grab_focus()
+{
+ if (_inst && !_lv2->is_external_ui()) {
+ GtkWidget* c_widget = (GtkWidget*)GET_WIDGET(_inst);
+ gtk_widget_grab_focus(c_widget);
+ }
+}
+
void
LV2PluginUI::lv2ui_free()
{
lv2ui_instantiate("gtk2gui");
}
- return true;
+ return _inst ? true : false;
}
void