Commit 2c803010 authored by Steve Guilford's avatar Steve Guilford Committed by Vincent PINON

Ripple delete workflow enhancement implemented. Some code refactoring too for reusability.

parent 1cdb2e1e
......@@ -1749,6 +1749,11 @@ void MainWindow::setupActions()
collection.addAction("stopmotion", stopMotion);
connect(stopMotion , SIGNAL(triggered()), this, SLOT(slotOpenStopmotion()));
KAction *rippleDelete = new KAction(KIcon(), i18n("Ripple Delete"), this);
rippleDelete->setShortcut(Qt::CTRL + Qt::Key_X);
collection.addAction("ripple_delete", rippleDelete);
connect(rippleDelete, SIGNAL(triggered()), this, SLOT(slotRippleDelete()));
QMenu *addClips = new QMenu();
addClips->addAction(addClip);
addClips->addAction(addColorClip);
......@@ -3166,6 +3171,45 @@ void MainWindow::slotRemoveSpace()
m_activeTimeline->projectView()->slotRemoveSpace();
}
void MainWindow::slotRippleDelete()
{
if (!m_projectMonitor->isActive() || !m_activeTimeline) return;
int zoneStart = m_projectMonitor->getZoneStart();
int zoneEnd = m_projectMonitor->getZoneEnd();
if (!zoneStart && zoneEnd == (m_activeTimeline->duration() - 1)) return;
int zoneFrameCount = zoneEnd - zoneStart;
m_projectMonitor->slotZoneStart();
m_activeTimeline->projectView()->setCursorPos(zoneStart);
m_activeTimeline->projectView()->slotSelectAllClips();
m_activeTimeline->projectView()->cutSelectedClips();
m_activeTimeline->projectView()->resetSelectionGroup(false);
m_projectMonitor->slotZoneEnd();
m_activeTimeline->projectView()->setCursorPos(zoneEnd);
zoneEnd++;
m_activeTimeline->projectView()->selectItemsRightOfFrame(zoneEnd);
m_activeTimeline->projectView()->setInPoint();
m_activeTimeline->projectView()->resetSelectionGroup(false);
zoneEnd++;
m_activeTimeline->projectView()->selectItemsRightOfFrame(zoneEnd);
m_activeTimeline->projectView()->spaceToolMoveToSnapPos((double) zoneEnd);
m_activeTimeline->projectView()->spaceToolMoveToSnapPos((double) zoneStart);
GenTime timeOffset = GenTime(zoneFrameCount * -1, m_activeDocument->fps());
m_activeTimeline->projectView()->completeSpaceOperation(-1, timeOffset);
m_projectMonitor->slotZoneStart();
m_activeTimeline->projectView()->setCursorPos(zoneStart);
m_activeTimeline->projectView()->resetSelectionGroup(false);
return;
}
void MainWindow::slotInsertTrack(int ix)
{
m_monitorManager->activateMonitor(Kdenlive::ProjectMonitor);
......
......@@ -575,6 +575,9 @@ private slots:
/** @brief Set MLT's consumer interpolation method */
void slotSetInterpolation(int ix);
// Ripple Edit
void slotRippleDelete();
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
};
......
......@@ -677,6 +677,16 @@ void Monitor::slotEnd()
render->seekToFrame(render->getLength());
}
int Monitor::getZoneStart()
{
return m_ruler->zone().x();
}
int Monitor::getZoneEnd()
{
return m_ruler->zone().y();
}
void Monitor::slotZoneStart()
{
slotActivateMonitor();
......
......@@ -97,6 +97,9 @@ public:
/** @brief Get url for the clip's thumbnail */
QString getMarkerThumb(GenTime pos);
int getZoneStart();
int getZoneEnd();
protected:
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
......
This diff is collapsed.
......@@ -215,6 +215,16 @@ public:
/** @brief Get effect parameters ready for MLT*/
static void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, MltVideoProfile profile, const QString &prefix = QString());
void completeSpaceOperation(int track, GenTime &timeOffset);
void spaceToolMoveToSnapPos(double snappedPos);
void createRectangleSelection(QMouseEvent * event);
void spaceToolSelect(QMouseEvent * event);
int spaceToolSelectTrackOnly(int track, QList<QGraphicsItem *> &selection);
QList<QGraphicsItem *> selectAllItemsToTheRight(int x);
void createGroupForSelectedItems(QList<QGraphicsItem *> &selection);
void selectItemsRightOfFrame(int frame);
void resetSelectionGroup(bool selectItems = true);
public slots:
/** @brief Send seek request to MLT. */
void seekCursorPos(int pos);
......@@ -409,7 +419,6 @@ private:
bool canBeMoved(QList<AbstractClipItem *> items, GenTime offset, int trackOffset) const;
ClipItem *getClipUnderCursor() const;
AbstractClipItem *getMainActiveClip() const;
void resetSelectionGroup(bool selectItems = true);
void groupSelectedItems(QList <QGraphicsItem *> selection = QList <QGraphicsItem *>(), bool createNewGroup = false, bool selectNewGroup = false);
/** Get available space for clip move (min and max free positions) */
void getClipAvailableSpace(AbstractClipItem *item, GenTime &minimum, GenTime &maximum);
......
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