Implement multi-region AutomationRange drag/drop
This commit is contained in:
parent
94271ee862
commit
0ee6b03144
|
@ -6223,7 +6223,7 @@ AutomationRangeDrag::AutomationRangeDrag (Editor* editor, AutomationTimeAxisView
|
|||
}
|
||||
|
||||
/** Make an AutomationRangeDrag for region gain lines or MIDI controller regions */
|
||||
AutomationRangeDrag::AutomationRangeDrag (Editor* editor, RegionView* rv, list<AudioRange> const & r)
|
||||
AutomationRangeDrag::AutomationRangeDrag (Editor* editor, RegionView* rv, list<RegionView*> const & v, list<AudioRange> const & r)
|
||||
: Drag (editor, rv->get_canvas_group ())
|
||||
, _ranges (r)
|
||||
, _y_origin (rv->get_time_axis_view().y_position())
|
||||
|
@ -6234,17 +6234,21 @@ AutomationRangeDrag::AutomationRangeDrag (Editor* editor, RegionView* rv, list<A
|
|||
|
||||
list<boost::shared_ptr<AutomationLine> > lines;
|
||||
|
||||
AudioRegionView* audio_view;
|
||||
AutomationRegionView* automation_view;
|
||||
if ((audio_view = dynamic_cast<AudioRegionView*>(rv))) {
|
||||
lines.push_back (audio_view->get_gain_line ());
|
||||
} else if ((automation_view = dynamic_cast<AutomationRegionView*>(rv))) {
|
||||
lines.push_back (automation_view->line ());
|
||||
_integral = true;
|
||||
} else {
|
||||
error << _("Automation range drag created for invalid region type") << endmsg;
|
||||
bool found_primary = false;
|
||||
for (list<RegionView*>::const_iterator i = v.begin(); i != v.end(); ++i) {
|
||||
if (*i == rv) {
|
||||
found_primary = true;
|
||||
}
|
||||
if (AudioRegionView* audio_view = dynamic_cast<AudioRegionView*>(*i)) {
|
||||
lines.push_back (audio_view->get_gain_line ());
|
||||
} else if (AutomationRegionView* automation_view = dynamic_cast<AutomationRegionView*>(*i)) {
|
||||
lines.push_back (automation_view->line ());
|
||||
_integral = true;
|
||||
} else {
|
||||
error << _("Automation range drag created for invalid region type") << endmsg;
|
||||
}
|
||||
}
|
||||
|
||||
assert (found_primary);
|
||||
setup (lines);
|
||||
}
|
||||
|
||||
|
@ -6254,6 +6258,7 @@ AutomationRangeDrag::AutomationRangeDrag (Editor* editor, RegionView* rv, list<A
|
|||
void
|
||||
AutomationRangeDrag::setup (list<boost::shared_ptr<AutomationLine> > const & lines)
|
||||
{
|
||||
printf ("AutomationRangeDrag::setup %d lines\n", lines.size());
|
||||
/* find the lines that overlap the ranges being dragged */
|
||||
list<boost::shared_ptr<AutomationLine> >::const_iterator i = lines.begin ();
|
||||
while (i != lines.end ()) {
|
||||
|
@ -6344,7 +6349,7 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
|
|||
}
|
||||
|
||||
if (first_move) {
|
||||
_editor->begin_reversible_command (_("automation range move"));
|
||||
_editor->begin_reversible_command (_("automation range move")); // XXX
|
||||
|
||||
if (!_ranges.empty()) {
|
||||
|
||||
|
|
|
@ -1244,7 +1244,7 @@ class AutomationRangeDrag : public Drag
|
|||
{
|
||||
public:
|
||||
AutomationRangeDrag (Editor *, AutomationTimeAxisView *, std::list<ARDOUR::AudioRange> const &);
|
||||
AutomationRangeDrag (Editor *, RegionView *, std::list<ARDOUR::AudioRange> const &);
|
||||
AutomationRangeDrag (Editor *, RegionView *, std::list<RegionView*> const &, std::list<ARDOUR::AudioRange> const &);
|
||||
|
||||
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||
void motion (GdkEvent *, bool);
|
||||
|
|
|
@ -1119,7 +1119,35 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
{
|
||||
if (dynamic_cast<AudioRegionView*>(clicked_regionview) ||
|
||||
dynamic_cast<AutomationRegionView*>(clicked_regionview)) {
|
||||
_drags->set (new AutomationRangeDrag (this, clicked_regionview, selection->time),
|
||||
|
||||
/* collect all regions-views in the given range selection
|
||||
* perhaps this should be a dedicated method:
|
||||
* Editor::get_region_views_from_range_selection() ?
|
||||
* except <RegionView*> c-pointer list is not very reliable.
|
||||
*/
|
||||
list<RegionView*> rvl;
|
||||
TrackViewList ts = selection->tracks.filter_to_unique_playlists ();
|
||||
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
|
||||
RouteTimeAxisView* tatv;
|
||||
boost::shared_ptr<Playlist> playlist;
|
||||
if ((tatv = dynamic_cast<RouteTimeAxisView*> (*i)) == 0) {
|
||||
continue;
|
||||
}
|
||||
if ((playlist = (*i)->playlist()) == 0) {
|
||||
continue;
|
||||
}
|
||||
for (list<AudioRange>::const_iterator j = selection->time.begin(); j != selection->time.end(); ++j) {
|
||||
boost::shared_ptr<RegionList> rl = playlist->regions_touched (j->start, j->end);
|
||||
for (RegionList::iterator ir = rl->begin(); ir != rl->end(); ++ir) {
|
||||
RegionView* rv;
|
||||
if ((rv = tatv->view()->find_view (*ir)) != 0) {
|
||||
rvl.push_back (rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_drags->set (new AutomationRangeDrag (this, clicked_regionview, rvl, selection->time),
|
||||
event, _cursors->up_down);
|
||||
} else {
|
||||
double const y = event->button.y;
|
||||
|
|
Loading…
Reference in New Issue