]> git.sesse.net Git - kdenlive/commitdiff
Freeze effect: when adding the effect, set the default freeze frame to the cursor...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 1 Oct 2009 17:19:55 +0000 (17:19 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 1 Oct 2009 17:19:55 +0000 (17:19 +0000)
svn path=/trunk/kdenlive/; revision=3975

src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp

index 1e3dd89382a4d1d4432a05f68c2e36652519ddce..4ae0514ab1f74460f60d38707366948baf8fdd04 100644 (file)
@@ -155,13 +155,18 @@ int ClipItem::selectedEffectIndex() const
     return m_selectedEffect;
 }
 
-void ClipItem::initEffect(QDomElement effect)
+void ClipItem::initEffect(QDomElement effect, int diff)
 {
     // the kdenlive_ix int is used to identify an effect in mlt's playlist, should
     // not be changed
     if (effect.attribute("kdenlive_ix").toInt() == 0)
         effect.setAttribute("kdenlive_ix", QString::number(effectsCounter()));
-    // init keyframes if required
+
+    if (effect.attribute("id") == "freeze" && diff > 0) {
+        EffectsList::setParameter(effect, "frame", QString::number(diff));
+    }
+
+    // Init parameter value & keyframes if required
     QDomNodeList params = effect.elementsByTagName("parameter");
     for (int i = 0; i < params.count(); i++) {
         QDomElement e = params.item(i).toElement();
index 0522c4bbaea62367478f8c8fe5427e40c07d38bb..56bbd77a3b378669f4a4c3dd7645dd438d9bb2cb 100644 (file)
@@ -93,7 +93,7 @@ public:
     void updateKeyframeEffect();
     QDomElement selectedEffect();
     int selectedEffectIndex() const;
-    void initEffect(QDomElement effect);
+    void initEffect(QDomElement effect, int diff = 0);
     QString keyframes(const int index);
     void setKeyframes(const int ix, const QString keyframes);
     void setEffectList(const EffectsList effectList);
index b90c587ecffa8169746f71999baeed87bd325a28..6a2403914c839c97d76646877085b81d0dc2c406 100644 (file)
@@ -1539,7 +1539,9 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
             if (item->isItemLocked()) {
                 continue;
             }
-            item->initEffect(effect);
+            if (effect.attribute("id") == "freeze" && m_cursorPos > item->startPos().frames(m_document->fps()) && m_cursorPos < item->endPos().frames(m_document->fps())) {
+                item->initEffect(effect, m_cursorPos - item->startPos().frames(m_document->fps()));
+            } else item->initEffect(effect);
             if (effect.attribute("tag") == "ladspa") {
                 QString ladpsaFile = m_document->getLadspaFile();
                 initEffects::ladspaEffectFile(ladpsaFile, effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
@@ -3806,6 +3808,7 @@ void CustomTrackView::updateClipFade(ClipItem * item)
             if (item->isSelected() && effectPos == item->selectedEffectIndex()) emit clipItemSelected(item, effectPos);
         }
     }
+    if (item->isSelected() && item->selectedEffect().attribute("id") == "freeze") emit clipItemSelected(item, item->selectedEffectIndex());
 }
 
 double CustomTrackView::getSnapPointForPos(double pos)