Make lv2ui_instantiate and lv2ui_free a little more symmetrical, so that there aren...
authorCarl Hetherington <carl@carlh.net>
Sun, 4 Mar 2012 21:45:51 +0000 (21:45 +0000)
committerCarl Hetherington <carl@carlh.net>
Sun, 4 Mar 2012 21:45:51 +0000 (21:45 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11589 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/lv2_plugin_ui.cc
gtk2_ardour/lv2_plugin_ui.h

index b5a4f0b83e2cee9217f97baa296a210fc84c9a08..d014cddd10bc6435f4cbd4db5486a87d1956957c 100644 (file)
@@ -151,6 +151,7 @@ LV2PluginUI::LV2PluginUI(boost::shared_ptr<PluginInsert> pi,
        : PlugUIBase(pi)
        , _lv2(lv2p)
        , _gui_widget(NULL)
+       , _ardour_buttons_box(NULL)
        , _values(NULL)
        , _external_ui_ptr(NULL)
        , _inst(NULL)
@@ -228,17 +229,17 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
        _external_ui_ptr = NULL;
        if (_inst) {
                if (!is_external_ui) {
-                       Gtk::HBox* box = manage (new Gtk::HBox);
-                       box->set_spacing (6);
-                       box->set_border_width (6);
-                       box->pack_end (focus_button, false, false);
-                       box->pack_end (bypass_button, false, false, 10);
-                       box->pack_end (delete_button, false, false);
-                       box->pack_end (save_button, false, false);
-                       box->pack_end (add_button, false, false);
-                       box->pack_end (_preset_combo, false, false);
-                       box->show_all();
-                       pack_start(*box, false, false);
+                       _ardour_buttons_box = manage (new Gtk::HBox);
+                       _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 (delete_button, false, false);
+                       _ardour_buttons_box->pack_end (save_button, false, false);
+                       _ardour_buttons_box->pack_end (add_button, false, false);
+                       _ardour_buttons_box->pack_end (_preset_combo, false, false);
+                       _ardour_buttons_box->show_all();
+                       pack_start(*_ardour_buttons_box, false, false);
 
                        GtkWidget* c_widget = (GtkWidget*)GET_WIDGET(_inst);
                        _gui_widget = Glib::wrap(c_widget);
@@ -281,6 +282,12 @@ LV2PluginUI::lv2ui_free()
                remove (*_gui_widget);
        }
 
+       if (_ardour_buttons_box) {
+               remove (*_ardour_buttons_box);
+               delete _ardour_buttons_box;
+               _ardour_buttons_box = 0;
+       }
+
        suil_instance_free((SuilInstance*)_inst);
 
        _inst = NULL;
index 7284f82128b0c48a2873fb6a87bad0f769b3d0b0..d245ed31a1bd0cbf215b14037f252d547c9238d1 100644 (file)
@@ -68,6 +68,8 @@ class LV2PluginUI : public PlugUIBase, public Gtk::VBox
        std::vector<int>                     _output_ports;
        sigc::connection                     _screen_update_connection;
        Gtk::Widget*                         _gui_widget;
+       /** a box containing the focus, bypass, delete, save / add preset buttons etc. */
+       Gtk::HBox*                           _ardour_buttons_box;
        float*                               _values;
        std::vector<ControllableRef>         _controllables;
        struct lv2_external_ui_host          _external_ui_host;