timeline: reimplemented deleting/ripple deleting the in/out region
This commit is contained in:
@@ -143,6 +143,16 @@ void TimelinePanel::PasteInsert()
|
||||
static_cast<TimelineWidget*>(GetTimeBasedWidget())->Paste(true);
|
||||
}
|
||||
|
||||
void TimelinePanel::DeleteInToOut()
|
||||
{
|
||||
static_cast<TimelineWidget*>(GetTimeBasedWidget())->DeleteInToOut(false);
|
||||
}
|
||||
|
||||
void TimelinePanel::RippleDeleteInToOut()
|
||||
{
|
||||
static_cast<TimelineWidget*>(GetTimeBasedWidget())->DeleteInToOut(true);
|
||||
}
|
||||
|
||||
void TimelinePanel::InsertFootageAtPlayhead(const QList<Footage *> &footage)
|
||||
{
|
||||
static_cast<TimelineWidget*>(GetTimeBasedWidget())->InsertFootageAtPlayhead(footage);
|
||||
|
||||
@@ -73,6 +73,10 @@ public:
|
||||
|
||||
virtual void PasteInsert() override;
|
||||
|
||||
virtual void DeleteInToOut() override;
|
||||
|
||||
virtual void RippleDeleteInToOut() override;
|
||||
|
||||
void InsertFootageAtPlayhead(const QList<Footage *> &footage);
|
||||
|
||||
void OverwriteFootageAtPlayhead(const QList<Footage *> &footage);
|
||||
|
||||
@@ -99,4 +99,9 @@ const rational &TimelineWorkArea::out() const
|
||||
return workarea_range_.out();
|
||||
}
|
||||
|
||||
const rational &TimelineWorkArea::length() const
|
||||
{
|
||||
return workarea_range_.length();
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
|
||||
const rational& in() const;
|
||||
const rational& out() const;
|
||||
const rational& length() const;
|
||||
const TimeRange& range() const;
|
||||
void set_range(const TimeRange& range);
|
||||
|
||||
|
||||
@@ -150,6 +150,10 @@ public:
|
||||
|
||||
virtual void GoToOut(){}
|
||||
|
||||
virtual void DeleteInToOut(){}
|
||||
|
||||
virtual void RippleDeleteInToOut(){}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief paintEvent
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
|
||||
void Paste(bool insert);
|
||||
|
||||
void DeleteInToOut(bool ripple);
|
||||
|
||||
QList<TimelineViewBlockItem*> GetSelectedBlocks();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -505,12 +505,12 @@ void MainMenu::ClearOpenRecentTriggered()
|
||||
|
||||
void MainMenu::DeleteInOutTriggered()
|
||||
{
|
||||
qDebug() << "FIXME: Stub";
|
||||
PanelManager::instance()->CurrentlyFocused()->DeleteInToOut();
|
||||
}
|
||||
|
||||
void MainMenu::RippleDeleteInOutTriggered()
|
||||
{
|
||||
qDebug() << "FIXME: Stub";
|
||||
PanelManager::instance()->CurrentlyFocused()->RippleDeleteInToOut();
|
||||
}
|
||||
|
||||
void MainMenu::GoToInTriggered()
|
||||
|
||||
Reference in New Issue
Block a user