summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_mouse.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2015-10-04 03:29:16 +1100
committernick_m <mainsbridge@gmail.com>2015-10-20 00:53:28 +1100
commit1451d8043a4be06859724ad928cdb658fdd9bc9c (patch)
tree418d027889ce32c3c2c692345b07cc8501bf7bec /gtk2_ardour/editor_mouse.cc
parent202a23d513235120b03ffdc2d0ceba1cb7d0c93d (diff)
Region gain point selection behaves as per track automation.
Diffstat (limited to 'gtk2_ardour/editor_mouse.cc')
-rw-r--r--gtk2_ardour/editor_mouse.cc50
1 files 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<AutomationLine*> (item->get_data ("line"));
+
std::list<Selectable*> 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<AutomationLine*> (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<AutomationLine*> (item->get_data ("line"));
+ std::list<Selectable*> 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));