diff options
author | David Robillard <d@drobilla.net> | 2014-11-16 17:04:27 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-16 22:35:45 -0500 |
commit | 2fa6caad95d81f058326d931532f687a157361be (patch) | |
tree | 2981806b2bfec9351d62ccfc7e5d0e7dfe3581aa /gtk2_ardour/automation_region_view.cc | |
parent | 5393982c8022d4117a6fe29340f8ecf2d115648d (diff) |
Support cut/copy/paste of several regions and lines at once.
The idea here is to do the reasonable thing, and copy objects of some
type (e.g. MIDI region, gain line) to tracks with a matching type. The user
can override this with a track selection, which will be used straight-up.
Lost: ability to copy/paste lines across types, e.g. gain to pan. This is
often questionable, but sometimes useful, so we will need to implement some
sort of "greedy mode" to make it possible. Implementation simple, but not sure
what to do. Perhaps this should only be possible if one automation track is
explicitly (i.e. via track selection) involved, and the types are at least
compatible-ish?
Diffstat (limited to 'gtk2_ardour/automation_region_view.cc')
-rw-r--r-- | gtk2_ardour/automation_region_view.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 59bc1f6250..76591fa3d8 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -192,6 +192,34 @@ AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double view->session()->set_dirty (); } +bool +AutomationRegionView::paste (framepos_t pos, + unsigned paste_count, + float times, + boost::shared_ptr<const ARDOUR::AutomationList> slist) +{ + AutomationTimeAxisView* const view = automation_view(); + boost::shared_ptr<ARDOUR::AutomationList> my_list = _line->the_list(); + + if (view->session()->transport_rolling() && my_list->automation_write()) { + /* do not paste if this control is in write mode and we're rolling */ + return false; + } + + /* add multi-paste offset if applicable */ + pos += view->editor().get_paste_offset( + pos, paste_count, _line->time_converter().to(slist->length())); + + const double model_pos = _line->time_converter().from(pos - _line->time_converter().origin_b()); + + XMLNode& before = my_list->get_state(); + my_list->paste(*slist, model_pos, times); + view->session()->add_command( + new MementoCommand<ARDOUR::AutomationList>(*my_list.get(), &before, &my_list->get_state())); + + return true; +} + void AutomationRegionView::set_height (double h) { |