summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_time_axis.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-06 12:20:52 -0500
committerDavid Robillard <d@drobilla.net>2014-12-06 12:20:52 -0500
commit63082821d87a8be61982adc551a35fd399f346a2 (patch)
tree68fdf3115c3ba8fe87ed99a076aad5ff8a1b3792 /gtk2_ardour/automation_time_axis.cc
parentdb1fc6c3fa5129f0ac20c6668339c477c8ee9447 (diff)
Support paste between automation lanes.
Also push the increasingly unwieldly paste parameters into a context object. As with othe things, currently it is only possible to do "cross-type paste" by explicitly selecting the target track. We will need to get automation region view selection working to do better here, but at least for now it's possible to get the data over.
Diffstat (limited to 'gtk2_ardour/automation_time_axis.cc')
-rw-r--r--gtk2_ardour/automation_time_axis.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 67e7c06421..e2a0effb39 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -43,6 +43,7 @@
#include "gui_thread.h"
#include "route_time_axis.h"
#include "automation_line.h"
+#include "paste_context.h"
#include "public_editor.h"
#include "selection.h"
#include "rgb_macros.h"
@@ -633,14 +634,19 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, framepos_t when,
}
bool
-AutomationTimeAxisView::paste (framepos_t pos, unsigned paste_count, float times, const Selection& selection, ItemCounts& counts)
+AutomationTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx)
{
if (_line) {
- return paste_one (pos, paste_count, times, selection, counts);
+ return paste_one (pos, ctx.count, ctx.times, selection, ctx.counts, ctx.greedy);
} else if (_view) {
- AutomationSelection::const_iterator l = selection.lines.get_nth(_parameter, counts.n_lines(_parameter));
- if (l != selection.lines.end() && _view->paste (pos, paste_count, times, *l)) {
- counts.increase_n_lines(_parameter);
+ AutomationSelection::const_iterator l = selection.lines.get_nth(_parameter, ctx.counts.n_lines(_parameter));
+ if (l == selection.lines.end()) {
+ if (ctx.greedy && selection.lines.size() == 1) {
+ l = selection.lines.begin();
+ }
+ }
+ if (l != selection.lines.end() && _view->paste (pos, ctx.count, ctx.times, *l)) {
+ ctx.counts.increase_n_lines(_parameter);
return true;
}
}
@@ -649,7 +655,7 @@ AutomationTimeAxisView::paste (framepos_t pos, unsigned paste_count, float times
}
bool
-AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float times, const Selection& selection, ItemCounts& counts)
+AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float times, const Selection& selection, ItemCounts& counts, bool greedy)
{
boost::shared_ptr<AutomationList> alist(_line->the_list());
@@ -661,7 +667,11 @@ AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float t
/* Get appropriate list from selection. */
AutomationSelection::const_iterator p = selection.lines.get_nth(_parameter, counts.n_lines(_parameter));
if (p == selection.lines.end()) {
- return false;
+ if (greedy && selection.lines.size() == 1) {
+ p = selection.lines.begin();
+ } else {
+ return false;
+ }
}
counts.increase_n_lines(_parameter);