summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_mouse.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-03-29 15:57:07 +0100
committerRobin Gareus <robin@gareus.org>2019-03-29 15:57:07 +0100
commitd8571e2572e750f5cbe4f439ba3d6f9655713bc9 (patch)
tree47aed35b4370d9d1aa79b3c18de3aad1cac7ec2f /gtk2_ardour/editor_mouse.cc
parent932892f794ef9eebd24caab10d472086b63a9cea (diff)
cont'd AutomationRangeDrag updates -- safety commit
This is work in progress towards fixing stacked region's region-gain and multiple discontinuous regions spanning multiple tracks. AutomationRangeDrag::setup() still does not collect all AutomationLine points for certain overlap scenarios. There's more to come...
Diffstat (limited to 'gtk2_ardour/editor_mouse.cc')
-rw-r--r--gtk2_ardour/editor_mouse.cc70
1 files changed, 46 insertions, 24 deletions
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 00f292c5b0..15f74b2491 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -37,6 +37,7 @@
#include "canvas/canvas.h"
+#include "ardour/audioplaylist.h"
#include "ardour/audioregion.h"
#include "ardour/operations.h"
#include "ardour/playlist.h"
@@ -1116,15 +1117,43 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
break;
case SelectionItem:
- {
- if (dynamic_cast<AudioRegionView*>(clicked_regionview) ||
- dynamic_cast<AutomationRegionView*>(clicked_regionview)) {
-
- /* 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.
- */
+ {
+ if (selection->time.empty ()) {
+ /* nothing to do */
+ return true;
+ }
+ pair<TimeAxisView*, int> tvp = trackview_by_y_position (event->button.y, false);
+ if (!tvp.first) {
+ /* clicked outside of a track */
+ return true;
+ }
+ /* handle automation lanes first */
+ AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
+ if (atv) {
+ /* smart "join" mode: drag automation */
+ _drags->set (new AutomationRangeDrag (this, atv, selection->time), event, _cursors->up_down);
+ return true;
+ }
+ if (dynamic_cast<AutomationRegionView*>(clicked_regionview)) {
+ /* MIDI CC or similar -- TODO handle multiple? */
+ list<RegionView*> rvl;
+ rvl.push_back (clicked_regionview);
+ _drags->set (new AutomationRangeDrag (this, rvl, selection->time, clicked_regionview->get_time_axis_view().y_position()), event, _cursors->up_down);
+ return true;
+ }
+
+ /* no shift+drag: only apply to clicked_regionview (if any) */
+ if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::TertiaryModifier)) {
+ if (dynamic_cast<AudioRegionView*>(clicked_regionview) == 0) {
+ return true;
+ }
+ list<RegionView*> rvl;
+ rvl.push_back (clicked_regionview);
+ _drags->set (new AutomationRangeDrag (this, rvl, selection->time, clicked_regionview->get_time_axis_view().y_position()), event, _cursors->up_down);
+ return true;
+ }
+
+ /* collect all audio regions-views in the given range selection */
list<RegionView*> rvl;
TrackViewList ts = selection->tracks.filter_to_unique_playlists ();
for (TrackViewList::iterator i = ts.begin(); i != ts.end(); ++i) {
@@ -1136,6 +1165,9 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
if ((playlist = (*i)->playlist()) == 0) {
continue;
}
+ if (boost::dynamic_pointer_cast<AudioPlaylist> (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) {
@@ -1146,23 +1178,13 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
}
}
}
-
- _drags->set (new AutomationRangeDrag (this, clicked_regionview, rvl, selection->time),
- event, _cursors->up_down);
- } else {
- double const y = event->button.y;
- pair<TimeAxisView*, int> tvp = trackview_by_y_position (y, false);
- if (tvp.first) {
- AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (tvp.first);
- if (atv) {
- /* smart "join" mode: drag automation */
- _drags->set (new AutomationRangeDrag (this, atv, selection->time), event, _cursors->up_down);
- }
+ /* region-gain drag */
+ if (!rvl.empty ()) {
+ _drags->set (new AutomationRangeDrag (this, rvl, selection->time, tvp.first->y_position()), event, _cursors->up_down);
}
+ return true;
+ break;
}
- return true;
- break;
- }
case AutomationLineItem:
_drags->set (new LineDrag (this, item), event);