]> git.sesse.net Git - kdenlive/commitdiff
Progress on track effects
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 22 Aug 2010 12:30:45 +0000 (12:30 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 22 Aug 2010 12:30:45 +0000 (12:30 +0000)
svn path=/trunk/kdenlive/; revision=4749

14 files changed:
src/customtrackview.cpp
src/customtrackview.h
src/definitions.h
src/effectstackview.cpp
src/effectstackview.h
src/headertrack.cpp
src/headertrack.h
src/kdenlivedoc.cpp
src/kdenlivedoc.h
src/mainwindow.cpp
src/renderer.cpp
src/renderer.h
src/trackview.cpp
src/trackview.h

index fec9a753daf2b1441bf057e63183c974e2569c3b..1c9d225c3d448099f3ce98c7be7ddb17b5d526df 100644 (file)
@@ -1546,6 +1546,13 @@ void CustomTrackView::slotRefreshEffects(ClipItem *clip)
 
 void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect)
 {
+    if (pos < GenTime()) {
+        // Add track effect
+        m_document->addTrackEffect(m_document->tracksCount() - track, effect);
+        m_document->renderer()->mltAddTrackEffect(track, getEffectArgs(effect));
+        emit showTrackEffects(track, m_document->getTrackEffects(m_document->tracksCount() - track));
+        return;
+    }
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
     if (clip) {
         // Special case: speed effect
@@ -1573,6 +1580,13 @@ void CustomTrackView::addEffect(int track, GenTime pos, QDomElement effect)
 void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect)
 {
     QString index = effect.attribute("kdenlive_ix");
+    if (pos < GenTime()) {
+        // Delete track effect
+        m_document->removeTrackEffect(m_document->tracksCount() - track, effect);
+        m_document->renderer()->mltRemoveTrackEffect(track, index, true);
+        emit showTrackEffects(track, m_document->getTrackEffects(m_document->tracksCount() - track));
+        return;
+    }
     // Special case: speed effect
     if (effect.attribute("id") == "speed") {
         ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
@@ -1707,8 +1721,15 @@ void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
     } else delete effectCommand;
 }
 
-void CustomTrackView::slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup)
+void CustomTrackView::slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup)
 {
+    if (clip == NULL) {
+        // delete track effect
+        AddEffectCommand *command = new AddEffectCommand(this, track, GenTime(-1), effect, false);
+        m_commandStack->push(command);
+        setDocumentModified();
+        return;
+    }
     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();
@@ -1754,8 +1775,26 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedE
         emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
         return;
     }
-    ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
     QDomElement effect = insertedEffect.cloneNode().toElement();
+    if (pos < GenTime()) {
+        // editing a track effect
+        EffectsParameterList effectParams = getEffectArgs(effect);
+        if (effect.attribute("tag") == "ladspa") {
+            // Update the ladspa affect file
+            initEffects::ladspaEffectFile(effect.attribute("src"), effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
+        }
+        // check if we are trying to reset a keyframe effect
+        if (effectParams.hasParam("keyframes") && effectParams.paramValue("keyframes").isEmpty()) {
+            //clip->initEffect(effect);
+            effectParams = getEffectArgs(effect);
+        }
+        if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - track, pos, effectParams))
+            emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+        m_document->setTrackEffect(track, ix, effect);
+        return;
+
+    }
+    ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
     if (clip) {
         // Special case: speed effect
         if (effect.attribute("id") == "speed") {
@@ -1809,6 +1848,20 @@ void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedE
 
 void CustomTrackView::moveEffect(int track, GenTime pos, int oldPos, int newPos)
 {
+    if (pos < GenTime()) {
+        // Moving track effect
+        kDebug() << "MOVING EFFECT IN TK: " << track;
+        QDomElement act = m_document->getTrackEffect(track, newPos - 1);
+        QDomElement before = m_document->getTrackEffect(track, oldPos - 1);
+
+        if (!act.isNull() && !before.isNull()) {
+            m_document->setTrackEffect(track, oldPos - 1, act);
+            m_document->setTrackEffect(track, newPos - 1, before);
+            m_document->renderer()->mltMoveEffect(m_document->tracksCount() - track, pos, oldPos, newPos);
+            emit showTrackEffects(m_document->tracksCount() - track, m_document->getTrackEffects(track));
+        } else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
+        return;
+    }
     ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
     if (clip && !clip->effectAt(newPos - 1).isNull() && !clip->effectAt(oldPos - 1).isNull()) {
         QDomElement act = clip->effectAt(newPos - 1);
@@ -1826,27 +1879,42 @@ void CustomTrackView::moveEffect(int track, GenTime pos, int oldPos, int newPos)
     } else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
 }
 
-void CustomTrackView::slotChangeEffectState(ClipItem *clip, int effectPos, bool disable)
+void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable)
 {
-    QDomElement effect = clip->effectAt(effectPos);
+    EditEffectCommand *command;
+    QDomElement effect;
+    if (clip == NULL) effect = m_document->getTrackEffect(m_document->tracksCount() - track, effectPos);
+    else effect = clip->effectAt(effectPos);
     QDomElement oldEffect = effect.cloneNode().toElement();
-
     effect.setAttribute("disable", (int) disable);
-    EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
+
+
+    if (clip == NULL) {
+        // editing track effect
+        command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldEffect, effect, effectPos, true);
+    } else {
+        command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
+    }
     m_commandStack->push(command);
     setDocumentModified();;
 }
 
-void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int currentPos, int newPos)
+void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int track, int currentPos, int newPos)
 {
-    MoveEffectCommand *command = new MoveEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), currentPos, newPos);
+    MoveEffectCommand *command;
+    if (clip == NULL) {
+        // editing track effect
+        command = new MoveEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), currentPos, newPos);
+    } else command = new MoveEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), currentPos, newPos);
     m_commandStack->push(command);
     setDocumentModified();
 }
 
-void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect, int ix)
+void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix)
 {
-    EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true);
+    EditEffectCommand *command;
+    if (clip) command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true);
+    else command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldeffect, effect, ix, true);
     m_commandStack->push(command);
 }
 
@@ -3298,13 +3366,13 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
             int start = item->cropStart().frames(m_document->fps());
             int end = item->fadeIn();
             if (end == 0) {
-                slotDeleteEffect(item, oldeffect, false);
+                slotDeleteEffect(item, -1, oldeffect, false);
             } else {
                 end += start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
                 EffectsList::setParameter(oldeffect, "in", QString::number(start));
                 EffectsList::setParameter(oldeffect, "out", QString::number(end));
-                slotUpdateClipEffect(item, effect, oldeffect, ix);
+                slotUpdateClipEffect(item, -1, effect, oldeffect, ix);
                 emit clipItemSelected(item, ix);
             }
         } else if (item->fadeIn() != 0 && ix2 == -1) {
@@ -3321,13 +3389,13 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event)
             int start = item->cropStart().frames(m_document->fps());
             int end = item->fadeIn();
             if (end == 0) {
-                slotDeleteEffect(item, oldeffect, false);
+                slotDeleteEffect(item, -1, oldeffect, false);
             } else {
                 end += start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
                 EffectsList::setParameter(oldeffect, "in", QString::number(start));
                 EffectsList::setParameter(oldeffect, "out", QString::number(end));
-                slotUpdateClipEffect(item, effect, oldeffect, ix2);
+                slotUpdateClipEffect(item, -1, effect, oldeffect, ix2);
                 emit clipItemSelected(item, ix2);
             }
         }
@@ -3341,14 +3409,14 @@ 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, false);
+                slotDeleteEffect(item, -1, oldeffect, false);
             } else {
                 start = end - start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
                 EffectsList::setParameter(oldeffect, "in", QString::number(start));
                 EffectsList::setParameter(oldeffect, "out", QString::number(end));
                 // kDebug()<<"EDIT FADE OUT : "<<start<<"x"<<end;
-                slotUpdateClipEffect(item, effect, oldeffect, ix);
+                slotUpdateClipEffect(item, -1, effect, oldeffect, ix);
                 emit clipItemSelected(item, ix);
             }
         } else if (item->fadeOut() != 0 && ix2 == -1) {
@@ -3366,14 +3434,14 @@ 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, false);
+                slotDeleteEffect(item, -1, oldeffect, false);
             } else {
                 start = end - start;
                 QDomElement effect = oldeffect.cloneNode().toElement();
                 EffectsList::setParameter(oldeffect, "in", QString::number(start));
                 EffectsList::setParameter(oldeffect, "out", QString::number(end));
                 // kDebug()<<"EDIT FADE OUT : "<<start<<"x"<<end;
-                slotUpdateClipEffect(item, effect, oldeffect, ix2);
+                slotUpdateClipEffect(item, -1, effect, oldeffect, ix2);
                 emit clipItemSelected(item, ix2);
             }
         }
@@ -6268,7 +6336,8 @@ bool CustomTrackView::hasAudio(int track) const
 
 void CustomTrackView::slotAddTrackEffect(const QDomElement effect, int ix)
 {
-    m_document->renderer()->mltAddTrackEffect(m_document->tracksCount() - ix, getEffectArgs(effect));
+    AddEffectCommand *command = new AddEffectCommand(this, m_document->tracksCount() - ix, GenTime(-1), effect, true);
+    m_commandStack->push(command);
 }
 
 
index 87f8910b9904ef4c67e203d6ca590b1d72eda1db..7d7a55e2811038a22b4acfb5cef8b91187ef4243 100644 (file)
@@ -187,10 +187,10 @@ public slots:
     void setCursorPos(int pos, bool seek = true);
     void moveCursorPos(int delta);
     void updateCursorPos();
-    void slotDeleteEffect(ClipItem *clip, QDomElement effect, bool affectGroup = true);
-    void slotChangeEffectState(ClipItem *clip, int effectPos, bool disable);
-    void slotChangeEffectPosition(ClipItem *clip, int currentPos, int newPos);
-    void slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect, int ix);
+    void slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup = true);
+    void slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable);
+    void slotChangeEffectPosition(ClipItem *clip, int track, int currentPos, int newPos);
+    void slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix);
     void slotUpdateClipRegion(ClipItem *clip, int ix, QString region);
     void slotRefreshEffects(ClipItem *clip);
     void setDuration(int duration);
@@ -422,6 +422,7 @@ signals:
     /** @brief Monitor document changes (for example the presence of audio data in timeline for export widget.*/
     void documentModified();
     void forceClipProcessing(const QString &);
+    void showTrackEffects(int, EffectsList);
 };
 
 #endif
index 1a35aa7af4b22d59c879dd093b5316a64100349b..33bffbd447ad3aa0a0bb07eb435009da80ecb195 100644 (file)
@@ -22,6 +22,7 @@
 #define DEFINITIONS_H
 
 #include "gentime.h"
+#include "effectslist.h"
 
 #include <QTreeWidgetItem>
 #include <KLocale>
