On clip cut, auto reselect right part of the clip if it was previously selected

parent 33db17b2
......@@ -80,7 +80,7 @@ public:
/* Set if the item is in grab state */
bool isGrabbed() const;
/* True if item is selected in timeline */
bool selected {false};
/* Set selected status */
......
......@@ -180,6 +180,16 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
clips.insert(cid);
}
}
// Shall we reselect after the split
int trackToSelect = -1;
if (timeline->isClip(clipId) && timeline->m_allClips[clipId]->selected) {
int mainIn = timeline->getItemPosition(clipId);
int mainOut = mainIn + timeline->getItemPlaytime(clipId);
if (position > mainIn && position < mainOut) {
trackToSelect = timeline->getItemTrackId(clipId);
}
}
// We need to call clearSelection before attempting the split or the group split will be corrupted by the selection group (no undo support)
timeline->requestClearSelection();
......@@ -230,6 +240,12 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
return false;
}
}
if (count > 0 && trackToSelect > -1) {
int newClip = timeline->getClipByPosition(trackToSelect, position);
if (newClip > -1) {
timeline->requestSetSelection({newClip});
}
}
return count > 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment