initeffects.cpp
effectslistview.cpp
addeffectcommand.cpp
+ editeffectcommand.cpp
effectstackview.cpp
effectstackedit.cpp
parameterplotter.cpp
#include "resizeclipcommand.h"
#include "addtimelineclipcommand.h"
#include "addeffectcommand.h"
+#include "editeffectcommand.h"
CustomTrackView::CustomTrackView(KdenliveDoc *doc, QGraphicsScene * projectscene, QWidget *parent)
: QGraphicsView(projectscene, parent), m_tracksCount(0), m_cursorPos(0), m_dropItem(NULL), m_cursorLine(NULL), m_operationMode(NONE), m_startPos(QPointF()), m_dragItem(NULL), m_visualTip(NULL), m_moveOpMode(NONE), m_animation(NULL), m_projectDuration(0), m_scale(1.0), m_clickPoint(0), m_document(doc)
m_commandStack->push(command);
}
-
-void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement effect)
+void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement effect)
{
+ ClipItem *clip = getClipItemAt(pos.frames(m_document->fps()) + 1, m_tracksCount - track);
+ if (clip){
QMap <QString, QString> effectParams = clip->getEffectArgs(effect);
m_document->renderer()->mltEditEffect(m_tracksCount - clip->track(), GenTime(clip->startPos(), m_document->fps()), effectParams);
+ }
+}
+
+
+void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect)
+{
+ EditEffectCommand *command = new EditEffectCommand(this, m_tracksCount - clip->track(), GenTime(clip->startPos(), m_document->fps()), oldeffect, effect, true);
+ m_commandStack->push(command);
}
void slotAddEffect(QDomElement effect);
void addEffect(int track, GenTime pos, QDomElement effect);
void deleteEffect(int track, GenTime pos, QDomElement effect);
+ void updateEffect(int track, GenTime pos, QDomElement effect);
public slots:
void setCursorPos(int pos, bool seek = true);
void slotDeleteEffect(ClipItem *clip, QDomElement effect);
- void slotUpdateClipEffect(ClipItem *clip, QDomElement effect);
+ void slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect);
void slotRefreshEffects(ClipItem *clip);
void setDuration(int duration);
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include <KLocale>
+
+#include "editeffectcommand.h"
+
+EditEffectCommand::EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, bool doIt)
+ : m_view(view), m_track(track), m_pos(pos), m_oldeffect(oldeffect), m_doIt(doIt) {
+ m_effect = effect.cloneNode().toElement();
+ setText(i18n("Edit effect"));
+ }
+
+
+// virtual
+void EditEffectCommand::undo()
+{
+kDebug()<<"---- undoing action";
+ m_view->updateEffect(m_track, m_pos, m_oldeffect);
+}
+// virtual
+void EditEffectCommand::redo()
+{
+kDebug()<<"---- redoing action";
+ m_view->updateEffect(m_track, m_pos, m_effect);
+}
+
+#include "editeffectcommand.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef EDITEFFECTCOMMAND_H
+#define EDITEFFECTCOMMAND_H
+
+#include <QUndoCommand>
+#include <KDebug>
+
+#include "customtrackview.h"
+
+class EditEffectCommand : public QUndoCommand
+ {
+ public:
+ EditEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, bool doIt);
+
+ virtual void undo();
+ virtual void redo();
+
+ private:
+ CustomTrackView *m_view;
+ int m_track;
+ QDomElement m_effect;
+ QDomElement m_oldeffect;
+ GenTime m_pos;
+ bool m_doIt;
+ };
+
+#endif
+
}
}
void EffectStackEdit::collectAllParameters(){
-
+ QDomElement oldparam = params.cloneNode().toElement();
QDomNodeList namenode = params.elementsByTagName("parameter");
for (int i=0;i< namenode.count() ;i++){
pa.attributes().namedItem("value").setNodeValue(setValue);
}
}
- emit parameterChanged(params);
+ emit parameterChanged(oldparam, params);
}
void EffectStackEdit::createSliderItem(const QString& name, int val ,int min, int max){
void slotSliderMoved(int);
void collectAllParameters();
signals:
- void parameterChanged(const QDomElement& );
+ void parameterChanged(const QDomElement&, const QDomElement& );
};
#endif
connect (ui.buttonDown, SIGNAL (clicked()), this, SLOT (slotItemDown()) );
connect (ui.buttonDel, SIGNAL (clicked()), this, SLOT (slotItemDel()) );
connect( this, SIGNAL (transferParamDesc(const QDomElement&,int ,int) ), effectedit , SLOT(transferParamDesc(const QDomElement&,int ,int)));
- connect(effectedit, SIGNAL (parameterChanged(const QDomElement& ) ), this , SLOT (slotUpdateEffectParams(const QDomElement&)));
+ connect(effectedit, SIGNAL (parameterChanged( const QDomElement&, const QDomElement& ) ), this , SLOT (slotUpdateEffectParams( const QDomElement&, const QDomElement& )));
effectLists["audio"]=audioEffectList;
effectLists["video"]=videoEffectList;
effectLists["custom"]=customEffectList;
}
-void EffectStackView::slotUpdateEffectParams(const QDomElement& e){
+void EffectStackView::slotUpdateEffectParams(const QDomElement& old, const QDomElement& e){
if (clipref)
- emit updateClipEffect(clipref, e);
+ emit updateClipEffect(clipref, old, e);
}
void EffectStackView::slotClipItemSelected(ClipItem* c)
void slotItemDel();
void slotNewEffect();
void itemSelectionChanged();
- void slotUpdateEffectParams(const QDomElement&);
+ void slotUpdateEffectParams(const QDomElement&, const QDomElement&);
signals:
void transferParamDesc(const QDomElement&,int ,int);
void removeEffect(ClipItem*, QDomElement);
/** Parameters for an effect changed, update the filter in playlist */
- void updateClipEffect(ClipItem*, QDomElement);
+ void updateClipEffect(ClipItem*, QDomElement, QDomElement);
/** An effect in stack was moved, we need to regenerate
all effects for this clip in the playlist */
void refreshEffectStack(ClipItem *);
connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
- connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement)));
+ connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));