@@ -63,6 +64,7 @@ struct TrackInfo {
     bool isMute;
     bool isBlind;
     bool isLocked;
+    EffectsList effectsList;
 };
 
 struct ItemInfo {
index 1bbf9fda2788e7d60bd0b51a844371fc349e847e..3b26ddf5dadcb30a0ed06c0c2f36b8491e8e9509 100644 (file)
 
 EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) :
         QWidget(parent),
-        m_monitor(monitor)
+        m_monitor(monitor),
+        m_clipref(NULL),
+        m_trackMode(false),
+        m_trackindex(-1)
 {
     m_ui.setupUi(this);
     QVBoxLayout *vbox1 = new QVBoxLayout(m_ui.frame);
@@ -52,7 +55,6 @@ EffectStackView::EffectStackView(Monitor *monitor, QWidget *parent) :
     m_ui.region_url->fileDialog()->setFilter(ProjectList::getExtensions());
     //m_ui.effectlist->horizontalHeader()->setVisible(false);
     //m_ui.effectlist->verticalHeader()->setVisible(false);
-    m_clipref = NULL;
 
     m_ui.buttonNew->setIcon(KIcon("document-new"));
     m_ui.buttonNew->setToolTip(i18n("Add new effect"));
@@ -125,7 +127,7 @@ void EffectStackView::slotSaveEffect()
 
     int i = m_ui.effectlist->currentRow();
     QDomDocument doc;
-    QDomElement effect = m_clipref->effectAt(i).cloneNode().toElement();
+    QDomElement effect = m_currentEffectList.at(i).cloneNode().toElement();
     doc.appendChild(doc.importNode(effect, true));
     effect = doc.firstChild().toElement();
     effect.removeAttribute("kdenlive_ix");
@@ -152,8 +154,10 @@ void EffectStackView::slotSaveEffect()
 
 void EffectStackView::slotUpdateEffectParams(const QDomElement old, const QDomElement e)
 {
-    if (m_clipref)
-        emit updateClipEffect(m_clipref, old, e, m_ui.effectlist->currentRow());
+    if (m_trackMode)
+        emit updateEffect(NULL, m_trackindex, old, e, m_ui.effectlist->currentRow());
+    else if (m_clipref)
+        emit updateEffect(m_clipref, -1, old, e, m_ui.effectlist->currentRow());
 }
 
 void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
@@ -183,9 +187,21 @@ void EffectStackView::slotClipItemSelected(ClipItem* c, int ix)
         return;
     }
     setEnabled(true);
+    m_trackMode = false;
+    m_currentEffectList = m_clipref->effectList();
     setupListView(ix);
 }
 
+void EffectStackView::slotTrackItemSelected(int ix, EffectsList list)
+{
+    setEnabled(!list.isEmpty());
+    m_clipref = NULL;
+    m_trackMode = true;
+    m_currentEffectList = list;
+    m_trackindex = ix;
+    setupListView(0);
+}
+
 void EffectStackView::slotItemChanged(QListWidgetItem *item)
 {
     bool disable = true;
@@ -195,7 +211,8 @@ void EffectStackView::slotItemChanged(QListWidgetItem *item)
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow >= 0) {
         m_effectedit->updateParameter("disable", QString::number((int) disable));
-        emit changeEffectState(m_clipref, activeRow, disable);
+        if (m_trackMode) emit changeEffectState(NULL, m_trackindex, activeRow, disable);
+        else emit changeEffectState(m_clipref, -1, activeRow, disable);
     }
     slotUpdateCheckAllButton();
 }
@@ -212,8 +229,8 @@ void EffectStackView::setupListView(int ix)
     KIcon customIcon("kdenlive-custom-effect");
     QListWidgetItem* item;
 
-    for (int i = 0; i < m_clipref->effectsCount(); i++) {
-        const QDomElement d = m_clipref->effectAt(i);
+    for (int i = 0; i < m_currentEffectList.count(); i++) {
+        const QDomElement d = m_currentEffectList.at(i).cloneNode().toElement();
         if (d.isNull()) {
             kDebug() << " . . . . WARNING, NULL EFFECT IN STACK!!!!!!!!!";
             continue;
@@ -268,14 +285,17 @@ void EffectStackView::slotItemSelectionChanged(bool update)
     bool isChecked = false;
     if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
     if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
-        QDomElement eff = m_clipref->effectAt(activeRow);
-        m_effectedit->transferParamDesc(eff,
-                                        0,
-                                        m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
-                                        (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps())); //minx max frame
+        QDomElement eff = m_currentEffectList.at(activeRow);
+        if (m_trackMode) {
+            // showing track effects
+            m_effectedit->transferParamDesc(eff, 0, 0, -1);
+        } else m_effectedit->transferParamDesc(eff,
+                                                   0,
+                                                   m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
+                                                   (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps())); //minx max frame
         m_ui.region_url->setUrl(KUrl(eff.attribute("region")));
     }
-    if (m_clipref && update) m_clipref->setSelectedEffect(activeRow);
+    if (!m_trackMode && m_clipref && update) m_clipref->setSelectedEffect(activeRow);
     m_ui.buttonDel->setEnabled(hasItem);
     m_ui.buttonSave->setEnabled(hasItem);
     m_ui.buttonReset->setEnabled(hasItem && isChecked);
@@ -288,21 +308,24 @@ void EffectStackView::slotItemUp()
 {
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow <= 0) return;
-    emit changeEffectPosition(m_clipref, activeRow + 1, activeRow);
+    if (m_trackMode) emit changeEffectPosition(NULL, m_trackindex, activeRow + 1, activeRow);
+    else emit changeEffectPosition(m_clipref, -1, activeRow + 1, activeRow);
 }
 
 void EffectStackView::slotItemDown()
 {
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow >= m_ui.effectlist->count() - 1) return;
-    emit changeEffectPosition(m_clipref, activeRow + 1, activeRow + 2);
+    if (m_trackMode) emit changeEffectPosition(NULL, m_trackindex, activeRow + 1, activeRow + 2);
+    else emit changeEffectPosition(m_clipref, -1, activeRow + 1, activeRow + 2);
 }
 
 void EffectStackView::slotItemDel()
 {
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow >= 0) {
-        emit removeEffect(m_clipref, m_clipref->effectAt(activeRow));
+        if (m_trackMode) emit removeEffect(NULL, m_trackindex, m_currentEffectList.at(activeRow).cloneNode().toElement());
+        else emit removeEffect(m_clipref, -1, m_clipref->effectAt(activeRow));
         slotUpdateCheckAllButton();
     }
 }
