Allow to move (cut/paste DnD) region FX

This also prevents copying effects to another RegionFX
Box of the same region (e.g. when using Region Property
Bottom Pane)
This commit is contained in:
Robin Gareus 2024-11-19 04:30:07 +01:00
parent d8a197a63f
commit 49c7464b9c
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 10 additions and 1 deletions

View file

@ -514,7 +514,7 @@ drag_targets ()
RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr<ARDOUR::Region> r) RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr<ARDOUR::Region> r)
: _region (r) : _region (r)
, _display (drop_targets ()) , _display (drop_targets (), Gdk::ACTION_COPY | Gdk::ACTION_MOVE)
, _no_redisplay (false) , _no_redisplay (false)
, _placement (-1) , _placement (-1)
{ {
@ -535,6 +535,7 @@ RegionEditor::RegionFxBox::RegionFxBox (std::shared_ptr<ARDOUR::Region> r)
_display.Reordered.connect (sigc::mem_fun (*this, &RegionFxBox::reordered)); _display.Reordered.connect (sigc::mem_fun (*this, &RegionFxBox::reordered));
_display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &RegionFxBox::object_drop)); _display.DropFromAnotherBox.connect (sigc::mem_fun (*this, &RegionFxBox::object_drop));
_display.DropFromExternal.connect (sigc::mem_fun (*this, &RegionFxBox::plugin_drop)); _display.DropFromExternal.connect (sigc::mem_fun (*this, &RegionFxBox::plugin_drop));
_display.DragRefuse.connect (sigc::mem_fun (*this, &RegionFxBox::drag_refuse));
_display.signal_key_press_event ().connect (sigc::mem_fun (*this, &RegionFxBox::on_key_press), false); _display.signal_key_press_event ().connect (sigc::mem_fun (*this, &RegionFxBox::on_key_press), false);
@ -892,6 +893,13 @@ RegionEditor::RegionFxBox::delete_dragged_plugins (Region::RegionFxList const& f
redisplay_plugins (); redisplay_plugins ();
} }
bool
RegionEditor::RegionFxBox::drag_refuse (Gtkmm2ext::DnDVBox<RegionFxEntry>* source, RegionFxEntry*)
{
RegionFxBox* other = reinterpret_cast<RegionFxBox*> (source->get_data ("regionfxbox"));
return (other && other->_region == _region);
}
void void
RegionEditor::RegionFxBox::object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>* source, RegionFxEntry* pos, Glib::RefPtr<Gdk::DragContext> const& context) RegionEditor::RegionFxBox::object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>* source, RegionFxEntry* pos, Glib::RefPtr<Gdk::DragContext> const& context)
{ {

View file

@ -124,6 +124,7 @@ private:
void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&); void plugin_drop (Gtk::SelectionData const&, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&); void object_drop (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*, Glib::RefPtr<Gdk::DragContext> const&);
void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&); void delete_dragged_plugins (std::list<std::shared_ptr<ARDOUR::RegionFxPlugin>> const&);
bool drag_refuse (Gtkmm2ext::DnDVBox<RegionFxEntry>*, RegionFxEntry*);
std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*); std::shared_ptr<ARDOUR::RegionFxPlugin> find_drop_position (RegionFxEntry*);