]> git.sesse.net Git - kdenlive/blobdiff - src/customtrackview.cpp
- Add ability to configure the default duration for title clips.
[kdenlive] / src / customtrackview.cpp
index 2ac233668ccae4a2b285eeae1ae5d97868740a6d..81b59ac8b115a5809673df188ed1d6ea60fcc7d0 100644 (file)
@@ -194,11 +194,16 @@ void CustomTrackView::setDocumentModified()
     m_document->setModified(true);
 }
 
-void CustomTrackView::setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup)
+void CustomTrackView::setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup, QMenu *markermenu)
 {
     m_timelineContextMenu = timeline;
     m_timelineContextClipMenu = clip;
     m_clipTypeGroup = clipTypeGroup;
+
+    m_markerMenu = new QMenu(i18n("Go to marker..."), this);
+    m_markerMenu->setEnabled(false);
+    markermenu->addMenu(m_markerMenu);
+    connect(m_markerMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotGoToMarker(QAction *)));
     QList <QAction *> list = m_timelineContextClipMenu->actions();
     for (int i = 0; i < list.count(); i++) {
         if (list.at(i)->data().toString() == "paste_effects") m_pasteEffectsAction = list.at(i);
@@ -410,15 +415,49 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
             // spacer tool
             snappedPos = getSnapPointForPos(mappedXPos + m_spacerOffset);
             if (snappedPos < 0) snappedPos = 0;
+
             // Make sure there is no collision
             QList<QGraphicsItem *> children = m_selectionGroup->childItems();
             QPainterPath shape = m_selectionGroup->clipGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
             QList<QGraphicsItem*> collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
             collidingItems.removeAll(m_selectionGroup);
             for (int i = 0; i < children.count(); i++) {
+                if (children.at(i)->type() == GROUPWIDGET) {
+                    QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+                    for (int j = 0; j < subchildren.count(); j++) {
+                        collidingItems.removeAll(subchildren.at(j));
+                    }
+                }
                 collidingItems.removeAll(children.at(i));
             }
             bool collision = false;
+            int offset = 0;
+            for (int i = 0; i < collidingItems.count(); i++) {
+                if (!collidingItems.at(i)->isEnabled()) continue;
+                if (collidingItems.at(i)->type() == AVWIDGET && snappedPos < m_selectionGroup->sceneBoundingRect().left()) {
+                    AbstractClipItem *item = static_cast <AbstractClipItem *>(collidingItems.at(i));
+                    // Moving backward, determine best pos
+                    QPainterPath clipPath;
+                    clipPath.addRect(item->sceneBoundingRect());
+                    QPainterPath res = shape.intersected(clipPath);
+                    offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
+                }
+            }
+            snappedPos += offset;
+            // make sure we have no collision
+            shape = m_selectionGroup->clipGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
+            collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
+            collidingItems.removeAll(m_selectionGroup);
+            for (int i = 0; i < children.count(); i++) {
+                if (children.at(i)->type() == GROUPWIDGET) {
+                    QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+                    for (int j = 0; j < subchildren.count(); j++) {
+                        collidingItems.removeAll(subchildren.at(j));
+                    }
+                }
+                collidingItems.removeAll(children.at(i));
+            }
+
             for (int i = 0; i < collidingItems.count(); i++) {
                 if (!collidingItems.at(i)->isEnabled()) continue;
                 if (collidingItems.at(i)->type() == AVWIDGET) {
@@ -426,12 +465,47 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
                     break;
                 }
             }
+
+
             if (!collision) {
                 // Check transitions
                 shape = m_selectionGroup->transitionGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
                 collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
                 collidingItems.removeAll(m_selectionGroup);
                 for (int i = 0; i < children.count(); i++) {
+                    if (children.at(i)->type() == GROUPWIDGET) {
+                        QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+                        for (int j = 0; j < subchildren.count(); j++) {
+                            collidingItems.removeAll(subchildren.at(j));
+                        }
+                    }
+                    collidingItems.removeAll(children.at(i));
+                }
+                offset = 0;
+
+                for (int i = 0; i < collidingItems.count(); i++) {
+                    if (collidingItems.at(i)->type() == TRANSITIONWIDGET && snappedPos < m_selectionGroup->sceneBoundingRect().left()) {
+                        AbstractClipItem *item = static_cast <AbstractClipItem *>(collidingItems.at(i));
+                        // Moving backward, determine best pos
+                        QPainterPath clipPath;
+                        clipPath.addRect(item->sceneBoundingRect());
+                        QPainterPath res = shape.intersected(clipPath);
+                        offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
+                    }
+                }
+
+                snappedPos += offset;
+                // make sure we have no collision
+                shape = m_selectionGroup->transitionGroupShape(QPointF(snappedPos - m_selectionGroup->sceneBoundingRect().left(), 0));
+                collidingItems = scene()->items(shape, Qt::IntersectsItemShape);
+                collidingItems.removeAll(m_selectionGroup);
+                for (int i = 0; i < children.count(); i++) {
+                    if (children.at(i)->type() == GROUPWIDGET) {
+                        QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
+                        for (int j = 0; j < subchildren.count(); j++) {
+                            collidingItems.removeAll(subchildren.at(j));
+                        }
+                    }
                     collidingItems.removeAll(children.at(i));
                 }
                 for (int i = 0; i < collidingItems.count(); i++) {
@@ -844,10 +918,11 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
                 kDebug() << "SELELCTING ELEMENTS WITHIN =" << event->pos().x() << "/" <<  1 << ", " << mapFromScene(sceneRect().width(), 0).x() - event->pos().x() << "/" << sceneRect().height();
             }
 
+            QList <GenTime> offsetList;
             // create group to hold selected items
             m_selectionGroup = new AbstractGroupItem(m_document->fps());
             scene()->addItem(m_selectionGroup);
-            QList <GenTime> offsetList;
+
             for (int i = 0; i < selection.count(); i++) {
                 if (selection.at(i)->parentItem() == 0 && (selection.at(i)->type() == AVWIDGET || selection.at(i)->type() == TRANSITIONWIDGET)) {
                     AbstractClipItem *item = static_cast<AbstractClipItem *>(selection.at(i));
@@ -856,7 +931,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
                     offsetList.append(item->endPos());
                     m_selectionGroup->addToGroup(selection.at(i));
                     selection.at(i)->setFlag(QGraphicsItem::ItemIsMovable, false);
-                } else if (selection.at(i)->parentItem() == 0 && selection.at(i)->type() == GROUPWIDGET) {
+                } else if (/*selection.at(i)->parentItem() == 0 && */selection.at(i)->type() == GROUPWIDGET) {
                     if (static_cast<AbstractGroupItem *>(selection.at(i))->isItemLocked()) continue;
                     QList<QGraphicsItem *> children = selection.at(i)->childItems();
                     for (int j = 0; j < children.count(); j++) {
@@ -866,8 +941,9 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
                     }
                     m_selectionGroup->addToGroup(selection.at(i));
                     selection.at(i)->setFlag(QGraphicsItem::ItemIsMovable, false);
-                } else if (selection.at(i)->parentItem()) {
+                } else if (selection.at(i)->parentItem() && !selection.contains(selection.at(i)->parentItem())) {
                     if (static_cast<AbstractGroupItem *>(selection.at(i)->parentItem())->isItemLocked()) continue;
+                    //AbstractGroupItem *grp = static_cast<AbstractGroupItem *>(selection.at(i)->parentItem());
                     m_selectionGroup->addToGroup(selection.at(i)->parentItem());
                     selection.at(i)->parentItem()->setFlag(QGraphicsItem::ItemIsMovable, false);
                 }
@@ -1169,7 +1245,7 @@ void CustomTrackView::groupSelectedItems(bool force, bool createNewGroup)
 void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
 {
     if (m_dragItem && m_dragItem->hasKeyFrames()) {
-        if (m_moveOpMode == KEYFRAME) {
+        /*if (m_moveOpMode == KEYFRAME) {
             // user double clicked on a keyframe, open edit dialog
             //TODO: update for effects with several values per keyframe
             QDialog d(parentWidget());
@@ -1191,7 +1267,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
                 emit clipItemSelected(item, item->selectedEffectIndex());
             }
 
-        } else  {
+        } else*/  {
             // add keyframe
             GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x()), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
             int val = m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
@@ -1209,7 +1285,6 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
             emit clipItemSelected(item, item->selectedEffectIndex());
         }
     } else if (m_dragItem && !m_dragItem->isItemLocked()) {
-        ClipDurationDialog d(m_dragItem, m_document->timecode(), this);
         GenTime minimum;
         GenTime maximum;
         if (m_dragItem->type() == TRANSITIONWIDGET) {
@@ -1218,7 +1293,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
             getClipAvailableSpace(m_dragItem, minimum, maximum);
         }
         //kDebug()<<"// GOT MOVE POS: "<<minimum.frames(25)<<" - "<<maximum.frames(25);
-        d.setMargins(minimum, maximum);
+        ClipDurationDialog d(m_dragItem, m_document->timecode(), minimum, maximum, this);
         if (d.exec() == QDialog::Accepted) {
             if (m_dragItem->type() == TRANSITIONWIDGET) {
                 // move & resize transition
@@ -1284,8 +1359,11 @@ void CustomTrackView::displayContextMenu(QPoint pos, AbstractClipItem *clip, Abs
 {
     m_deleteGuide->setEnabled(m_dragGuide != NULL);
     m_editGuide->setEnabled(m_dragGuide != NULL);
-    if (clip == NULL) m_timelineContextMenu->popup(pos);
-    else if (group != NULL) {
+    m_markerMenu->clear();
+    m_markerMenu->setEnabled(false);
+    if (clip == NULL) {
+        m_timelineContextMenu->popup(pos);
+    } else if (group != NULL) {
         m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
         m_ungroupAction->setEnabled(true);
         updateClipTypeActions(NULL);
@@ -1294,10 +1372,26 @@ void CustomTrackView::displayContextMenu(QPoint pos, AbstractClipItem *clip, Abs
         m_ungroupAction->setEnabled(false);
         if (clip->type() == AVWIDGET) {
             ClipItem *item = static_cast <ClipItem*>(clip);
+            //build go to marker menu
+            if (item->baseClip()) {
+                QList <CommentedTime> markers = item->baseClip()->commentedSnapMarkers();
+                int offset = item->startPos().frames(m_document->fps());
+                if (!markers.isEmpty()) {
+                    for (int i = 0; i < markers.count(); i++) {
+                        int pos = (int) markers.at(i).time().frames(m_document->timecode().fps());
+                        QString position = m_document->timecode().getTimecode(markers.at(i).time()) + ' ' + markers.at(i).comment();
+                        QAction *go = m_markerMenu->addAction(position);
+                        go->setData(pos + offset);
+                    }
+                }
+                m_markerMenu->setEnabled(!m_markerMenu->isEmpty());
+            }
             updateClipTypeActions(item);
             m_pasteEffectsAction->setEnabled(m_copiedItems.count() == 1);
             m_timelineContextClipMenu->popup(pos);
-        } else if (clip->type() == TRANSITIONWIDGET) m_timelineContextTransitionMenu->popup(pos);
+        } else if (clip->type() == TRANSITIONWIDGET) {
+            m_timelineContextTransitionMenu->popup(pos);
+        }
     }
 }
 
@@ -1334,7 +1428,8 @@ bool CustomTrackView::insertDropClips(const QMimeData *data, const QPoint pos)
 {
     if (data->hasFormat("kdenlive/clip")) {
         m_clipDrag = true;
-        resetSelectionGroup();
+        m_scene->clearSelection();
+        resetSelectionGroup(false);
         QStringList list = QString(data->data("kdenlive/clip")).split(';');
         DocClipBase *clip = m_document->getBaseClip(list.at(0));
         if (clip == NULL) {
@@ -1369,7 +1464,7 @@ bool CustomTrackView::insertDropClips(const QMimeData *data, const QPoint pos)
         updateSnapPoints(NULL, offsetList);
         m_selectionGroup->setPos(framePos);
         scene()->addItem(m_selectionGroup);
-        //m_selectionGroup->setZValue(10);
+        m_selectionGroup->setSelected(true);
         return true;
     } else if (data->hasFormat("kdenlive/producerslist")) {
         m_clipDrag = true;
@@ -1415,7 +1510,6 @@ bool CustomTrackView::insertDropClips(const QMimeData *data, const QPoint pos)
             start += info.cropDuration;
             offsetList.append(start);
             ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1, false);
-            //item->setZValue(10);
             item->setFlag(QGraphicsItem::ItemIsMovable, false);
             m_selectionGroup->addToGroup(item);
             if (!clip->isPlaceHolder()) m_waitingThumbs.append(item);
@@ -1499,11 +1593,6 @@ void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect)
             return;
         }
         EffectsParameterList params = clip->addEffect(effect);
-        if (effect.attribute("disabled") == "1") {
-            // Effect is disabled, don't add it to MLT playlist
-            if (clip->isSelected()) emit clipItemSelected(clip);
-            return;
-        }
         if (!m_document->renderer()->mltAddEffect(track, pos, params))
             emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
         if (clip->isSelected()) emit clipItemSelected(clip);
@@ -1524,8 +1613,8 @@ void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect)
             return;
         }
     }
-    if (!m_document->renderer()->mltRemoveEffect(track, pos, index, true) && effect.attribute("disabled") != "1") {
-        kDebug() << "// ERROR REMOV EFFECT: " << index << ", DISABLE: " << effect.attribute("disabled");
+    if (!m_document->renderer()->mltRemoveEffect(track, pos, index, true)) {
+        kDebug() << "// ERROR REMOV EFFECT: " << index << ", DISABLE: " << effect.attribute("disable");
         emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
         return;
     }
@@ -1589,14 +1678,24 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
     if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
     else effectName = i18n("effect");
     effectCommand->setText(i18n("Add %1", effectName));
-    int count = 0;
+
     if (track == -1) itemList = scene()->selectedItems();
     if (itemList.isEmpty()) {
         ClipItem *clip = getClipItemAt((int) pos.frames(m_document->fps()), track);
         if (clip) itemList.append(clip);
         else emit displayMessage(i18n("Select a clip if you want to apply an effect"), ErrorMessage);
     }
-    kDebug() << "// REQUESTING EFFECT ON CLIP: " << pos.frames(25) << ", TRK: " << track << "SELECTED ITEMS: " << itemList.count();
+
+    //expand groups
+    for (int i = 0; i < itemList.count(); i++) {
+        if (itemList.at(i)->type() == GROUPWIDGET) {
+            QList<QGraphicsItem *> subitems = itemList.at(i)->childItems();
+            for (int j = 0; j < subitems.count(); j++) {
+                if (!itemList.contains(subitems.at(j))) itemList.append(subitems.at(j));
+            }
+        }
+    }
+
     for (int i = 0; i < itemList.count(); i++) {
         if (itemList.at(i)->type() == AVWIDGET) {
             ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
@@ -1629,17 +1728,50 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
                 effect.setAttribute("src", ladpsaFile);
             }
             new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
-            count++;
         }
     }
-    if (count > 0) {
+    if (effectCommand->childCount() > 0) {
         m_commandStack->push(effectCommand);
         setDocumentModified();
     } else delete effectCommand;
 }
 
-void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect)
+void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup)
 {
+    if (affectGroup && clip->parentItem() && clip->parentItem() == m_selectionGroup) {
+        //clip is in a group, also remove the effect in other clips of the group
+        QList<QGraphicsItem *> items = m_selectionGroup->childItems();
+        QUndoCommand *delCommand = new QUndoCommand();
+        QString effectName;
+        QDomNode namenode = effect.elementsByTagName("name").item(0);
+        if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
+        else effectName = i18n("effect");
+        delCommand->setText(i18n("Delete %1", effectName));
+
+        //expand groups
+        for (int i = 0; i < items.count(); i++) {
+            if (items.at(i)->type() == GROUPWIDGET) {
+                QList<QGraphicsItem *> subitems = items.at(i)->childItems();
+                for (int j = 0; j < subitems.count(); j++) {
+                    if (!items.contains(subitems.at(j))) items.append(subitems.at(j));
+                }
+            }
+        }
+
+        for (int i = 0; i < items.count(); i++) {
+            if (items.at(i)->type() == AVWIDGET) {
+                ClipItem *item = static_cast <ClipItem *>(items.at(i));
+                int ix = item->hasEffect(effect.attribute("tag"), effect.attribute("id"));
+                if (ix != -1) {
+                    QDomElement eff = item->effectAt(ix);
+                    new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), eff, false, delCommand);
+                }
+            }
+        }
+        if (delCommand->childCount() > 0) m_commandStack->push(delCommand);
+        else delete delCommand;
+        return;
+    }
     AddEffectCommand *command = new AddEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, false);
     m_commandStack->push(command);
     setDocumentModified();
@@ -1656,7 +1788,7 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedE
     if (clip) {
         // Special case: speed effect
         if (effect.attribute("id") == "speed") {
-            if (effect.attribute("disabled") == "1") doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, clip->speed(), 1, clip->baseClip()->getId());
+            if (effect.attribute("disable") == "1") doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, clip->speed(), 1, clip->baseClip()->getId());
             else {
                 double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
                 int strobe = EffectsList::parameter(effect, "strobe").toInt();
@@ -1681,11 +1813,7 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedE
             clip->initEffect(effect);
             effectParams = clip->getEffectArgs(effect);
         }
-        if (effectParams.paramValue("disabled") == "1") {
-            if (m_document->renderer()->mltRemoveEffect(track, pos, effectParams.paramValue("kdenlive_ix"), false)) {
-                kDebug() << "//////  DISABLING EFFECT: " << ix << ", CURRENTLA: " << clip->selectedEffectIndex();
-            } else emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
-        } else if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams))
+        if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams))
             emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
 
         clip->setEffectAt(ix, effect);