@@ -311,7 +334,7 @@ void EffectStackView::slotResetEffect()
 {
     int activeRow = m_ui.effectlist->currentRow();
     if (activeRow < 0) return;
-    QDomElement old = m_clipref->effectAt(activeRow).cloneNode().toElement();
+    QDomElement old = m_currentEffectList.at(activeRow).cloneNode().toElement();
     QDomElement dom;
     QString effectName = m_ui.effectlist->currentItem()->text();
     foreach(const QString &type, m_effectLists.keys()) {
@@ -323,17 +346,24 @@ void EffectStackView::slotResetEffect()
     }
     if (!dom.isNull()) {
         dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
-        m_clipref->initEffect(dom);
-        m_effectedit->transferParamDesc(dom, 0, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps()));//minx max frame
-        m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
-        emit updateClipEffect(m_clipref, old, dom, activeRow);
+        if (m_trackMode) {
+            EffectsList::setParameter(dom, "in", QString::number(0));
+            EffectsList::setParameter(dom, "out", QString::number(0));
+            m_effectedit->transferParamDesc(dom, 0, 0, 0);//minx max frame
+            emit updateEffect(NULL, m_trackindex, old, dom, activeRow);
+        } else {
+            m_clipref->initEffect(dom);
+            m_effectedit->transferParamDesc(dom, 0, m_clipref->cropStart().frames(KdenliveSettings::project_fps()), (m_clipref->cropStart() + m_clipref->cropDuration()).frames(KdenliveSettings::project_fps()));//minx max frame
+            m_ui.region_url->setUrl(KUrl(dom.attribute("region")));
+            emit updateEffect(m_clipref, -1, old, dom, activeRow);
+        }
     }
 }
 
 
 void EffectStackView::raiseWindow(QWidget* dock)
 {
-    if (m_clipref && dock)
+    if ((m_clipref || m_trackMode) && dock)
         dock->raise();
 }
 
@@ -355,7 +385,7 @@ void EffectStackView::clear()
 
 void EffectStackView::slotSeekTimeline(int pos)
 {
-    if (m_clipref)
+    if (!m_trackMode && m_clipref)
         emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
 }
 
@@ -395,11 +425,12 @@ void EffectStackView::slotCheckAll(int state)
 
 void EffectStackView::slotRegionChanged()
 {
-    emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
+    if (!m_trackMode) emit updateClipRegion(m_clipref, m_ui.effectlist->currentRow(), m_ui.region_url->text());
 }
 
 void EffectStackView::slotCheckMonitorPosition(int renderPos)
 {
+    if (m_trackMode) return;
     if (renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps())) {
         if (!m_monitor->getEffectScene()->views().at(0)->isVisible())
             m_monitor->slotEffectScene(true);
index 11b0c58cc236fe45b4407d7bce27e70d71c91897..7bea226ca6b5717e09a92ce4bde424e33b83fa77 100644 (file)
@@ -57,10 +57,18 @@ public:
 
 private:
     Ui::EffectStack_UI m_ui;
+    Monitor *m_monitor;
     ClipItem* m_clipref;
     QMap<QString, EffectsList*> m_effectLists;
+    EffectsList m_currentEffectList;
     EffectStackEdit* m_effectedit;
-    Monitor *m_monitor;
+
+    /** @brief Effectstackview can show the effects of a clip or the effects of a track.
+     * true if showing track effects. */
+    bool m_trackMode;
+
+    /** @brief The track index of currently edited track. */
+    int m_trackindex;
 
     /** @brief Sets the list of effects according to the clip's effect list.
     * @param ix Number of the effect to preselect */
@@ -72,6 +80,8 @@ public slots:
     * @param ix Effect to preselect */
     void slotClipItemSelected(ClipItem* c, int ix);
 
+    void slotTrackItemSelected(int ix, EffectsList list);
+
     /** @brief Emits updateClipEffect.
     * @param old Old effect information
     * @param e New effect information
@@ -123,16 +133,16 @@ private slots:
     void slotRenderPos(int pos);
 
 signals:
-    void removeEffect(ClipItem*, QDomElement);
+    void removeEffect(ClipItem*, int, QDomElement);
     /**  Parameters for an effect changed, update the filter in playlist */
-    void updateClipEffect(ClipItem*, QDomElement, QDomElement, int);
+    void updateEffect(ClipItem*, int, QDomElement, QDomElement, int);
     /** An effect in stack was moved, we need to regenerate
         all effects for this clip in the playlist */
     void refreshEffectStack(ClipItem *);
     /** Enable or disable an effect */
-    void changeEffectState(ClipItem*, int, bool);
+    void changeEffectState(ClipItem*, int, int, bool);
     /** An effect in stack was moved */
-    void changeEffectPosition(ClipItem*, int, int);
+    void changeEffectPosition(ClipItem*, int, int, int);
     /** an effect was saved, reload list */
     void reloadEffects();
     /** An effect with position parameter was changed, seek */
index 063f4b8a9cd356df2063575542946d2fcb0e53f5..2e4a7eff63095a5a9dbd3c9bebb29b8c11bf4539 100644 (file)
@@ -120,6 +120,7 @@ void HeaderTrack::mousePressEvent(QMouseEvent * event)
         return;
     }
     if (!m_isSelected) emit selectTrack(m_index);
