summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_time_axis.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-11-14 20:04:09 -0500
committerDavid Robillard <d@drobilla.net>2014-11-14 20:04:19 -0500
commit31acd96384b930de928aa8c7969336ba3401bbed (patch)
tree69137126cf3738fb242a7ff1d3875927c82f7541 /gtk2_ardour/automation_time_axis.cc
parentb01d1813f88e303bae724d5bc6f51de0c2fb4e1b (diff)
Implement "multi-paste" for notes, regions, and automation.
The idea here is that pasting several times to the same location doesn't make sense. Instead, the paste is appended past the last paste, snapped to the grid. This make it simple to replicate a given section a number of times, simply by copying once and pasting several times. This behaviour only appears when successive pastes are done to the same location (whatever the edit point is). When the paste point changes, the "multi-paste" state is reset. Boots 'n cats 'n boots 'n cats.
Diffstat (limited to 'gtk2_ardour/automation_time_axis.cc')
-rw-r--r--gtk2_ardour/automation_time_axis.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 2c342fb8c9..e0e9b9428f 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -637,7 +637,7 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
* @param nth Index of the AutomationList within the selection to paste from.
*/
bool
-AutomationTimeAxisView::paste (framepos_t pos, float times, Selection& selection, size_t nth)
+AutomationTimeAxisView::paste (framepos_t pos, unsigned paste_count, float times, Selection& selection, size_t nth)
{
boost::shared_ptr<AutomationLine> line;
@@ -651,11 +651,11 @@ AutomationTimeAxisView::paste (framepos_t pos, float times, Selection& selection
return false;
}
- return paste_one (*line, pos, times, selection, nth);
+ return paste_one (*line, pos, paste_count, times, selection, nth);
}
bool
-AutomationTimeAxisView::paste_one (AutomationLine& line, framepos_t pos, float times, Selection& selection, size_t nth)
+AutomationTimeAxisView::paste_one (AutomationLine& line, framepos_t pos, unsigned paste_count, float times, Selection& selection, size_t nth)
{
AutomationSelection::iterator p;
boost::shared_ptr<AutomationList> alist(line.the_list());
@@ -671,6 +671,9 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, framepos_t pos, float t
return false;
}
+ /* add multi-paste offset if applicable */
+ pos += _editor.get_paste_offset(pos, paste_count, (*p)->length());
+
double const model_pos = line.time_converter().from (pos - line.time_converter().origin_b ());
XMLNode &before = alist->get_state();