Merge branch 'master' into windows
[ardour.git] / gtk2_ardour / plugin_ui.cc
index 943a7a8bce4b058a77588a1710cfb22def3a8892..4423e3905dced33d360825f931aa25ab712c9e6b 100644 (file)
@@ -40,8 +40,6 @@
 #include <gtkmm2ext/slider_controller.h>
 #include <gtkmm2ext/application.h>
 
-#include "midi++/manager.h"
-
 #include "ardour/session.h"
 #include "ardour/plugin.h"
 #include "ardour/plugin_insert.h"
@@ -59,8 +57,6 @@
 #include "lv2_plugin_ui.h"
 #endif
 
-#include <lrdf.h>
-
 #include "ardour_window.h"
 #include "ardour_ui.h"
 #include "prompter.h"
@@ -148,7 +144,6 @@ PluginUIWindow::PluginUIWindow (
        set_name ("PluginEditor");
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
 
-       signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)), false);
        insert->DropReferences.connect (death_connection, invalidator (*this), boost::bind (&PluginUIWindow::plugin_going_away, this), gui_context());
 
        gint h = _pluginui->get_preferred_height ();
@@ -164,6 +159,7 @@ PluginUIWindow::PluginUIWindow (
 
 PluginUIWindow::~PluginUIWindow ()
 {
+       cerr << "PluginWindow deleted for " << this << endl;
        delete _pluginui;
 }
 
@@ -408,8 +404,6 @@ PluginUIWindow::plugin_going_away ()
        }
 
        death_connection.disconnect ();
-
-       delete_when_idle (this);
 }
 
 PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
@@ -565,9 +559,14 @@ PlugUIBase::preset_selected ()
        }
 }
 
+#ifdef NO_PLUGIN_STATE
+static bool seen_saving_message = false;
+#endif
+
 void
 PlugUIBase::add_plugin_setting ()
 {
+#ifndef NO_PLUGIN_STATE
        NewPluginPresetDialog d (plugin);
 
        switch (d.run ()) {
@@ -586,23 +585,49 @@ PlugUIBase::add_plugin_setting ()
                }
                break;
        }
+#else 
+       if (!seen_saving_message) {
+               info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a full version"),
+                                       PROGRAM_NAME)
+                    << endmsg;
+               seen_saving_message = true;
+       }
+#endif
 }
 
 void
 PlugUIBase::save_plugin_setting ()
 {
+#ifndef NO_PLUGIN_STATE
        string const name = _preset_combo.get_active_text ();
        plugin->remove_preset (name);
        Plugin::PresetRecord const r = plugin->save_preset (name);
        if (!r.uri.empty ()) {
                plugin->load_preset (r);
        }
+#else 
+       if (!seen_saving_message) {
+               info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a newer version"),
+                                       PROGRAM_NAME)
+                    << endmsg;
+               seen_saving_message = true;
+       }
+#endif
 }
 
 void
 PlugUIBase::delete_plugin_setting ()
 {
+#ifndef NO_PLUGIN_STATE
        plugin->remove_preset (_preset_combo.get_active_text ());
+#else
+       if (!seen_saving_message) {
+               info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a newer version"),
+                                       PROGRAM_NAME)
+                    << endmsg;
+               seen_saving_message = true;
+       }
+#endif
 }
 
 bool