+    emit showTrackEffects(m_index);
     QWidget::mousePressEvent(event);
 }
 
index 0fdf3a511a4efcba688219c9d788c8717b2849e8..fb4aeb8a1d54d49ece97ea8491212b821d4c818a 100644 (file)
@@ -72,6 +72,7 @@ signals:
     void selectTrack(int);
     void configTrack(int);
     void addTrackInfo(const QDomElement, int);
+    void showTrackEffects(int);
 };
 
 #endif
index 1e399f94a039f373d7bb2bcdd3c149ad924df3ab..538d5e72ef85bc9388fadfc172542f8c4174bab2 100644 (file)
@@ -1118,26 +1118,46 @@ int KdenliveDoc::tracksCount() const
 
 TrackInfo KdenliveDoc::trackInfoAt(int ix) const
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Track INFO outisde of range";
+        return TrackInfo();
+    }
     return m_tracksList.at(ix);
 }
 
 void KdenliveDoc::switchTrackAudio(int ix, bool hide)
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "SWITCH Track outisde of range";
+        return;
+    }
     m_tracksList[ix].isMute = hide; // !m_tracksList.at(ix).isMute;
 }
 
 void KdenliveDoc::switchTrackLock(int ix, bool lock)
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Track Lock outisde of range";
+        return;
+    }
     m_tracksList[ix].isLocked = lock;
 }
 
 bool KdenliveDoc::isTrackLocked(int ix) const
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Track Lock outisde of range";
+        return true;
+    }
     return m_tracksList.at(ix).isLocked;
 }
 
 void KdenliveDoc::switchTrackVideo(int ix, bool hide)
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "SWITCH Track outisde of range";
+        return;
+    }
     m_tracksList[ix].isBlind = hide; // !m_tracksList.at(ix).isBlind;
 }
 
@@ -1149,11 +1169,19 @@ void KdenliveDoc::insertTrack(int ix, TrackInfo type)
 
 void KdenliveDoc::deleteTrack(int ix)
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Delete Track outisde of range";
+        return;
+    }
     m_tracksList.removeAt(ix);
 }
 
 void KdenliveDoc::setTrackType(int ix, TrackInfo type)
 {
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "SET Track Type outisde of range";
+        return;
+    }
     m_tracksList[ix].type = type.type;
     m_tracksList[ix].isMute = type.isMute;
     m_tracksList[ix].isBlind = type.isBlind;
@@ -1251,5 +1279,69 @@ QMap <QString, QString> KdenliveDoc::getRenderProperties() const
     return renderProperties;
 }
 
+void KdenliveDoc::addTrackEffect(int ix, QDomElement effect)
+{
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Add Track effect outisde of range";
+        return;
+    }
+    effect.setAttribute("kdenlive_ix", m_tracksList.at(ix).effectsList.count() + 1);
+    m_tracksList[ix].effectsList.append(effect);
+}
+
+void KdenliveDoc::removeTrackEffect(int ix, QDomElement effect)
+{
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Remove Track effect outisde of range";
+        return;
+    }
+    QString index;
+    QString toRemove = effect.attribute("kdenlive_ix");
+    for (int i = 0; i < m_tracksList.at(ix).effectsList.count(); ++i) {
+        index = m_tracksList.at(ix).effectsList.at(i).attribute("kdenlive_ix");
+        if (toRemove == index) {
+            m_tracksList[ix].effectsList.removeAt(i);
+            i--;
+        } else if (index.toInt() > toRemove.toInt()) {
+            m_tracksList[ix].effectsList.item(i).setAttribute("kdenlive_ix", index.toInt() - 1);
+        }
+    }
+}
+
+void KdenliveDoc::setTrackEffect(int trackIndex, int effectIndex, QDomElement effect)
+{
+    if (trackIndex < 0 || trackIndex >= m_tracksList.count()) {
+        kWarning() << "Set Track effect outisde of range";
+        return;
+    }
+    if (effectIndex < 0 || effectIndex > (m_tracksList.at(trackIndex).effectsList.count() - 1) || effect.isNull()) {
+        kDebug() << "Invalid effect index: " << effectIndex;
+        return;
+    }
+    kDebug() << "CHange TRK EFFECT AT: " << trackIndex;
+    effect.setAttribute("kdenlive_ix", effectIndex + 1);
+    m_tracksList[trackIndex].effectsList.replace(effectIndex, effect);
+}
+
+const EffectsList KdenliveDoc::getTrackEffects(int ix)
+{
+    if (ix < 0 || ix >= m_tracksList.count()) {
+        kWarning() << "Get Track effects outisde of range";
+        return EffectsList();
+    }
+    return m_tracksList.at(ix).effectsList;
+}
+
+QDomElement KdenliveDoc::getTrackEffect(int trackIndex, int effectIndex) const
+{
+    if (trackIndex < 0 || trackIndex >= m_tracksList.count()) {
+        kWarning() << "Get Track effect outisde of range";
+        return QDomElement();
+    }
+    EffectsList list = m_tracksList.at(trackIndex).effectsList;
+    if (effectIndex > list.count() - 1 || effectIndex < 0 || list.at(effectIndex).isNull()) return QDomElement();
+    return list.at(effectIndex).cloneNode().toElement();
+}
+
 #include "kdenlivedoc.moc"
 
