From 1451d8043a4be06859724ad928cdb658fdd9bc9c Mon Sep 17 00:00:00 2001 From: nick_m Date: Sun, 4 Oct 2015 03:29:16 +1100 Subject: [PATCH] Region gain point selection behaves as per track automation. --- gtk2_ardour/editor_mouse.cc | 50 ++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index b4e4cc81af..ba80c033bc 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -524,18 +524,56 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it break; case GainLineItem: - case AutomationLineItem: if (eff_mouse_mode != MouseRange) { - AutomationLine* al; + AutomationLine* argl = reinterpret_cast (item->get_data ("line")); + std::list selectables; uint32_t before, after; - framecnt_t const where = (framecnt_t) floor (event->button.x * samples_per_pixel); + framecnt_t const where = (framecnt_t) floor (event->button.x * samples_per_pixel) - clicked_regionview->region ()->position (); + + if (!argl || !argl->control_points_adjacent (where, before, after)) { + break; + } - if ((al = reinterpret_cast (item->get_data ("line")))) { + selectables.push_back (argl->nth (before)); + selectables.push_back (argl->nth (after)); - if (!al->control_points_adjacent (where, before, after)) { - break; + switch (op) { + case Selection::Set: + if (press) { + selection->set (selectables); + _mouse_changed_selection = true; + } + break; + case Selection::Add: + if (press) { + selection->add (selectables); + _mouse_changed_selection = true; + } + break; + case Selection::Toggle: + if (press) { + selection->toggle (selectables); + _mouse_changed_selection = true; } + break; + + case Selection::Extend: + /* XXX */ + break; + } + } + break; + + case AutomationLineItem: + if (eff_mouse_mode != MouseRange) { + AutomationLine* al = reinterpret_cast (item->get_data ("line")); + std::list selectables; + uint32_t before, after; + framecnt_t const where = (framecnt_t) floor (event->button.x * samples_per_pixel); + + if (!al || !al->control_points_adjacent (where, before, after)) { + break; } selectables.push_back (al->nth (before)); -- 2.30.2