diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-10-13 11:30:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-10-13 11:30:30 +0100 |
| commit | 6f23b55a7783f93549115a133ca2e6e938bd0cd1 (patch) | |
| tree | 6c674d088eb37dd9d91992366cfa6ddb3e0e69e5 /src/wx/timeline.cc | |
| parent | f9068dcbfbb09082e29e2a779ef1a7a2f6ee849e (diff) | |
Some attempts to block referencing of DCPs when it is not possible.
Diffstat (limited to 'src/wx/timeline.cc')
| -rw-r--r-- | src/wx/timeline.cc | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index c1afdd369..f91d2937f 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -168,6 +168,7 @@ Timeline::assign_tracks () } shared_ptr<Content> content = cv->content(); + DCPTimePeriod content_period (content->position(), content->end()); int t = 0; while (true) { @@ -182,11 +183,7 @@ Timeline::assign_tracks () shared_ptr<Content> test_content = test->content(); if (test && test->track() && test->track().get() == t) { - bool const no_overlap = - (content->position() < test_content->position() && content->end() < test_content->position()) || - (content->position() > test_content->end() && content->end() > test_content->end()); - - if (!no_overlap) { + if (content_period.overlaps (DCPTimePeriod(test_content->position(), test_content->end()))) { /* we have an overlap on track `t' */ ++t; break; @@ -367,7 +364,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) if (_snap) { - DCPTime const new_end = new_position + _down_view->content()->length_after_trim () - DCPTime (1); + DCPTime const new_end = new_position + _down_view->content()->length_after_trim(); /* Signed `distance' to nearest thing (i.e. negative is left on the timeline, positive is right). */ @@ -381,9 +378,9 @@ Timeline::set_position_from_event (wxMouseEvent& ev) } maybe_snap (cv->content()->position(), new_position, nearest_distance); - maybe_snap (cv->content()->position(), new_end + DCPTime (1), nearest_distance); - maybe_snap (cv->content()->end() + DCPTime (1), new_position, nearest_distance); - maybe_snap (cv->content()->end() + DCPTime (1), new_end, nearest_distance); + maybe_snap (cv->content()->position(), new_end, nearest_distance); + maybe_snap (cv->content()->end(), new_position, nearest_distance); + maybe_snap (cv->content()->end(), new_end, nearest_distance); } if (nearest_distance) { |