index 44997b43dec156027dfd888c7ae8739d7af5dc4c..2274fe8de70960837c7061de155eb8e49fc74883 100644 (file)
@@ -116,6 +116,11 @@ Q_OBJECT public:
     const QString getDocumentProperty(const QString &name) const;
     /** @brief get the list of renderer properties that were saved in the document */
     QMap <QString, QString> getRenderProperties() const;
+    void addTrackEffect(int ix, QDomElement effect);
+    void removeTrackEffect(int ix, QDomElement effect);
+    void setTrackEffect(int trackIndex, int effectIndex, QDomElement effect);
+    const EffectsList getTrackEffects(int ix);
+    QDomElement getTrackEffect(int trackIndex, int effectIndex) const;
 
 private:
     KUrl m_url;
index 7d652a5cb45157dfec4db002cef5f3e80f6992c9..d900c254d13517721a0d09e1b1e00565e1cecfa2 100644 (file)
@@ -2108,10 +2108,10 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
             disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
             disconnect(m_activeTimeline, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
             disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
-            disconnect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
-            disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
-            disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
-            disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
+            disconnect(m_effectStack, SIGNAL(updateEffect(ClipItem*, int, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, int, QDomElement, QDomElement, int)));
+            disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, int, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, int, QDomElement)));
+            disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, int, bool)));
+            disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int, int)));
             disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
             disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
             disconnect(m_effectStack, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
@@ -2174,6 +2174,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
 
     connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), m_effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
     connect(trackView->projectView(), SIGNAL(updateClipMarkers(DocClipBase *)), this, SLOT(slotUpdateClipMarkers(DocClipBase*)));
+    connect(trackView, SIGNAL(showTrackEffects(int, EffectsList)), m_effectStack, SLOT(slotTrackItemSelected(int, EffectsList)));
+    connect(trackView, SIGNAL(showTrackEffects(int, EffectsList)), this, SLOT(slotActivateEffectStackView()));
 
     connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
     connect(trackView->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
@@ -2188,11 +2190,11 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
 
 
-    connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
+    connect(m_effectStack, SIGNAL(updateEffect(ClipItem*, int, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, int, QDomElement, QDomElement, int)));
     connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
-    connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
-    connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, bool)));
-    connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int)));
+    connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, int, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, int, QDomElement)));
+    connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, int, bool)));
+    connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, int, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, int, int)));
     connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
     connect(m_transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
     connect(m_transitionConfig, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
index 059faf0a64358fd4f655d49790da0fd5047f4d30..f3002a87bfcb05817038026377fb0e6a7c92f157 100644 (file)
@@ -678,7 +678,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int
 
     // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken although outpoint is larger
     if (xml.attribute("type").toInt() == COLOR || xml.attribute("type").toInt() == TEXT
-        || xml.attribute("type").toInt() == IMAGE || xml.attribute("type").toInt() == SLIDESHOW)
+            || xml.attribute("type").toInt() == IMAGE || xml.attribute("type").toInt() == SLIDESHOW)
         producer->set("length", xml.attribute("out").toInt() - xml.attribute("in").toInt() + 1);
 
     if (xml.hasAttribute("out")) producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt());
@@ -2248,8 +2248,40 @@ int Render::mltChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, dou
     return newLength;
 }
 
+bool Render::mltRemoveTrackEffect(int track, QString index, bool updateIndex)
+{
+    kDebug() << "REMOVE TK EFF: " << track << ", IX: " << index;
+    Mlt::Service service(m_mltProducer->parent().get_service());
+    bool success = false;
+    Mlt::Tractor tractor(service);
+    Mlt::Producer trackProducer(tractor.track(track));
+    Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+    Mlt::Service clipService(trackPlaylist.get_service());
+
+    m_isBlocked = true;
+    int ct = 0;
+    Mlt::Filter *filter = clipService.filter(ct);
+    while (filter) {
+        if ((index == "-1" && strcmp(filter->get("kdenlive_id"), ""))  || filter->get("kdenlive_ix") == index) {
+            if (clipService.detach(*filter) == 0) success = true;
+        } else if (updateIndex) {
+            // Adjust the other effects index
+            if (QString(filter->get("kdenlive_ix")).toInt() > index.toInt()) filter->set("kdenlive_ix", QString(filter->get("kdenlive_ix")).toInt() - 1);
+            ct++;
+        } else ct++;
+        filter = clipService.filter(ct);
+    }
+    m_isBlocked = false;
+    refresh();
+    return success;
+}
+
 bool Render::mltRemoveEffect(int track, GenTime position, QString index, bool updateIndex, bool doRefresh)
 {
+    if (position < GenTime()) {
+        // Remove track effect
+        return mltRemoveTrackEffect(track, index, updateIndex);
+    }
     Mlt::Service service(m_mltProducer->parent().get_service());
     bool success = false;
     Mlt::Tractor tractor(service);
@@ -2298,7 +2330,7 @@ bool Render::mltAddTrackEffect(int track, EffectsParameterList params)
     Mlt::Tractor tractor(service);
     Mlt::Producer trackProducer(tractor.track(track));
     Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
-    Mlt::Service trackService(trackPlaylist.get_service());
+    Mlt::Service trackService(trackProducer.get_service()); //trackPlaylist
     return mltAddEffect(trackService, params, 15000, true);
 }
 
