From bcaae13e3e7c764d8e3184d151f348676056ba17 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 30 Dec 2015 12:15:25 +0100 Subject: [PATCH] set DnD targets per processor This prevents DnD of non-processors to the sidebar --- gtk2_ardour/processor_box.cc | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 73abc02c43..181fc22a19 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -221,8 +221,14 @@ ProcessorEntry::drag_text () const bool ProcessorEntry::drag_data_get (Glib::RefPtr const, Gtk::SelectionData &data) { - if (data.get_target() == "PluginPresetPtr" && _plugin_preset_pointer) { + if (data.get_target() == "PluginPresetPtr") { boost::shared_ptr pi = boost::dynamic_pointer_cast (_processor); + + if (!_plugin_preset_pointer || !pi) { + data.set (data.get_target(), 8, NULL, 0); + return true; + } + boost::shared_ptr plugin = pi->plugin(); assert (plugin); @@ -1105,6 +1111,13 @@ static std::list drop_targets() return tmp; } +static std::list drop_targets_noplugin() +{ + std::list tmp; + tmp.push_back (Gtk::TargetEntry ("processor")); + return tmp; +} + ProcessorBox::ProcessorBox (ARDOUR::Session* sess, boost::function 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 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 -- 2.30.2