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

@ -268,8 +268,7 @@ Editor::initialize_canvas ()
vector<TargetEntry> target_table;
target_table.push_back (TargetEntry ("x-ardour/region.erl", TARGET_SAME_APP)); // DnD from the region list will generate this target
target_table.push_back (TargetEntry ("x-ardour/region.esl", TARGET_SAME_APP)); // DnD from the source list will generate this target
target_table.push_back (TargetEntry ("x-ardour/region.pbdid", TARGET_SAME_APP));
target_table.push_back (TargetEntry ("text/uri-list"));
target_table.push_back (TargetEntry ("text/plain"));
target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
@ -391,10 +390,8 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
if (!ARDOUR_UI_UTILS::engine_is_running ()) {
return;
}
if (data.get_target() == "x-ardour/region.erl") {
drop_regions (context, x, y, data, info, time, true);
} else if (data.get_target() == "x-ardour/region.esl") {
drop_regions (context, x, y, data, info, time, false);
if (data.get_target() == "x-ardour/region.pbdid") {
drop_regions (context, x, y, data, info, time);
} else {
drop_paths (context, x, y, data, info, time);
}