Unify Region Drag/Drop

Identify Regions using PDB::ID. This allows dragging regions
from almost anywhere to anywhere, without special cases.
This commit is contained in:
Robin Gareus 2022-01-18 06:52:57 +01:00
parent 5427cec821
commit 0204ea1f24
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
13 changed files with 64 additions and 118 deletions

View file

@ -855,8 +855,6 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
}
std::vector<Gtk::TargetEntry> target_table;
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 ("x-ardour/region.pbdid", Gtk::TARGET_SAME_APP));
target_table.push_back (Gtk::TargetEntry ("text/uri-list"));
target_table.push_back (Gtk::TargetEntry ("text/plain"));
@ -986,21 +984,8 @@ TriggerBoxUI::drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context,
context->drag_finish (false, false, time);
return;
}
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);
context->drag_finish (true, false, time);
} else {
context->drag_finish (false, false, time);
}
return;
}
if (data.get_target () == "x-ardour/region.pbdid") {
/* Long term goal is to receive all information from another TriggerBox Slot,
* not just the region.
*/
PBD::ID rid (data.get_data_as_string ());
boost::shared_ptr<Region> region = RegionFactory::region_by_id (rid);
if (region) {