@@ -2329,7 +2361,7 @@ bool Render::mltAddEffect(int track, GenTime position, EffectsParameterList para
     delete clip;
     return mltAddEffect(clipService, params, duration, doRefresh);
 }
-    
+
 bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int duration, bool doRefresh)
 {
     bool updateIndex = false;
@@ -2502,6 +2534,55 @@ bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int
     return true;
 }
 
+bool Render::mltEditTrackEffect(int track, EffectsParameterList params)
+{
+    kDebug() << "EDIT TK, FILTER: " << track;
+    Mlt::Service service(m_mltProducer->parent().get_service());
+    Mlt::Tractor tractor(service);
+    Mlt::Producer trackProducer(tractor.track(track));
+    Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+    Mlt::Service clipService(trackPlaylist.get_service());
+    m_isBlocked = true;
+    int ct = 0;
+    QString index = params.paramValue("kdenlive_ix");
+    QString tag =  params.paramValue("tag");
+
+    Mlt::Filter *filter = clipService.filter(ct);
+    while (filter) {
+        if (filter->get("kdenlive_ix") == index) {
+            break;
+        }
+        ct++;
+        filter = clipService.filter(ct);
+    }
+
+    if (!filter) {
+        kDebug() << "WARINIG, FILTER FOR EDITING NOT FOUND, ADDING IT! " << index << ", " << tag;
+        // filter was not found, it was probably a disabled filter, so add it to the correct place...
+
+        bool success = false;//mltAddTrackEffect(track, params);
+        m_isBlocked = false;
+        return success;
+    }
+    QString prefix;
+    QString ser = filter->get("mlt_service");
+    if (ser == "region") prefix = "filter0.";
+    mlt_service_lock(service.get_service());
+    for (int j = 0; j < params.count(); j++) {
+        char *name = decodedString(prefix + params.at(j).name());
+        char *value = decodedString(params.at(j).value());
+        filter->set(name, value);
+        delete[] name;
+        delete[] value;
+    }
+    mlt_service_unlock(service.get_service());
+
+    m_isBlocked = false;
+    refresh();
+    return true;
+
+}
+
 bool Render::mltEditEffect(int track, GenTime position, EffectsParameterList params)
 {
     QString index = params.paramValue("kdenlive_ix");
@@ -2513,7 +2594,9 @@ bool Render::mltEditEffect(int track, GenTime position, EffectsParameterList par
         bool success = mltAddEffect(track, position, params);
         return success;
     }
-
+    if (position < GenTime()) {
+        return mltEditTrackEffect(track, params);
+    }
     // find filter
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
@@ -2584,10 +2667,7 @@ bool Render::mltEditEffect(int track, GenTime position, EffectsParameterList par
 
 void Render::mltUpdateEffectPosition(int track, GenTime position, int oldPos, int newPos)
 {
-
-    kDebug() << "MOVING EFFECT FROM " << oldPos << ", TO: " << newPos;
     Mlt::Service service(m_mltProducer->parent().get_service());
-
     Mlt::Tractor tractor(service);
     Mlt::Producer trackProducer(tractor.track(track));
     Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
@@ -2624,10 +2704,11 @@ void Render::mltUpdateEffectPosition(int track, GenTime position, int oldPos, in
 
 void Render::mltMoveEffect(int track, GenTime position, int oldPos, int newPos)
 {
-
-    kDebug() << "MOVING EFFECT FROM " << oldPos << ", TO: " << newPos;
+    if (position < GenTime()) {
+        mltMoveTrackEffect(track, oldPos, newPos);
+        return;
+    }
     Mlt::Service service(m_mltProducer->parent().get_service());
-
     Mlt::Tractor tractor(service);
     Mlt::Producer trackProducer(tractor.track(track));
     Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
@@ -2703,6 +2784,70 @@ void Render::mltMoveEffect(int track, GenTime position, int oldPos, int newPos)
     if (doRefresh) refresh();
 }
 
+void Render::mltMoveTrackEffect(int track, int oldPos, int newPos)
+{
+    Mlt::Service service(m_mltProducer->parent().get_service());
+    Mlt::Tractor tractor(service);
+    Mlt::Producer trackProducer(tractor.track(track));
+    Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+
+    Mlt::Service clipService(trackPlaylist.get_service());
+
+    m_isBlocked = true;
+    int ct = 0;
+    QList <Mlt::Filter *> filtersList;
+    Mlt::Filter *filter = clipService.filter(ct);
+    bool found = false;
+    if (newPos > oldPos) {
+        while (filter) {
+            if (!found && QString(filter->get("kdenlive_ix")).toInt() == oldPos) {
+                filter->set("kdenlive_ix", newPos);
+                filtersList.append(filter);
+                clipService.detach(*filter);
+                filter = clipService.filter(ct);
+                while (filter && QString(filter->get("kdenlive_ix")).toInt() <= newPos) {
+                    filter->set("kdenlive_ix", QString(filter->get("kdenlive_ix")).toInt() - 1);
+                    ct++;
+                    filter = clipService.filter(ct);
+                }
+                found = true;
+            }
+            if (filter && QString(filter->get("kdenlive_ix")).toInt() > newPos) {
+                filtersList.append(filter);
+                clipService.detach(*filter);
+            } else ct++;
+            filter = clipService.filter(ct);
+        }
+    } else {
+        while (filter) {
+            if (QString(filter->get("kdenlive_ix")).toInt() == oldPos) {
+                filter->set("kdenlive_ix", newPos);
+                filtersList.append(filter);
+                clipService.detach(*filter);
+            } else ct++;
+            filter = clipService.filter(ct);
+        }
+
+        ct = 0;
+        filter = clipService.filter(ct);
+        while (filter) {
+            int pos = QString(filter->get("kdenlive_ix")).toInt();
+            if (pos >= newPos) {
+                if (pos < oldPos) filter->set("kdenlive_ix", pos + 1);
+                filtersList.append(filter);
+                clipService.detach(*filter);
+            } else ct++;
+            filter = clipService.filter(ct);
+        }
+    }
+
+    for (int i = 0; i < filtersList.count(); i++) {
+        clipService.attach(*(filtersList.at(i)));
+    }
+    m_isBlocked = false;
+    refresh();
+}
+
 bool Render::mltResizeClipEnd(ItemInfo info, GenTime clipDuration)
 {
     m_isBlocked = true;
index 5fbdb50727d92929f2d8e3dd16b72660d2880fc7..693dd4057283eebc506f973701284bab1d5b937f 100644 (file)
@@ -202,6 +202,7 @@ Q_OBJECT public:
 
     /** @brief Deletes an effect from a clip in MLT's playlist. */
     bool mltRemoveEffect(int track, GenTime position, QString index, bool updateIndex, bool doRefresh = true);
+    bool mltRemoveTrackEffect(int track, QString index, bool updateIndex);
 
     /** @brief Adds an effect to a clip in MLT's playlist. */
     bool mltAddEffect(int track, GenTime position, EffectsParameterList params, bool doRefresh = true);
@@ -210,6 +211,7 @@ Q_OBJECT public:
 
     /** @brief Edits an effect parameters in MLT's playlist. */
     bool mltEditEffect(int track, GenTime position, EffectsParameterList params);
+    bool mltEditTrackEffect(int track, EffectsParameterList params);
 
     /** @brief Updates the "kdenlive_ix" (index) value of an effect. */
     void mltUpdateEffectPosition(int track, GenTime position, int oldPos, int newPos);
@@ -219,6 +221,7 @@ Q_OBJECT public:
      * It switches effects from oldPos and newPos, updating the "kdenlive_ix"
      * (index) value. */
     void mltMoveEffect(int track, GenTime position, int oldPos, int newPos);
+    void mltMoveTrackEffect(int track, int oldPos, int newPos);
 
     /** @brief Enables/disables audio/video in a track. */
     void mltChangeTrackState(int track, bool mute, bool blind);
index 2321374be76c49b44ae456c69798a8b751055afd..93c0e9ed4633809514f609d97a9167782685cbbd 100644 (file)
@@ -105,6 +105,7 @@ TrackView::TrackView(KdenliveDoc *doc, bool *ok, QWidget *parent) :
     connect(m_trackview, SIGNAL(trackHeightChanged()), this, SLOT(slotRebuildTrackHeaders()));
     connect(m_trackview, SIGNAL(tracksChanged()), this, SLOT(slotReloadTracks()));
     connect(m_trackview, SIGNAL(updateTrackHeaders()), this, SLOT(slotRepaintTracks()));
+    connect(m_trackview, SIGNAL(showTrackEffects(int, EffectsList)), this, SIGNAL(showTrackEffects(int, EffectsList)));
 
     parseDocument(m_doc->toXml());
     if (m_doc->setSceneList() == -1) *ok = false;
@@ -557,7 +558,8 @@ void TrackView::slotRebuildTrackHeaders()
         connect(header, SIGNAL(insertTrack(int)), this, SIGNAL(insertTrack(int)));
         connect(header, SIGNAL(renameTrack(int, QString)), this, SLOT(slotRenameTrack(int, QString)));
         connect(header, SIGNAL(configTrack(int)), this, SIGNAL(configTrack(int)));
-       connect(header, SIGNAL(addTrackInfo(const QDomElement, int)), m_trackview, SLOT(slotAddTrackEffect(const QDomElement, int)));
+        connect(header, SIGNAL(addTrackInfo(const QDomElement, int)), m_trackview, SLOT(slotAddTrackEffect(const QDomElement, int)));
+        connect(header, SIGNAL(showTrackEffects(int)), this, SLOT(slotShowTrackEffects(int)));
         headers_container->layout()->addWidget(header);
     }
     frame = new QFrame(this);
@@ -977,4 +979,9 @@ void TrackView::updateRuler()
     m_ruler->update();
 }
 
+void TrackView::slotShowTrackEffects(int ix)
+{
+    emit showTrackEffects(m_doc->tracksCount() - ix, m_doc->getTrackEffects(ix));
+}
+
 #include "trackview.moc"
index e1ee869808a21508d2d1809bbc51de61c22cd2fd..a46530ddc4f73b0b747bbd52ed83b0cb907a2d00 100644 (file)
@@ -35,6 +35,7 @@
 #include <KRuler>
 
 #include "customtrackscene.h"
+#include "effectslist.h"
 #include "ui_timeline_ui.h"
 
 class ClipItem;
@@ -123,6 +124,7 @@ private slots:
      * the horizontal scrollbar is visible and the position
      * of the vertical scrollbar is maximal */
     void slotUpdateVerticalScroll(int min, int max);
+    void slotShowTrackEffects(int);
 
 signals:
     void mousePosition(int);
@@ -133,6 +135,7 @@ signals:
     void configTrack(int);
     void updateTracksInfo();
     void setZoom(int);
+    void showTrackEffects(int, EffectsList);
 };
 
 #endif