]> git.sesse.net Git - kdenlive/commitdiff
Small improvements for geometry keyframes
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 19 Oct 2008 08:51:47 +0000 (08:51 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 19 Oct 2008 08:51:47 +0000 (08:51 +0000)
svn path=/branches/KDE4/; revision=2487

src/geometryval.cpp

index 050d5cc119458f5a3742b9336a71522f7d855940..f75c21dcd4946178447993e13584fec46da637c8 100644 (file)
@@ -273,6 +273,15 @@ void Geometryval::slotPositionChanged(int pos, bool seek) {
 }
 
 void Geometryval::slotDeleteFrame() {
+    // check there is more than one keyframe
+    Mlt::GeometryItem item;
+    const int pos = ui.spinPos->value();
+    int error = m_geom->next_key(&item, pos + 1);
+    if (error) {
+        error = m_geom->prev_key(&item, pos - 1);
+        if (error || item.frame() == pos) return;
+    }
+
     m_geom->remove(ui.spinPos->value());
     ui.buttonAdd->setEnabled(true);
     ui.buttonDelete->setEnabled(false);
@@ -306,7 +315,11 @@ void Geometryval::slotNextFrame() {
     Mlt::GeometryItem item;
     int error = m_geom->next_key(&item, m_helper->value() + 1);
     kDebug() << "// SEEK TO NEXT KFR: " << error;
-    if (error) return;
+    if (error) {
+        // Go to end
+        ui.spinPos->setValue(ui.spinPos->maximum());
+        return;
+    }
     int pos = item.frame();
     ui.spinPos->setValue(pos);
 }