set DnD targets per processor
authorRobin Gareus <robin@gareus.org>
Wed, 30 Dec 2015 11:15:25 +0000 (12:15 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 30 Dec 2015 11:25:09 +0000 (12:25 +0100)
This prevents DnD of non-processors to the sidebar

gtk2_ardour/processor_box.cc

index 73abc02c43ea00d1097392b9623f779c869203cf..181fc22a19c6342e5576aa47c7bda50d237e2e55 100644 (file)
@@ -221,8 +221,14 @@ ProcessorEntry::drag_text () const
 bool
 ProcessorEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &data)
 {
-       if (data.get_target() == "PluginPresetPtr" && _plugin_preset_pointer) {
+       if (data.get_target() == "PluginPresetPtr") {
                boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
+
+               if (!_plugin_preset_pointer || !pi) {
+                       data.set (data.get_target(), 8, NULL, 0);
+                       return true;
+               }
+
                boost::shared_ptr<ARDOUR::Plugin> plugin = pi->plugin();
                assert (plugin);
 
@@ -1105,6 +1111,13 @@ static std::list<Gtk::TargetEntry> drop_targets()
        return tmp;
 }
 
+static std::list<Gtk::TargetEntry> drop_targets_noplugin()
+{
+       std::list<Gtk::TargetEntry> tmp;
+       tmp.push_back (Gtk::TargetEntry ("processor"));
+       return tmp;
+}
+
 ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function<PluginSelector*()> get_plugin_selector,
                            RouteProcessorSelection& rsel, MixerStrip* parent, bool owner_is_mixer)
        : _parent_strip (parent)
@@ -2069,7 +2082,16 @@ ProcessorBox::add_processor_to_display (boost::weak_ptr<Processor> p)
                e->show_all_controls ();
        }
 
-       processor_display.add_child (e);
+       if (plugin_insert
+#ifdef MIXBUS
+                       && !plugin_insert->plugin(0)->is_channelstrip()
+#endif
+                )
+       {
+               processor_display.add_child (e);
+       } else {
+               processor_display.add_child (e, drop_targets_noplugin());
+       }
 }
 
 void