| 723 | } |
| 724 | |
| 725 | void TimeShiftHandle::DoSlideVertical( |
| 726 | ViewInfo &viewInfo, wxCoord xx, |
| 727 | TrackList &trackList, Track *dstTrack, double& desiredSlideAmount) |
| 728 | { |
| 729 | Correspondence correspondence; |
| 730 | |
| 731 | // See if captured track corresponds to another |
| 732 | auto &capturedTrack = *mClipMoveState.mCapturedTrack; |
| 733 | if (!FindCorrespondence( |
| 734 | correspondence, trackList, capturedTrack, *dstTrack, mClipMoveState )) |
| 735 | return; |
| 736 | |
| 737 | // Try to extend the correpondence |
| 738 | auto tryExtend = [&](bool forward) { |
| 739 | auto range = trackList.Any(); |
| 740 | auto begin = range.begin(), end = range.end(); |
| 741 | auto pCaptured = trackList.Find(&capturedTrack); |
| 742 | auto pDst = trackList.Find(dstTrack); |
| 743 | // Scan for more correspondences |
| 744 | while (true) { |
| 745 | // Remember that TrackIter wraps circularly to the end iterator when |
| 746 | // decrementing it |
| 747 | |
| 748 | // First move to a track with moving intervals and |
| 749 | // without a correspondent |
| 750 | do |
| 751 | forward ? ++pCaptured : --pCaptured; |
| 752 | while (pCaptured != end && |
| 753 | (correspondence.count(*pCaptured) || |
| 754 | mClipMoveState.shifters[*pCaptured]->MovingIntervals().empty())); |
| 755 | if (pCaptured == end) |
| 756 | break; |
| 757 | |
| 758 | // Change the choice of possible correspondent track too |
| 759 | do |
| 760 | forward ? ++pDst : --pDst; |
| 761 | while (pDst != end && correspondence.count(*pDst)); |
| 762 | if (pDst == end) |
| 763 | break; |
| 764 | |
| 765 | // Make correspondence if we can |
| 766 | if (!FindCorrespondence( |
| 767 | correspondence, trackList, **pCaptured, **pDst, mClipMoveState)) |
| 768 | break; |
| 769 | } |
| 770 | }; |
| 771 | // Try extension, backward first, then forward |
| 772 | // (anticipating the case of dragging a label that is under a clip) |
| 773 | tryExtend(false); |
| 774 | tryExtend(true); |
| 775 | |
| 776 | // Having passed that test, remove clips temporarily from their |
| 777 | // tracks, so moving clips don't interfere with each other |
| 778 | // when we call CanInsertClip() |
| 779 | TemporaryClipRemover remover{ mClipMoveState }; |
| 780 | |
| 781 | // Now check that the move is possible |
| 782 | auto slideAmount = desiredSlideAmount; |
nothing calls this directly
no test coverage detected