add plugin parameter reset button - closes #6297
[ardour.git] / gtk2_ardour / lv2_plugin_ui.cc
index 3a64a830d16d43a4adad471789d2b36871bdadca..d19c7e6f6f61133f2279f0ac7be2cd09d20f56fa 100644 (file)
@@ -205,7 +205,8 @@ LV2PluginUI::LV2PluginUI(boost::shared_ptr<PluginInsert> pi,
        _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);
@@ -285,7 +286,7 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
        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_1
+#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
@@ -341,6 +342,8 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
                                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);
                }
@@ -368,6 +371,15 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
        }
 }
 
+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()
 {