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:
parent
1078dc7eda
commit
056189c76c
|
@ -638,7 +638,7 @@ ARDOUR_UI::tabs_page_added (Widget*,guint)
|
|||
if (_tabs.get_n_pages() > 1) {
|
||||
|
||||
std::vector<TargetEntry> drag_target_entries;
|
||||
drag_target_entries.push_back (TargetEntry ("tabbable"));
|
||||
drag_target_entries.push_back (TargetEntry ("ardour/x-tabbable"));
|
||||
|
||||
editor_visibility_button.drag_source_set (drag_target_entries);
|
||||
mixer_visibility_button.drag_source_set (drag_target_entries);
|
||||
|
|
|
@ -268,8 +268,8 @@ Editor::initialize_canvas ()
|
|||
|
||||
vector<TargetEntry> target_table;
|
||||
|
||||
target_table.push_back (TargetEntry ("regions")); // DnD from the region list will generate this target
|
||||
target_table.push_back (TargetEntry ("sources")); // DnD from the source list will generate this target
|
||||
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 ("text/uri-list"));
|
||||
target_table.push_back (TargetEntry ("text/plain"));
|
||||
target_table.push_back (TargetEntry ("application/x-rootwin-drop"));
|
||||
|
@ -391,9 +391,9 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
|
|||
if (!ARDOUR_UI_UTILS::engine_is_running ()) {
|
||||
return;
|
||||
}
|
||||
if (data.get_target() == X_("regions")) {
|
||||
if (data.get_target() == "x-ardour/region.erl") {
|
||||
drop_regions (context, x, y, data, info, time, true);
|
||||
} else if (data.get_target() == X_("sources")) {
|
||||
} else if (data.get_target() == "x-ardour/region.esl") {
|
||||
drop_regions (context, x, y, data, info, time, false);
|
||||
} else {
|
||||
drop_paths (context, x, y, data, info, time);
|
||||
|
|
|
@ -1210,8 +1210,10 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
|
||||
if (can_drop) {
|
||||
|
||||
if (target == X_("regions")) {
|
||||
if (target == "x-ardour/region.erl") {
|
||||
region = _regions->get_dragged_region ();
|
||||
} else if (target == "x-ardour/region.esl") {
|
||||
region = _sources->get_dragged_region ();
|
||||
}
|
||||
|
||||
if (region) {
|
||||
|
|
|
@ -272,7 +272,7 @@ EditorRegions::EditorRegions (Editor* e)
|
|||
opaque_cell->signal_toggled ().connect (sigc::mem_fun (*this, &EditorRegions::opaque_changed));
|
||||
|
||||
_display.get_selection ()->set_mode (SELECTION_MULTIPLE);
|
||||
_display.add_object_drag (_columns.region.index (), "regions");
|
||||
_display.add_object_drag (_columns.region.index (), "x-ardour/region.erl", TARGET_SAME_APP);
|
||||
_display.set_drag_column (_columns.name.index ());
|
||||
|
||||
/* setup DnD handling */
|
||||
|
|
|
@ -227,7 +227,7 @@ EditorSources::EditorSources (Editor* e)
|
|||
tv_col->set_expand (true);
|
||||
|
||||
_display.get_selection()->set_mode (SELECTION_MULTIPLE);
|
||||
_display.add_object_drag (_columns.region.index(), "regions");
|
||||
_display.add_object_drag (_columns.region.index (), "x-ardour/region.esl", TARGET_SAME_APP);
|
||||
_display.set_drag_column (_columns.name.index());
|
||||
|
||||
/* setup DnD handling */
|
||||
|
|
|
@ -155,7 +155,7 @@ Mixer_UI::Mixer_UI ()
|
|||
|
||||
/* set up drag-n-drop */
|
||||
vector<TargetEntry> target_table;
|
||||
target_table.push_back (TargetEntry ("PluginFavoritePtr"));
|
||||
target_table.push_back (TargetEntry ("x-ardour/plugin.favorite", Gtk::TARGET_SAME_APP));
|
||||
scroller_base.drag_dest_set (target_table);
|
||||
scroller_base.signal_drag_data_received().connect (sigc::mem_fun(*this, &Mixer_UI::scroller_drag_data_received));
|
||||
|
||||
|
@ -229,7 +229,7 @@ Mixer_UI::Mixer_UI ()
|
|||
group_display_frame.add (group_display_vbox);
|
||||
|
||||
list<TargetEntry> target_list;
|
||||
target_list.push_back (TargetEntry ("PluginPresetPtr"));
|
||||
target_list.push_back (TargetEntry ("x-ardour/plugin.preset", Gtk::TARGET_SAME_APP));
|
||||
|
||||
favorite_plugins_model = PluginTreeStore::create (favorite_plugins_columns);
|
||||
favorite_plugins_display.set_model (favorite_plugins_model);
|
||||
|
@ -240,7 +240,7 @@ Mixer_UI::Mixer_UI ()
|
|||
favorite_plugins_display.set_headers_visible (false);
|
||||
favorite_plugins_display.set_rules_hint (true);
|
||||
favorite_plugins_display.set_can_focus (false);
|
||||
favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "PluginFavoritePtr");
|
||||
favorite_plugins_display.add_object_drag (favorite_plugins_columns.plugin.index(), "x-ardour/plugin.favorite", Gtk::TARGET_SAME_APP);
|
||||
favorite_plugins_display.set_drag_column (favorite_plugins_columns.name.index());
|
||||
favorite_plugins_display.add_drop_targets (target_list);
|
||||
favorite_plugins_display.signal_row_activated().connect (sigc::mem_fun (*this, &Mixer_UI::plugin_row_activated));
|
||||
|
@ -2406,7 +2406,7 @@ Mixer_UI::strip_scroller_button_event (GdkEventButton* ev)
|
|||
void
|
||||
Mixer_UI::scroller_drag_data_received (const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& data, guint info, guint time)
|
||||
{
|
||||
if (data.get_target() != "PluginFavoritePtr") {
|
||||
if (data.get_target() != "x-ardour/plugin.favorite") {
|
||||
context->drag_finish (false, false, time);
|
||||
return;
|
||||
}
|
||||
|
@ -3490,7 +3490,7 @@ Mixer_UI::plugin_drag_motion (const Glib::RefPtr<Gdk::DragContext>& ctx, int x,
|
|||
ctx->drag_status (Gdk::ACTION_MOVE, time);
|
||||
return true;
|
||||
}
|
||||
} else if (target == "PluginPresetPtr") {
|
||||
} else if (target == "x-ardour/plugin.preset") {
|
||||
ctx->drag_status (Gdk::ACTION_COPY, time);
|
||||
//favorite_plugins_mode_combo.set_active_text (_("Favorite Plugins"));
|
||||
return true;
|
||||
|
@ -3503,7 +3503,7 @@ Mixer_UI::plugin_drag_motion (const Glib::RefPtr<Gdk::DragContext>& ctx, int x,
|
|||
void
|
||||
Mixer_UI::plugin_drop (const Glib::RefPtr<Gdk::DragContext>&, const Gtk::SelectionData& data)
|
||||
{
|
||||
if (data.get_target() != "PluginPresetPtr") {
|
||||
if (data.get_target() != "x-ardour/plugin.preset") {
|
||||
return;
|
||||
}
|
||||
if (data.get_length() != sizeof (PluginPresetPtr)) {
|
||||
|
|
|
@ -105,7 +105,7 @@ PluginSelector::PluginSelector (PluginManager& mgr)
|
|||
plugin_display.set_headers_clickable (true);
|
||||
plugin_display.set_reorderable (false);
|
||||
plugin_display.set_rules_hint (true);
|
||||
plugin_display.add_object_drag (plugin_columns.plugin.index(), "PluginInfoPtr");
|
||||
plugin_display.add_object_drag (plugin_columns.plugin.index(), "x-ardour/plugin.info");
|
||||
plugin_display.set_drag_column (plugin_columns.name.index());
|
||||
|
||||
// setting a sort-column prevents re-ordering via Drag/Drop
|
||||
|
|
|
@ -338,7 +338,7 @@ ProcessorEntry::can_copy_state (Gtkmm2ext::DnDVBoxChild* o) const
|
|||
bool
|
||||
ProcessorEntry::drag_data_get (Glib::RefPtr<Gdk::DragContext> const, Gtk::SelectionData &data)
|
||||
{
|
||||
if (data.get_target() == "PluginPresetPtr") {
|
||||
if (data.get_target() == "x-ardour/plugin.preset") {
|
||||
boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (_processor);
|
||||
|
||||
if (!_plugin_preset_pointer || !pi) {
|
||||
|
@ -1801,24 +1801,24 @@ ProcessorEntry::LuaPluginDisplay::render_inline (cairo_t *cr, uint32_t width)
|
|||
static std::list<Gtk::TargetEntry> drop_targets()
|
||||
{
|
||||
std::list<Gtk::TargetEntry> tmp;
|
||||
tmp.push_back (Gtk::TargetEntry ("processor")); // from processor-box to processor-box
|
||||
tmp.push_back (Gtk::TargetEntry ("PluginInfoPtr")); // from plugin-manager
|
||||
tmp.push_back (Gtk::TargetEntry ("PluginFavoritePtr")); // from sidebar
|
||||
tmp.push_back (Gtk::TargetEntry ("x-ardour/processor", Gtk::TARGET_SAME_APP)); // from processor-box to processor-box
|
||||
tmp.push_back (Gtk::TargetEntry ("x-ardour/plugin.info", Gtk::TARGET_SAME_APP)); // from plugin-manager
|
||||
tmp.push_back (Gtk::TargetEntry ("x-ardour/plugin.favorite", Gtk::TARGET_SAME_APP)); // from sidebar
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static std::list<Gtk::TargetEntry> drag_targets()
|
||||
{
|
||||
std::list<Gtk::TargetEntry> tmp;
|
||||
tmp.push_back (Gtk::TargetEntry ("PluginPresetPtr")); // to sidebar (optional preset)
|
||||
tmp.push_back (Gtk::TargetEntry ("processor")); // to processor-box (copy)
|
||||
tmp.push_back (Gtk::TargetEntry ("x-ardour/processor", Gtk::TARGET_SAME_APP)); // to processor-box (copy)
|
||||
tmp.push_back (Gtk::TargetEntry ("x-ardour/plugin.preset", Gtk::TARGET_SAME_APP)); // to sidebar (optional preset)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static std::list<Gtk::TargetEntry> drag_targets_noplugin()
|
||||
{
|
||||
std::list<Gtk::TargetEntry> tmp;
|
||||
tmp.push_back (Gtk::TargetEntry ("processor")); // to processor box (sends, faders re-order)
|
||||
tmp.push_back (Gtk::TargetEntry ("x-ardour/processor", Gtk::TARGET_SAME_APP)); // to processor box (sends, faders re-order)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
@ -2011,10 +2011,10 @@ ProcessorBox::plugin_drop (Gtk::SelectionData const &data, ProcessorEntry* posit
|
|||
boost::shared_ptr<Processor> p = find_drop_position (position);
|
||||
Route::ProcessorList pl;
|
||||
|
||||
if (data.get_target() == "PluginInfoPtr") {
|
||||
if (data.get_target() == "x-ardour/plugin.info") {
|
||||
_drop_plugin (data, pl);
|
||||
}
|
||||
else if (data.get_target() == "PluginFavoritePtr") {
|
||||
else if (data.get_target() == "x-ardour/plugin.favorite") {
|
||||
_drop_plugin_preset (data, pl);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -106,7 +106,8 @@ TriggerPage::TriggerPage ()
|
|||
_no_strips.signal_drag_data_received ().connect (sigc::mem_fun (*this, &TriggerPage::no_strip_drag_data_received));
|
||||
|
||||
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"));
|
||||
|
@ -519,7 +520,7 @@ TriggerPage::no_strip_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context
|
|||
void
|
||||
TriggerPage::no_strip_drag_data_received (Glib::RefPtr<Gdk::DragContext> const& context, int /*x*/, int y, Gtk::SelectionData const& data, guint /*info*/, guint time)
|
||||
{
|
||||
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 ();
|
||||
boost::shared_ptr<TriggerBox> triggerbox;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user