--- /dev/null
+/***************************************************************************
+ addtransitioncommand.cpp - description
+ -------------------
+ begin : 2008
+ copyright : (C) 2008 by Marco Gittler
+ email : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#include <KLocale>
+
+#include "addtransitioncommand.h"
+
+AddTransitionCommand::AddTransitionCommand(CustomTrackView *view, int track, QDomElement xml, GenTime pos, bool doIt) : m_view(view), m_track(track), m_xml(xml), m_pos(pos), m_doIt(doIt) {
+ if (m_doIt) setText(i18n("Add transition to clip"));
+ else setText(i18n("Delete transition from clip"));
+}
+
+
+// virtual
+void AddTransitionCommand::undo() {
+ if (!m_doIt) m_view->deleteTransition(m_track, m_pos, m_xml);
+ else m_view->addTransition(m_track , m_pos, m_xml);
+}
+// virtual
+void AddTransitionCommand::redo() {
+ if (m_doIt) m_view->addTransition(m_track , m_pos, m_xml);
+ else m_view->deleteTransition(m_track, m_pos, m_xml);
+ m_doIt = true;
+}
+
+#include "addtimelineclipcommand.moc"
--- /dev/null
+/***************************************************************************
+ addtransitioncommand.h - description
+ -------------------
+ begin : 2008
+ copyright : (C) 2008 by Marco Gittler
+ email : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef TIMELINETRANSITIONCOMMAND_H
+#define TIMELINETRANSITIONCOMMAND_H
+
+#include <QUndoCommand>
+#include <QGraphicsView>
+#include <QPointF>
+
+#include <KDebug>
+
+#include "gentime.h"
+#include "projectlist.h"
+#include "customtrackview.h"
+
+class AddTransitionCommand : public QUndoCommand {
+public:
+ AddTransitionCommand(CustomTrackView *view, int track, QDomElement xml , GenTime pos, bool doIt);
+ virtual void undo();
+ virtual void redo();
+
+private:
+ CustomTrackView *m_view;
+ GenTime m_pos;
+ QDomElement m_xml;
+ int m_track;
+ bool m_doIt;
+};
+
+#endif
+
}
void ClipItem::addTransition(Transition* t) {
m_transitionsList.append(t);
+ CustomTrackView *view = (CustomTrackView *) scene()->views()[0];
+ QDomDocument doc;
+ QDomElement e = doc.documentElement();
+ if (view) view->slotAddTransition(this, QDomElement() , t->startPos(), m_track);
}
// virtual
/*
#include "addtimelineclipcommand.h"
#include "addeffectcommand.h"
#include "editeffectcommand.h"
+#include "addtransitioncommand.h"
#include "kdenlivesettings.h"
#include "transition.h"
m_commandStack->push(command);
}
+void CustomTrackView::slotAddTransition(ClipItem* clip , QDomElement transition, GenTime startTime , int startTrack) {
+ AddTransitionCommand* command = new AddTransitionCommand(this, startTrack, transition, startTime, true);
+ m_commandStack->push(command);
+}
+
+void CustomTrackView::addTransition(int startTrack, GenTime startPos , QDomElement) {
+ QMap < QString, QString> map;
+ map["combine"] = "1";
+ map["valign"] = "1";
+ map["progressive"] = "1";
+ map["fill"] = "1";
+ map["halign"] = "1";
+ m_document->renderer()->mltAddTransition("composite", startTrack, startTrack + 1 , startPos, startPos + GenTime(2.5), map);
+ m_document->setModified(true);
+}
+
+void CustomTrackView::deleteTransition(int, GenTime, QDomElement) {
+
+}
void CustomTrackView::addItem(DocClipBase *clip, QPoint pos) {
int in = 0;
void addEffect(int track, GenTime pos, QDomElement effect);
void deleteEffect(int track, GenTime pos, QDomElement effect);
void updateEffect(int track, GenTime pos, QDomElement effect);
+ void addTransition(int track, GenTime pos, QDomElement transition);
+ void deleteTransition(int track, GenTime pos, QDomElement transition);
void activateMonitor();
int duration() const;
void deleteSelectedClips();
void slotUpdateClipEffect(ClipItem *clip, QDomElement oldeffect, QDomElement effect);
void slotRefreshEffects(ClipItem *clip);
void setDuration(int duration);
+ void slotAddTransition(ClipItem* clip , QDomElement transition, GenTime startTime , int startTrack);
protected:
virtual void drawBackground(QPainter * painter, const QRectF & rect);
};
#endif
+