Clean up DnD, use MIME-types

This is in preparation for allowing to drag trigger-regions
or trigger-slots. Those will not use a static singleton
PublicEditor API.

Additionally this constrains Ardour-internal drags to Ardour
(via Gtk::TARGET_SAME_APP).
This commit is contained in:
Robin Gareus 2022-01-10 21:29:29 +01:00
parent 1078dc7eda
commit 056189c76c
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
10 changed files with 32 additions and 28 deletions

View file

@ -736,7 +736,8 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
_selection_connection = PublicEditor::instance ().get_selection ().TriggersChanged.connect (sigc::mem_fun (*this, &TriggerBoxUI::selection_changed));
std::vector<Gtk::TargetEntry> target_table;
target_table.push_back (Gtk::TargetEntry ("regions"));
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.erl", Gtk::TARGET_SAME_APP));
target_table.push_back (Gtk::TargetEntry ("x-ardour/region.esl", Gtk::TARGET_SAME_APP));
target_table.push_back (Gtk::TargetEntry ("text/uri-list"));
target_table.push_back (Gtk::TargetEntry ("text/plain"));
target_table.push_back (Gtk::TargetEntry ("application/x-rootwin-drop"));
@ -870,7 +871,7 @@ TriggerBoxUI::drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context,
context->drag_finish (false, false, time);
return;
}
if (data.get_target () == X_("regions")) {
if (data.get_target () == "x-ardour/region.erl" || data.get_target () == "x-ardour/region.esl") {
boost::shared_ptr<Region> region = PublicEditor::instance ().get_dragged_region_from_sidebar ();
if (region) {
_triggerbox.set_from_selection (n, region);