]> git.sesse.net Git - kdenlive/commitdiff
Do not allow removing the last keyframe by dragging it above or below the clip even...
authorTill Theato <root@ttill.de>
Thu, 28 Oct 2010 21:19:47 +0000 (21:19 +0000)
committerTill Theato <root@ttill.de>
Thu, 28 Oct 2010 21:19:47 +0000 (21:19 +0000)
svn path=/trunk/kdenlive/; revision=5056

src/abstractclipitem.cpp
src/abstractclipitem.h
src/customtrackview.cpp

index b78aed2e41480f133e06fe2f1bd148d23e5c8446..3e370e7e4a9cd06989055bb4d66106f6d92ddd80 100644 (file)
@@ -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();
index 5aad8941cb76bd321aca1114efc62cb0542e995f..c47ec9514fa310ed1979c712fa89ed83f3a54a42 100644 (file)
@@ -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();
index bc10df9c101d7e9157f4e7025dbe5c698199dba6..d6ab47535aed959d3cfc14a5cd388c9996c9db8f 100644 (file)
@@ -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 {