timeline: reimplemented deleting/ripple deleting the in/out region

This commit is contained in:
itsmattkc
2020-04-17 01:41:20 +10:00
parent d8e0a31375
commit 78c3c10e5f
8 changed files with 69 additions and 2 deletions
@@ -689,6 +689,47 @@ void TimelineWidget::Paste(bool insert)
Core::instance()->undo_stack()->pushIfHasChildren(command);
}
void TimelineWidget::DeleteInToOut(bool ripple)
{
if (!GetConnectedNode()
|| !GetConnectedTimelinePoints()
|| !GetConnectedTimelinePoints()->workarea()->enabled()) {
return;
}
QUndoCommand* command = new QUndoCommand();
foreach (TrackOutput* track, GetConnectedNode()->Tracks()) {
if (!track->IsLocked()) {
if (ripple) {
new TrackRippleRemoveAreaCommand(track,
GetConnectedTimelinePoints()->workarea()->in(),
GetConnectedTimelinePoints()->workarea()->out(),
command);
} else {
GapBlock* gap = new GapBlock();
gap->set_length_and_media_out(GetConnectedTimelinePoints()->workarea()->length());
new NodeAddCommand(static_cast<NodeGraph*>(track->parent()),
gap,
command);
new TrackPlaceBlockCommand(GetConnectedNode()->track_list(track->track_type()),
track->Index(),
gap,
GetConnectedTimelinePoints()->workarea()->in(),
command);
}
}
}
// Clear workarea after this
new WorkareaSetEnabledCommand(GetConnectedTimelinePoints(), false, command);
Core::instance()->undo_stack()->push(command);
}
QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
{
QList<TimelineViewBlockItem *> list;