]> git.sesse.net Git - kdenlive/commitdiff
Cutting groups:
authorTill Theato <root@ttill.de>
Wed, 21 Jul 2010 11:43:48 +0000 (11:43 +0000)
committerTill Theato <root@ttill.de>
Wed, 21 Jul 2010 11:43:48 +0000 (11:43 +0000)
- do not create a cut command if the selected group is not under the timline cursor
- append transitions that would have to be cut to group 1 for now

svn path=/trunk/kdenlive/; revision=4613

src/customtrackview.cpp

index 5c30adffedf927c365ca9766e3f720ab4e9a7734..63953c1675822859a7ef499b33f7e49afc9e0bd9 100644 (file)
@@ -3604,12 +3604,9 @@ void CustomTrackView::razorGroup(AbstractGroupItem* group, GenTime cutPos)
 {
     if (group) {
         QList <QGraphicsItem *> children = group->childItems();
-        QList <ItemInfo> clips1;
-        QList <ItemInfo> transitions1;
-        QList <ItemInfo> clipsCut;
-        QList <ItemInfo> transitionsCut;
-        QList <ItemInfo> clips2;
-        QList <ItemInfo> transitions2;
+        QList <ItemInfo> clips1, transitions1;
+        QList <ItemInfo> clipsCut, transitionsCut;
+        QList <ItemInfo> clips2, transitions2;
         for (int i = 0; i < children.count(); ++i) {
             children.at(i)->setSelected(false);
             AbstractClipItem *child = static_cast <AbstractClipItem *>(children.at(i));
@@ -3629,6 +3626,8 @@ void CustomTrackView::razorGroup(AbstractGroupItem* group, GenTime cutPos)
                     transitionsCut << child->info();
             }
         }
+        if (clipsCut.isEmpty() && transitionsCut.isEmpty() && ((clips1.isEmpty() && transitions1.isEmpty()) || (clips2.isEmpty() && transitions2.isEmpty())))
+            return;
         RazorGroupCommand *command = new RazorGroupCommand(this, clips1, transitions1, clipsCut, transitionsCut, clips2, transitions2, cutPos);
         m_commandStack->push(command);
     }
@@ -3646,12 +3645,14 @@ void CustomTrackView::slotRazorGroup(QList <ItemInfo> clips1, QList <ItemInfo> t
                     clips2 << clipBehind->info();
             }
         }
-        // TODO: cut transitionsCut
+        /* TODO: cut transitionsCut
+         * For now just append them to group1 */
+        transitions1 << transitionsCut;
         doGroupClips(clips1, transitions1, true);
         doGroupClips(clips2, transitions2, true);
     } else {
         /* we might also just use clipsCut.at(0)->parentItem().
-           Do this loop just in case something went wrong during cut */
+         * Do this loop just in case something went wrong during cut */
         for (int i = 0; i < clipsCut.count(); ++i) {
             ClipItem *clip = getClipItemAt(cutPos.frames(m_document->fps()), clipsCut.at(i).track);
             if (clip && clip->parentItem() && clip->parentItem()->type() == GROUPWIDGET) {