mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 13:45:43 +01:00
Extend a previous region if we click in a MIDI automation lane where there is no region (#4155).
git-svn-id: svn://localhost/ardour2/branches/3.0@12622 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f840133768
commit
0ac73d8513
1 changed files with 17 additions and 2 deletions
|
|
@ -1003,8 +1003,23 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
|
|||
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (clicked_axisview);
|
||||
assert (atv);
|
||||
if (parent && dynamic_cast<MidiTimeAxisView*> (parent) && atv->show_regions ()) {
|
||||
/* create a MIDI region so that we have somewhere to put automation */
|
||||
_drags->set (new RegionCreateDrag (this, item, parent), event);
|
||||
|
||||
RouteTimeAxisView* p = dynamic_cast<RouteTimeAxisView*> (parent);
|
||||
assert (p);
|
||||
boost::shared_ptr<Playlist> pl = p->track()->playlist ();
|
||||
if (pl->n_regions() == 0) {
|
||||
/* Parent has no regions; create one so that we have somewhere to put automation */
|
||||
_drags->set (new RegionCreateDrag (this, item, parent), event);
|
||||
} else {
|
||||
/* See if there's a region before the click that we can extend, and extend it if so */
|
||||
framepos_t const t = event_frame (event);
|
||||
boost::shared_ptr<Region> prev = pl->find_next_region (t, End, -1);
|
||||
if (!prev) {
|
||||
_drags->set (new RegionCreateDrag (this, item, parent), event);
|
||||
} else {
|
||||
prev->set_length (t - prev->position ());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* rubberband drag to select automation points */
|
||||
_drags->set (new EditorRubberbandSelectDrag (this, item), event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue