TriggerBox: allow to receive Regions by ID via DnD
This commit is contained in:
parent
1db6e9edca
commit
1661f6479f
@ -36,6 +36,7 @@
|
||||
#include "ardour/directory_names.h"
|
||||
#include "ardour/filesystem_paths.h"
|
||||
#include "ardour/region.h"
|
||||
#include "ardour/region_factory.h"
|
||||
#include "ardour/triggerbox.h"
|
||||
|
||||
#include "canvas/polygon.h"
|
||||
@ -738,6 +739,7 @@ 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"));
|
||||
target_table.push_back (Gtk::TargetEntry ("application/x-rootwin-drop"));
|
||||
@ -882,6 +884,21 @@ TriggerBoxUI::drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context,
|
||||
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) {
|
||||
_triggerbox.set_from_selection (n, region);
|
||||
context->drag_finish (true, false, time);
|
||||
} else {
|
||||
context->drag_finish (false, false, time);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> paths;
|
||||
if (ARDOUR_UI_UTILS::convert_drop_to_paths (paths, data)) {
|
||||
for (std::vector<std::string>::iterator s = paths.begin (); s != paths.end (); ++s) {
|
||||
|
Loading…
Reference in New Issue
Block a user