13
0

Fix Trigger DnD

Revert parts of 8c144d6e69 and 0f4a5f2d52
Allow to drag regions out of trigger-boxes (this will be needed
to export triggers).
This commit is contained in:
Robin Gareus 2022-01-27 22:15:46 +01:00
parent 15bb91cf4f
commit c9e9843a9e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -803,12 +803,16 @@ TriggerEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const&, Gtk::Selecti
*/
return;
}
if (data.get_target () != "x-ardour/trigger.pbdid") {
return;
if (data.get_target () == "x-ardour/region.pbdid") {
boost::shared_ptr<Region> region = trigger ()->region ();
if (region) {
data.set (data.get_target (), region->id ().to_s ());
}
}
if (data.get_target () == "x-ardour/trigger.pbdid") {
data.set (data.get_target (), trigger()->id ().to_s ());
}
}
/* ***************************************************** */
@ -832,6 +836,7 @@ TriggerBoxUI::TriggerBoxUI (ArdourCanvas::Item* parent, TriggerBox& tb)
if (!_dnd_src) {
std::vector<Gtk::TargetEntry> source_table;
source_table.push_back (Gtk::TargetEntry ("x-ardour/trigger.pbdid", Gtk::TARGET_SAME_APP));
source_table.push_back (Gtk::TargetEntry ("x-ardour/region.pbdid", Gtk::TARGET_SAME_APP));
_dnd_src = Gtk::TargetList::create (source_table);
}
@ -929,11 +934,9 @@ TriggerBoxUI::drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int, i
std::string target = gtkcanvas->drag_dest_find_target (context, gtkcanvas->drag_dest_get_target_list ());
if ((target == "x-ardour/region.pbdid") || (target == "x-ardour/trigger.pbdid")) {
can_drop &= PublicEditor::instance ().pbdid_dragged_dt == _triggerbox.data_type ();
can_drop = PublicEditor::instance ().pbdid_dragged_dt == _triggerbox.data_type ();
}
//TODO: currently for a 'plain' list of paths we are unable to report to the user if the slot can accept it.
uint64_t n = slot_at_y (y);
if (n >= _slots.size ()) {
assert (0);