From d4357a904dec6bc6909366b71ffa29affff216a6 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Thu, 28 Oct 2010 21:19:47 +0000 Subject: [PATCH] Do not allow removing the last keyframe by dragging it above or below the clip even if it is not at the beginning or at the end of the clip svn path=/trunk/kdenlive/; revision=5056 --- src/abstractclipitem.cpp | 5 +++++ src/abstractclipitem.h | 2 ++ src/customtrackview.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index b78aed2e..3e370e7e 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -405,6 +405,11 @@ double AbstractClipItem::keyFrameFactor() const return m_keyframeFactor; } +int AbstractClipItem::keyFrameNumber() const +{ + return m_keyframes.count(); +} + int AbstractClipItem::addKeyFrame(const GenTime pos, const double value) { QRectF br = sceneBoundingRect(); diff --git a/src/abstractclipitem.h b/src/abstractclipitem.h index 5aad8941..c47ec951 100644 --- a/src/abstractclipitem.h +++ b/src/abstractclipitem.h @@ -57,6 +57,8 @@ public: double selectedKeyFrameValue() const; double editedKeyFrameValue() const; double keyFrameFactor() const; + /** @brief Returns the number of keyframes the selected effect has. */ + int keyFrameNumber() const; ItemInfo info() const; CustomTrackScene* projectScene(); void updateRectGeometry(); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index bc10df9c..d6ab4753 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -3551,7 +3551,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) int start = item->cropStart().frames(m_document->fps()); int end = (item->cropStart() + item->cropDuration()).frames(m_document->fps()) - 1; - if ((val < -50 || val > 150) && item->editedKeyFramePos() != start && item->editedKeyFramePos() != end) { + if ((val < -50 || val > 150) && item->editedKeyFramePos() != start && item->editedKeyFramePos() != end && item->keyFrameNumber() > 1) { //delete keyframe item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), -1, 0); } else { -- 2.39.2