major changes to Region, AudioRegion, Playlist, AudioPlaylist and Crossfade state...
[ardour.git] / gtk2_ardour / redirect_box.cc
index 74198265d9e82cb34b9707e7cb061a500b237e81..fcd04c9bd7c51dd4bc7e676af9d5d36f56c12612 100644 (file)
@@ -54,7 +54,6 @@
 #include "route_redirect_selection.h"
 #include "mixer_ui.h"
 #include "actions.h"
-
 #include "plugin_ui.h"
 #include "send_ui.h"
 #include "io_selector.h"
 
 #include "i18n.h"
 
+#ifdef HAVE_AUDIOUNIT
+#include "au_pluginui.h"
+#endif
+
 using namespace sigc;
 using namespace ARDOUR;
 using namespace PBD;
@@ -153,9 +156,9 @@ RedirectBox::~RedirectBox ()
 }
 
 void
-RedirectBox::object_drop (string type, uint32_t cnt, void** ptr)
+RedirectBox::object_drop (string type, uint32_t cnt, const boost::shared_ptr<Redirect>* ptr)
 {
-       if (type != "redirects" || cnt == 0 || ptr == 0) {
+       if (type != "redirects" || cnt == 0 || !ptr) {
                return;
        }
 
@@ -164,7 +167,7 @@ RedirectBox::object_drop (string type, uint32_t cnt, void** ptr)
        list<boost::shared_ptr<Redirect> > redirects;
        
        for (uint32_t n = 0; n < cnt; ++n) {
-               redirects.push_back (boost::shared_ptr<Redirect> ((Redirect*) ptr[n]));
+               redirects.push_back (ptr[n]);
        }
        
        paste_redirect_list (redirects);
@@ -957,44 +960,61 @@ RedirectBox::edit_redirect (boost::shared_ptr<Redirect> redirect)
                
                if ((plugin_insert = boost::dynamic_pointer_cast<PluginInsert> (insert)) != 0) {
                        
-                       PluginUIWindow *plugin_ui;
+                       ARDOUR::PluginType type = plugin_insert->type();
+
+                       if (type == ARDOUR::LADSPA || type == ARDOUR::VST) {
+                               PluginUIWindow *plugin_ui;
                        
-                       if (plugin_insert->get_gui() == 0) {
+                               if (plugin_insert->get_gui() == 0) {
                                
-                               string title;
-                               string maker = plugin_insert->plugin()->maker();
-                               string::size_type email_pos;
+                                       string title;
+                                       string maker = plugin_insert->plugin()->maker();
+                                       string::size_type email_pos;
                                
-                               if ((email_pos = maker.find_first_of ('<')) != string::npos) {
-                                       maker = maker.substr (0, email_pos - 1);
-                               }
+                                       if ((email_pos = maker.find_first_of ('<')) != string::npos) {
+                                               maker = maker.substr (0, email_pos - 1);
+                                       }
                                
-                               if (maker.length() > 32) {
-                                       maker = maker.substr (0, 32);
-                                       maker += " ...";
-                               }
+                                       if (maker.length() > 32) {
+                                               maker = maker.substr (0, 32);
+                                               maker += " ...";
+                                       }
 
-                               title = string_compose(_("ardour: %1: %2 (by %3)"), _route->name(), plugin_insert->name(), maker);      
+                                       title = string_compose(_("ardour: %1: %2 (by %3)"), _route->name(), plugin_insert->name(), maker);      
+                               
+                                       plugin_ui = new PluginUIWindow (plugin_insert);
+                                       if (_owner_is_mixer) {
+                                               ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui);
+                                       } else {
+                                               ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui);
+                                       }
+                                       plugin_ui->set_title (title);
+                                       plugin_insert->set_gui (plugin_ui);
                                
-                               plugin_ui = new PluginUIWindow (_session.engine(), plugin_insert);
-                               if (_owner_is_mixer) {
-                                       ARDOUR_UI::instance()->the_mixer()->ensure_float (*plugin_ui);
                                } else {
-                                       ARDOUR_UI::instance()->the_editor().ensure_float (*plugin_ui);
+                                       plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_insert->get_gui());
                                }
-                               plugin_ui->set_title (title);
-                               plugin_insert->set_gui (plugin_ui);
-                               
-                       } else {
-                               plugin_ui = reinterpret_cast<PluginUIWindow *> (plugin_insert->get_gui());
-                       }
                        
-                       if (plugin_ui->is_visible()) {
-                               plugin_ui->get_window()->raise ();
+                               if (plugin_ui->is_visible()) {
+                                       plugin_ui->get_window()->raise ();
+                               } else {
+                                       plugin_ui->show_all ();
+                               }
+#ifdef HAVE_AUDIOUNIT
+                       } else if (type == ARDOUR::AudioUnit) {
+                               AUPluginUI* plugin_ui;
+                               if (plugin_insert->get_gui() == 0) {
+                                       plugin_ui = new AUPluginUI (plugin_insert);
+                               } else {
+                                       plugin_ui = reinterpret_cast<AUPluginUI*> (plugin_insert->get_gui());
+                               }
+                               
+                               // raise window, somehow
+#endif                         
                        } else {
-                               plugin_ui->show_all ();
+                               warning << "Unsupported plugin sent to RedirectBox::edit_redirect()" << endmsg;
+                               return;
                        }
-                       
                } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (insert)) != 0) {
                        
                        if (!_session.engine().connected()) {