From f069f78c2a9e1fb887496cbd80671fca109d55d6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 1 Oct 2009 17:19:55 +0000 Subject: [PATCH] Freeze effect: when adding the effect, set the default freeze frame to the cursor position, and update widget effect when resizing the clip: http://www.kdenlive.org/mantis/view.php?id=1175 svn path=/trunk/kdenlive/; revision=3975 --- src/clipitem.cpp | 9 +++++++-- src/clipitem.h | 2 +- src/customtrackview.cpp | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 1e3dd893..4ae0514a 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -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(); diff --git a/src/clipitem.h b/src/clipitem.h index 0522c4bb..56bbd77a 100644 --- a/src/clipitem.h +++ b/src/clipitem.h @@ -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); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index b90c587e..6a240391 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -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) -- 2.39.2