@@ -1732,7 +1860,7 @@ void CustomTrackView::slotChangeEffectState(ClipItem *clip, int effectPos, bool
     QDomElement effect = clip->effectAt(effectPos);
     QDomElement oldEffect = effect.cloneNode().toElement();
 
-    effect.setAttribute("disabled", (int) disable);
+    effect.setAttribute("disable", (int) disable);
     EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
     m_commandStack->push(command);
     setDocumentModified();;
@@ -2199,7 +2327,9 @@ void CustomTrackView::adjustTimelineClips(EDITMODE mode, ClipItem *item, ItemInf
                         dupInfo.cropStart += diff;
                         dupInfo.cropDuration = clipInfo.endPos - info.startPos;
                         new RazorClipCommand(this, clipInfo, info.startPos, false, command);
-                        ClipItem *dup = cutClip(clipInfo, info.startPos, true, false);
+                        // Commented out; variable dup unused. --granjow
+                        //ClipItem *dup = cutClip(clipInfo, info.startPos, true, false);
+                        cutClip(clipInfo, info.startPos, true, false);
                     }
                 }
                 // TODO: add insertspacecommand
@@ -3285,7 +3415,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
             int start = item->cropStart().frames(m_document->fps());
             int end = item->fadeIn();
             if (end == 0) {
-                slotDeleteEffect(item, oldeffect);
+                slotDeleteEffect(item, oldeffect, false);
             } else {
                 end += start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
@@ -3308,7 +3438,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
             int start = item->cropStart().frames(m_document->fps());
             int end = item->fadeIn();
             if (end == 0) {
-                slotDeleteEffect(item, oldeffect);
+                slotDeleteEffect(item, oldeffect, false);
             } else {
                 end += start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
@@ -3328,7 +3458,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
             int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
             int start = item->fadeOut();
             if (start == 0) {
-                slotDeleteEffect(item, oldeffect);
+                slotDeleteEffect(item, oldeffect, false);
             } else {
                 start = end - start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
@@ -3353,7 +3483,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
             int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
             int start = item->fadeOut();
             if (start == 0) {
-                slotDeleteEffect(item, oldeffect);
+                slotDeleteEffect(item, oldeffect, false);
             } else {
                 start = end - start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
@@ -4767,6 +4897,20 @@ void CustomTrackView::pasteClipEffects()
     paste->setText("Paste effects");
 
     QList<QGraphicsItem *> clips = scene()->selectedItems();
+
+    // expand groups
+    for (int i = 0; i < clips.count(); ++i) {
+        if (clips.at(i)->type() == GROUPWIDGET) {
+            QList<QGraphicsItem *> children = clips.at(i)->childItems();
+            for (int j = 0; j < children.count(); j++) {
+                if (children.at(j)->type() == AVWIDGET && !clips.contains(children.at(j))) {
+                    clips.append(children.at(j));
+                }
+            }
+        }
+    }
+
+
     for (int i = 0; i < clips.count(); ++i) {
         if (clips.at(i)->type() == AVWIDGET) {
             ClipItem *item = static_cast < ClipItem *>(clips.at(i));
@@ -4779,12 +4923,15 @@ void CustomTrackView::pasteClipEffects()
             }
         }
     }
-    m_commandStack->push(paste);
+    if (paste->childCount() > 0) m_commandStack->push(paste);
+    else delete paste;
 
-    // adjust effects (fades, ...)
+    //adjust effects (fades, ...)
     for (int i = 0; i < clips.count(); ++i) {
-        ClipItem *item = static_cast < ClipItem *>(clips.at(i));
-        updatePositionEffects(item, item->info());
+        if (clips.at(i)->type() == AVWIDGET) {
+            ClipItem *item = static_cast < ClipItem *>(clips.at(i));
+            updatePositionEffects(item, item->info());
+        }
     }
 }
 
@@ -5467,6 +5614,12 @@ void CustomTrackView::updateClipTypeActions(ClipItem *clip)
     }
 }
 
+void CustomTrackView::slotGoToMarker(QAction *action)
+{
+    int pos = action->data().toInt();
+    setCursorPos(pos, true);
+}
+
 void CustomTrackView::reloadTransitionLumas()
 {
     QString lumaNames;
@@ -5690,3 +5843,12 @@ void CustomTrackView::insertZoneOverwrite(QStringList data, int in)
     new AddTimelineClipCommand(this, clip->toXML(), clip->getId(), info, EffectsList(), true, false, true, false, addCommand);
     m_commandStack->push(addCommand);
 }
+
+void CustomTrackView::clearSelection()
+{
+    resetSelectionGroup();
+    scene()->clearSelection();
+    m_dragItem = NULL;
+    emit clipItemSelected(NULL);
+}
+