#include "commands/insertspacecommand.h"
#include "spacerdialog.h"
#include "commands/addtrackcommand.h"
+#include "commands/changeeffectstatecommand.h"
#include "commands/movegroupcommand.h"
#include "ui_addtrack_ui.h"
#include "initeffects.h"
#include <QGraphicsDropShadowEffect>
#endif
+#define SEEK_INACTIVE (-1)
+
//#define DEBUG
bool sortGuidesList(const Guide *g1 , const Guide *g2)
if (mapFromScene(m_cursorPos, 0).x() < 3) {
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 2);
QTimer::singleShot(200, this, SLOT(slotCheckPositionScrolling()));
- setCursorPos(mapToScene(QPoint(-2, 0)).x());
+ seekCursorPos(mapToScene(QPoint(-2, 0)).x());
} else if (viewport()->width() - 3 < mapFromScene(m_cursorPos + 1, 0).x()) {
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 2);
- setCursorPos(mapToScene(QPoint(viewport()->width(), 0)).x() + 1);
+ seekCursorPos(mapToScene(QPoint(viewport()->width(), 0)).x() + 1);
QTimer::singleShot(200, this, SLOT(slotCheckPositionScrolling()));
}
}
bool move = (event->pos() - m_clickEvent).manhattanLength() >= QApplication::startDragDistance();
if (m_dragItem && m_tool == SELECTTOOL) {
if (m_operationMode == MOVE && move) {
+ //m_dragItem->setProperty("y_absolute", event->pos().y());
QGraphicsView::mouseMoveEvent(event);
// If mouse is at a border of the view, scroll
if (pos < 5) {
// all other modes break the selection, so the user probably wants to move it
opMode = MOVE;
} else {
- opMode = clip->operationMode(mapToScene(event->pos()));
+ if (clip->rect().width() * transform().m11() < 15) {
+ // If the item is very small, only allow move
+ opMode = MOVE;
+ }
+ else opMode = clip->operationMode(mapToScene(event->pos()));
}
const double size = 5;
if (event->buttons() != Qt::NoButton && event->modifiers() == Qt::NoModifier) {
QGraphicsView::mouseMoveEvent(event);
m_moveOpMode = SEEK;
- setCursorPos(mappedXPos);
+ seekCursorPos(mappedXPos);
slotCheckPositionScrolling();
return;
} else m_moveOpMode = NONE;
else
m_dragItem = collisionClip;
found = true;
+ m_dragItem->setProperty("y_absolute", m_clickEvent.y() - m_dragItem->scenePos().y());
m_dragItemInfo = m_dragItem->info();
if (m_dragItem->parentItem() && m_dragItem->parentItem()->type() == GROUPWIDGET && m_dragItem->parentItem() != m_selectionGroup) {
// kDebug()<<"// KLIK FOUND GRP: "<<m_dragItem->sceneBoundingRect();
}
m_operationMode = SPACER;
} else {
- setCursorPos((int)(mapToScene(event->x(), 0).x()));
+ seekCursorPos((int)(mapToScene(event->x(), 0).x()));
}
//QGraphicsView::mousePressEvent(event);
event->ignore();
// all other modes break the selection, so the user probably wants to move it
m_operationMode = MOVE;
} else {
- m_operationMode = m_dragItem->operationMode(mapToScene(event->pos()));
+ if (m_dragItem->rect().width() * transform().m11() < 15) {
+ // If the item is very small, only allow move
+ m_operationMode = MOVE;
+ }
+ else m_operationMode = m_dragItem->operationMode(mapToScene(event->pos()));
}
m_controlModifier = (event->modifiers() == Qt::ControlModifier);
ClipItem * item = static_cast <ClipItem *>(m_dragItem);
//QString previous = item->keyframes(item->selectedEffectIndex());
QDomElement oldEffect = item->selectedEffect().cloneNode().toElement();
- item->insertKeyframe(item->getEffectAt(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
+ item->insertKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), keyFramePos.frames(m_document->fps()), val);
//item->updateKeyframeEffect();
//QString next = item->keyframes(item->selectedEffectIndex());
QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
- EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
//EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
m_commandStack->push(command);
- updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
+ updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item, item->selectedEffectIndex());
}
} else if (m_dragItem && !m_dragItem->isItemLocked()) {
else
getClipAvailableSpace(item, minimum, maximum);
- ClipDurationDialog d(item, m_document->timecode(), minimum, maximum, this);
- if (d.exec() == QDialog::Accepted) {
+ QPointer<ClipDurationDialog> d = new ClipDurationDialog(item,
+ m_document->timecode(), minimum, maximum, this);
+ if (d->exec() == QDialog::Accepted) {
ItemInfo clipInfo = item->info();
ItemInfo startInfo = clipInfo;
if (item->type() == TRANSITIONWIDGET) {
// move & resize transition
- clipInfo.startPos = d.startPos();
- clipInfo.endPos = clipInfo.startPos + d.duration();
+ clipInfo.startPos = d->startPos();
+ clipInfo.endPos = clipInfo.startPos + d->duration();
clipInfo.track = item->track();
MoveTransitionCommand *command = new MoveTransitionCommand(this, startInfo, clipInfo, true);
updateTrackDuration(clipInfo.track, command);
ClipItem *clip = static_cast<ClipItem *>(item);
QUndoCommand *moveCommand = new QUndoCommand();
moveCommand->setText(i18n("Edit clip"));
- if (d.duration() < item->cropDuration() || d.cropStart() != clipInfo.cropStart) {
+ if (d->duration() < item->cropDuration() || d->cropStart() != clipInfo.cropStart) {
// duration was reduced, so process it first
- clipInfo.endPos = clipInfo.startPos + d.duration();
- clipInfo.cropStart = d.cropStart();
+ clipInfo.endPos = clipInfo.startPos + d->duration();
+ clipInfo.cropStart = d->cropStart();
resizeClip(startInfo, clipInfo);
new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
}
- if (d.startPos() != clipInfo.startPos) {
+ if (d->startPos() != clipInfo.startPos) {
startInfo = clipInfo;
- clipInfo.startPos = d.startPos();
+ clipInfo.startPos = d->startPos();
clipInfo.endPos = item->endPos() + (clipInfo.startPos - startInfo.startPos);
new MoveClipCommand(this, startInfo, clipInfo, true, moveCommand);
}
- if (d.duration() > item->cropDuration()) {
+ if (d->duration() > item->cropDuration()) {
// duration was increased, so process it after move
startInfo = clipInfo;
- clipInfo.endPos = clipInfo.startPos + d.duration();
- clipInfo.cropStart = d.cropStart();
+ clipInfo.endPos = clipInfo.startPos + d->duration();
+ clipInfo.cropStart = d->cropStart();
resizeClip(startInfo, clipInfo);
new ResizeClipCommand(this, startInfo, clipInfo, false, true, moveCommand);
m_commandStack->push(moveCommand);
}
}
+ delete d;
} else {
emit displayMessage(i18n("Item is locked"), ErrorMessage);
}
void CustomTrackView::dragEnterEvent(QDragEnterEvent * event)
{
if (insertDropClips(event->mimeData(), event->pos())) {
- event->acceptProposedAction();
+ if (event->source() == this) {
+ event->setDropAction(Qt::MoveAction);
+ event->accept();
+ } else {
+ event->setDropAction(Qt::MoveAction);
+ event->acceptProposedAction();
+ }
} else QGraphicsView::dragEnterEvent(event);
}
}
bool success = true;
for (int i = 0; i < clip->effectsCount(); i++) {
- if (!m_document->renderer()->mltAddEffect(track, pos, getEffectArgs(clip->effectAt(i)), false)) success = false;
+ if (!m_document->renderer()->mltAddEffect(track, pos, getEffectArgs(clip->effect(i)), false)) success = false;
}
if (!success) emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
m_document->renderer()->doRefresh();
EffectsParameterList params = clip->addEffect(effect);
if (!m_document->renderer()->mltAddEffect(track, pos, params))
emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
+ clip->setSelectedEffect(params.paramValue("kdenlive_ix").toInt());
if (clip->isSelected()) emit clipItemSelected(clip);
} else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
}
QList<QGraphicsItem *> itemList = group->childItems();
QUndoCommand *effectCommand = new QUndoCommand();
QString effectName;
+ int offset = effect.attribute("clipstart").toInt();
QDomElement namenode = effect.firstChildElement("name");
if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
else effectName = i18n("effect");
effectCommand->setText(i18n("Add %1", effectName));
- int count = 0;
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
- if (effect.attribute("type") == "audio") {
- // Don't add audio effects on video clips
- if (item->isVideoOnly() || (item->clipType() != AUDIO && item->clipType() != AV && item->clipType() != PLAYLIST)) continue;
- } else if (effect.hasAttribute("type") == false) {
- // Don't add video effect on audio clips
- if (item->isAudioOnly() || item->clipType() == AUDIO) continue;
- }
-
- if (effect.attribute("unique", "0") != "0" && item->hasEffect(effect.attribute("tag"), effect.attribute("id")) != -1) {
- emit displayMessage(i18n("Effect already present in clip"), ErrorMessage);
- continue;
- }
- if (item->isItemLocked()) {
- continue;
- }
- item->initEffect(effect);
-
- new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
- count++;
+ if (effect.tagName() == "effectgroup") {
+ QDomNodeList effectlist = effect.elementsByTagName("effect");
+ for (int j = 0; j < effectlist.count(); j++) {
+ QDomElement subeffect = effectlist.at(j).toElement();
+ if (subeffect.hasAttribute("kdenlive_info")) {
+ // effect is in a group
+ EffectInfo effectInfo;
+ effectInfo.fromString(subeffect.attribute("kdenlive_info"));
+ if (effectInfo.groupIndex < 0) {
+ // group needs to be appended
+ effectInfo.groupIndex = item->nextFreeEffectGroupIndex();
+ subeffect.setAttribute("kdenlive_info", effectInfo.toString());
+ }
+ }
+ processEffect(item, subeffect, offset, effectCommand);
+ }
+ }
+ else {
+ processEffect(item, effect, offset, effectCommand);
+ }
}
}
- if (count > 0) {
+ if (effectCommand->childCount() > 0) {
m_commandStack->push(effectCommand);
setDocumentModified();
} else delete effectCommand;
}
+void CustomTrackView::slotAddEffect(ClipItem *clip, QDomElement effect)
+{
+ if (clip) slotAddEffect(effect, clip->startPos(), clip->track());
+}
+
void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track)
{
QList<QGraphicsItem *> itemList;
QUndoCommand *effectCommand = new QUndoCommand();
QString effectName;
- QDomElement namenode = effect.firstChildElement("name");
- if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
- else effectName = i18n("effect");
+
+ int offset = effect.attribute("clipstart").toInt();
+ if (effect.tagName() == "effectgroup") {
+ effectName = effect.attribute("name");
+ } else {
+ QDomElement namenode = effect.firstChildElement("name");
+ if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
+ else effectName = i18n("effect");
+ }
effectCommand->setText(i18n("Add %1", effectName));
if (track == -1) itemList = scene()->selectedItems();
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
- if (effect.attribute("type") == "audio") {
- // Don't add audio effects on video clips
- if (item->isVideoOnly() || (item->clipType() != AUDIO && item->clipType() != AV && item->clipType() != PLAYLIST)) {
- /* do not show error message when item is part of a group as the user probably knows what he does then
- * and the message is annoying when working with the split audio feature */
- if (!item->parentItem() || item->parentItem() == m_selectionGroup)
- emit displayMessage(i18n("Cannot add an audio effect to this clip"), ErrorMessage);
- continue;
- }
- } else if (effect.attribute("type") == "video" || !effect.hasAttribute("type")) {
- // Don't add video effect on audio clips
- if (item->isAudioOnly() || item->clipType() == AUDIO) {
- /* do not show error message when item is part of a group as the user probably knows what he does then
- * and the message is annoying when working with the split audio feature */
- if (!item->parentItem() || item->parentItem() == m_selectionGroup)
- emit displayMessage(i18n("Cannot add a video effect to this clip"), ErrorMessage);
- continue;
- }
- }
- if (item->hasEffect(effect.attribute("tag"), effect.attribute("id")) != -1 && effect.attribute("unique", "0") != "0") {
- emit displayMessage(i18n("Effect already present in clip"), ErrorMessage);
- continue;
- }
- if (item->isItemLocked()) {
- continue;
- }
-
- 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);
- }
- new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
+ if (effect.tagName() == "effectgroup") {
+ QDomNodeList effectlist = effect.elementsByTagName("effect");
+ for (int j = 0; j < effectlist.count(); j++) {
+ QDomElement subeffect = effectlist.at(j).toElement();
+ if (subeffect.hasAttribute("kdenlive_info")) {
+ // effect is in a group
+ EffectInfo effectInfo;
+ effectInfo.fromString(subeffect.attribute("kdenlive_info"));
+ if (effectInfo.groupIndex < 0) {
+ // group needs to be appended
+ effectInfo.groupIndex = item->nextFreeEffectGroupIndex();
+ subeffect.setAttribute("kdenlive_info", effectInfo.toString());
+ }
+ }
+ processEffect(item, subeffect, offset, effectCommand);
+ }
+ }
+ else processEffect(item, effect, offset, effectCommand);
}
}
if (effectCommand->childCount() > 0) {
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *clip = static_cast<ClipItem *>(itemList.at(i));
+ clip->setSelectedEffect(clip->effectsCount());
if (!clip->isSelected()) {
- clearSelection();
+ clearSelection(false);
clip->setSelected(true);
+ m_dragItem = clip;
+ emit clipItemSelected(clip);
}
- clip->setSelectedEffect(clip->effectsCount() - 1);
- emit clipItemSelected(clip, clip->effectsCount() - 1);
break;
}
}
} else delete effectCommand;
}
+void CustomTrackView::processEffect(ClipItem *item, QDomElement effect, int offset, QUndoCommand *effectCommand)
+{
+ if (effect.attribute("type") == "audio") {
+ // Don't add audio effects on video clips
+ if (item->isVideoOnly() || (item->clipType() != AUDIO && item->clipType() != AV && item->clipType() != PLAYLIST)) {
+ /* do not show error message when item is part of a group as the user probably knows what he does then
+ * and the message is annoying when working with the split audio feature */
+ if (!item->parentItem() || item->parentItem() == m_selectionGroup)
+ emit displayMessage(i18n("Cannot add an audio effect to this clip"), ErrorMessage);
+ return;
+ }
+ } else if (effect.attribute("type") == "video" || !effect.hasAttribute("type")) {
+ // Don't add video effect on audio clips
+ if (item->isAudioOnly() || item->clipType() == AUDIO) {
+ /* do not show error message when item is part of a group as the user probably knows what he does then
+ * and the message is annoying when working with the split audio feature */
+ if (!item->parentItem() || item->parentItem() == m_selectionGroup)
+ emit displayMessage(i18n("Cannot add a video effect to this clip"), ErrorMessage);
+ return;
+ }
+ }
+ if (effect.attribute("unique", "0") != "0" && item->hasEffect(effect.attribute("tag"), effect.attribute("id")) != -1) {
+ emit displayMessage(i18n("Effect already present in clip"), ErrorMessage);
+ return;
+ }
+ if (item->isItemLocked()) {
+ return;
+ }
+
+ 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()), offset);
+ } else {
+ item->initEffect(effect, 0, offset);
+ }
+ new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
+}
+
void CustomTrackView::slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup)
{
if (clip == NULL) {
ClipItem *item = static_cast <ClipItem *>(items.at(i));
int ix = item->hasEffect(effect.attribute("tag"), effect.attribute("id"));
if (ix != -1) {
- QDomElement eff = item->effectAt(ix);
+ QDomElement eff = item->effectAtIndex(ix);
new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), eff, false, delCommand);
}
}
setDocumentModified();
}
-void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool triggeredByUser)
+void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedEffect, bool updateEffectStack)
{
if (insertedEffect.isNull()) {
+ kDebug()<<"// Trying to add null effect";
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
return;
}
+ int ix = insertedEffect.attribute("kdenlive_ix").toInt();
QDomElement effect = insertedEffect.cloneNode().toElement();
//kDebug() << "// update effect ix: " << effect.attribute("kdenlive_ix")<<", GAIN: "<<EffectsList::parameter(effect, "gain");
if (pos < GenTime()) {
clip->initEffect(effect);
effectParams = getEffectArgs(effect);
}*/
- if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - track, pos, effectParams))
+ if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - track, pos, effectParams)) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ }
m_document->setTrackEffect(m_document->tracksCount() - track - 1, ix, effect);
emit updateTrackEffectState(track);
setDocumentModified();
if (strobe == 0) strobe = 1;
doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), speed, clip->speed(), strobe, clip->baseClip()->getId());
}
- clip->setEffectAt(ix, effect);
- if (ix == clip->selectedEffectIndex()) {
- clip->setSelectedEffect(ix);
- if (!triggeredByUser)
- emit clipItemSelected(clip, ix);
- }
+ clip->updateEffect(effect);
+ if (updateEffectStack && clip->isSelected())
+ emit clipItemSelected(clip);
+ if (ix == clip->selectedEffectIndex()) {
+ // make sure to update display of clip keyframes
+ clip->setSelectedEffect(ix);
+ }
return;
}
if (effect.attribute("tag") == "volume" || effect.attribute("tag") == "brightness") {
// A fade effect was modified, update the clip
if (effect.attribute("id") == "fadein" || effect.attribute("id") == "fade_from_black") {
- int pos = effectParams.paramValue("out").toInt() - effectParams.paramValue("in").toInt();
+ int pos = EffectsList::parameter(effect, "out").toInt() - EffectsList::parameter(effect, "in").toInt();
clip->setFadeIn(pos);
}
if (effect.attribute("id") == "fadeout" || effect.attribute("id") == "fade_to_black") {
- int pos = effectParams.paramValue("out").toInt() - effectParams.paramValue("in").toInt();
+ int pos = EffectsList::parameter(effect, "out").toInt() - EffectsList::parameter(effect, "in").toInt();
clip->setFadeOut(pos);
}
}
+ bool success = m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams);
- if (!m_document->renderer()->mltEditEffect(m_document->tracksCount() - clip->track(), clip->startPos(), effectParams))
- emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
-
- clip->setEffectAt(ix, effect);
- if (ix == clip->selectedEffectIndex()) {
- clip->setSelectedEffect(ix);
- if (!triggeredByUser)
- emit clipItemSelected(clip, ix);
- }
+ if (success) {
+ clip->updateEffect(effect);
+ if (updateEffectStack && clip->isSelected()) {
+ emit clipItemSelected(clip);
+ }
+ if (ix == clip->selectedEffectIndex()) {
+ // make sure to update display of clip keyframes
+ clip->setSelectedEffect(ix);
+ }
+ }
+ else emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
else emit displayMessage(i18n("Cannot find clip to update effect"), ErrorMessage);
setDocumentModified();
}
-void CustomTrackView::moveEffect(int track, GenTime pos, int oldPos, int newPos)
+void CustomTrackView::updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack)
+{
+ if (pos < GenTime()) {
+ // editing a track effect
+ if (!m_document->renderer()->mltEnableEffects(m_document->tracksCount() - track, pos, effectIndexes, disable)) {
+ emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ return;
+ }
+ m_document->enableTrackEffects(m_document->tracksCount() - track - 1, effectIndexes, disable);
+ emit updateTrackEffectState(track);
+ setDocumentModified();
+ return;
+ }
+ // editing a clip effect
+ ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
+ if (clip) {
+ bool success = m_document->renderer()->mltEnableEffects(m_document->tracksCount() - clip->track(), clip->startPos(), effectIndexes, disable);
+ if (success) {
+ clip->enableEffects(effectIndexes, disable);
+ if (updateEffectStack && clip->isSelected()) {
+ emit clipItemSelected(clip);
+ }
+ if (effectIndexes.contains(clip->selectedEffectIndex())) {
+ // make sure to update display of clip keyframes
+ clip->setSelectedEffect(clip->selectedEffectIndex());
+ }
+ }
+ else emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ }
+ else emit displayMessage(i18n("Cannot find clip to update effect"), ErrorMessage);
+}
+
+void CustomTrackView::moveEffect(int track, GenTime pos, QList <int> oldPos, QList <int> newPos)
{
if (pos < GenTime()) {
// Moving track effect
- QDomElement act = m_document->getTrackEffect(m_document->tracksCount() - track - 1, newPos - 1);
- QDomElement before = m_document->getTrackEffect(m_document->tracksCount() - track - 1, oldPos - 1);
-
- if (!act.isNull() && !before.isNull()) {
- m_document->setTrackEffect(m_document->tracksCount() - track - 1, oldPos - 1, act);
- m_document->setTrackEffect(m_document->tracksCount() - track - 1, newPos - 1, before);
- m_document->renderer()->mltMoveEffect(m_document->tracksCount() - track, pos, oldPos, newPos);
- emit showTrackEffects(m_document->tracksCount() - track, m_document->trackInfoAt(m_document->tracksCount() - track - 1));
- } else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
+ int documentTrack = m_document->tracksCount() - track - 1;
+ int max = m_document->getTrackEffects(documentTrack).count();
+ int new_position = newPos.at(0);
+ if (new_position > max) {
+ new_position = max;
+ }
+ int old_position = oldPos.at(0);
+ for (int i = 0; i < newPos.count(); i++) {
+ QDomElement act = m_document->getTrackEffect(documentTrack, new_position);
+ if (old_position > new_position) {
+ // Moving up, we need to adjust index
+ old_position = oldPos.at(i);
+ new_position = newPos.at(i);
+ }
+ QDomElement before = m_document->getTrackEffect(documentTrack, old_position);
+ if (!act.isNull() && !before.isNull()) {
+ m_document->setTrackEffect(documentTrack, new_position, before);
+ m_document->renderer()->mltMoveEffect(m_document->tracksCount() - track, pos, old_position, new_position);
+ } else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
+ }
+ emit showTrackEffects(m_document->tracksCount() - track, m_document->trackInfoAt(documentTrack));
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);
- QDomElement before = clip->effectAt(oldPos - 1);
- clip->setEffectAt(oldPos - 1, act);
- clip->setEffectAt(newPos - 1, before);
- // special case: speed effect, which is a pseudo-effect, not appearing in MLT's effects
- if (act.attribute("id") == "speed") {
- m_document->renderer()->mltUpdateEffectPosition(track, pos, oldPos, newPos);
- } else if (before.attribute("id") == "speed") {
- m_document->renderer()->mltUpdateEffectPosition(track, pos, newPos, oldPos);
- } else m_document->renderer()->mltMoveEffect(track, pos, oldPos, newPos);
- emit clipItemSelected(clip, newPos - 1);
+ if (clip) {
+ int new_position = newPos.at(0);
+ if (new_position > clip->effectsCount()) {
+ new_position = clip->effectsCount();
+ }
+ int old_position = oldPos.at(0);
+ for (int i = 0; i < newPos.count(); i++) {
+ QDomElement act = clip->effectAtIndex(new_position);
+ if (old_position > new_position) {
+ // Moving up, we need to adjust index
+ old_position = oldPos.at(i);
+ new_position = newPos.at(i);
+ }
+ QDomElement before = clip->effectAtIndex(old_position);
+ if (act.isNull() || before.isNull()) {
+ emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
+ return;
+ }
+ clip->moveEffect(before, new_position);
+ // special case: speed effect, which is a pseudo-effect, not appearing in MLT's effects
+ if (act.attribute("id") == "speed") {
+ m_document->renderer()->mltUpdateEffectPosition(track, pos, old_position, new_position);
+ } else if (before.attribute("id") == "speed") {
+ m_document->renderer()->mltUpdateEffectPosition(track, pos, new_position, old_position);
+ } else m_document->renderer()->mltMoveEffect(track, pos, old_position, new_position);
+ }
+ clip->setSelectedEffect(newPos.at(0));
+ emit clipItemSelected(clip);
setDocumentModified();
} else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
}
-void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable)
+void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, QList <int> effectIndexes, bool disable)
{
- EditEffectCommand *command;
- QDomElement effect;
- if (clip == NULL) effect = m_document->getTrackEffect(track - 1, effectPos);
- else effect = clip->effectAt(effectPos);
- QDomElement oldEffect = effect.cloneNode().toElement();
- effect.setAttribute("disable", (int) disable);
-
-
+ ChangeEffectStateCommand *command;
if (clip == NULL) {
// editing track effect
- command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldEffect, effect, effectPos, true);
+ command = new ChangeEffectStateCommand(this, m_document->tracksCount() - track, GenTime(-1), effectIndexes, disable, false, true);
} else {
- command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, true);
+ // Check if we have a speed effect, disabling / enabling it needs a special procedure since it is a pseudoo effect
+ QList <int> speedEffectIndexes;
+ for (int i = 0; i < effectIndexes.count(); i++) {
+ QDomElement effect = clip->effectAtIndex(effectIndexes.at(i));
+ if (effect.attribute("id") == "speed") {
+ // speed effect
+ speedEffectIndexes << effectIndexes.at(i);
+ QDomElement newEffect = effect.cloneNode().toElement();
+ newEffect.setAttribute("disable", (int) disable);
+ EditEffectCommand *editcommand = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, newEffect, effectIndexes.at(i), false, true);
+ m_commandStack->push(editcommand);
+ }
+ }
+ for (int j = 0; j < speedEffectIndexes.count(); j++) {
+ effectIndexes.removeAll(speedEffectIndexes.at(j));
+ }
+ command = new ChangeEffectStateCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effectIndexes, disable, false, true);
}
m_commandStack->push(command);
- setDocumentModified();;
+ setDocumentModified();
}
-void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int track, int currentPos, int newPos)
+void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int track, QList <int> currentPos, int newPos)
{
MoveEffectCommand *command;
if (clip == NULL) {
setDocumentModified();
}
-void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix)
+void CustomTrackView::slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix, bool refreshEffectStack)
{
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);
+ if (clip) command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, refreshEffectStack, true);
+ else command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldeffect, effect, ix, refreshEffectStack, true);
m_commandStack->push(command);
}
void CustomTrackView::slotUpdateClipRegion(ClipItem *clip, int ix, QString region)
{
- QDomElement effect = clip->getEffectAt(ix);
+ QDomElement effect = clip->getEffectAtIndex(ix);
QDomElement oldeffect = effect.cloneNode().toElement();
effect.setAttribute("region", region);
- EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldeffect, effect, ix, true, true);
m_commandStack->push(command);
}
return NULL;
}
- if (execute) m_document->renderer()->mltCutClip(m_document->tracksCount() - info.track, cutTime);
+ if (execute) {
+ if (!m_document->renderer()->mltCutClip(m_document->tracksCount() - info.track, cutTime)) {
+ // Error cuting clip in playlist
+ m_blockRefresh = false;
+ return NULL;
+ }
+ }
int cutPos = (int) cutTime.frames(m_document->fps());
ItemInfo newPos;
newPos.startPos = cutTime;
// fade in from 2nd part of the clip
int ix = dup->hasEffect(QString(), "fadein");
if (ix != -1) {
- QDomElement oldeffect = dup->effectAt(ix);
+ QDomElement oldeffect = dup->effectAtIndex(ix);
dup->deleteEffect(oldeffect.attribute("kdenlive_ix"));
}
ix = dup->hasEffect(QString(), "fade_from_black");
if (ix != -1) {
- QDomElement oldeffect = dup->effectAt(ix);
+ QDomElement oldeffect = dup->effectAtIndex(ix);
dup->deleteEffect(oldeffect.attribute("kdenlive_ix"));
}
// fade out from 1st part of the clip
ix = item->hasEffect(QString(), "fadeout");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAtIndex(ix);
item->deleteEffect(oldeffect.attribute("kdenlive_ix"));
}
ix = item->hasEffect(QString(), "fade_to_black");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAtIndex(ix);
item->deleteEffect(oldeffect.attribute("kdenlive_ix"));
}
// join fade effects again
int ix = dup->hasEffect(QString(), "fadeout");
if (ix != -1) {
- QDomElement effect = dup->effectAt(ix);
+ QDomElement effect = dup->effectAtIndex(ix);
item->addEffect(effect);
}
ix = dup->hasEffect(QString(), "fade_to_black");
if (ix != -1) {
- QDomElement effect = dup->effectAt(ix);
+ QDomElement effect = dup->effectAtIndex(ix);
item->addEffect(effect);
}
groupSelectedItems(true);
} else if (items.count() == 1) {
m_dragItem = static_cast <AbstractClipItem *>(items.at(0));
- emit clipItemSelected((ClipItem*)m_dragItem, -1, false);
+ emit clipItemSelected((ClipItem*)m_dragItem, false);
}
event->setDropAction(Qt::MoveAction);
event->accept();
void CustomTrackView::addTrack(TrackInfo type, int ix)
{
+ QList <TransitionInfo> transitionInfos;
if (ix == -1 || ix == m_document->tracksCount()) {
m_document->insertTrack(0, type);
- m_document->renderer()->mltInsertTrack(1, type.type == VIDEOTRACK);
+ transitionInfos = m_document->renderer()->mltInsertTrack(1, type.type == VIDEOTRACK);
} else {
m_document->insertTrack(m_document->tracksCount() - ix, type);
// insert track in MLT playlist
- m_document->renderer()->mltInsertTrack(m_document->tracksCount() - ix, type.type == VIDEOTRACK);
+ transitionInfos = m_document->renderer()->mltInsertTrack(m_document->tracksCount() - ix, type.type == VIDEOTRACK);
double startY = ix * m_tracksHeight + 1 + m_tracksHeight / 2;
QRectF r(0, startY, sceneRect().width(), sceneRect().height() - startY);
emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", clipinfo.startPos.frames(m_document->fps()), clipinfo.track), ErrorMessage);
}
}
- } else if (item->type() == TRANSITIONWIDGET) {
+ } /*else if (item->type() == TRANSITIONWIDGET) {
Transition *tr = static_cast <Transition *>(item);
int track = tr->transitionEndTrack();
if (track >= ix) {
tr->updateTransitionEndTrack(getPreviousVideoTrack(clipinfo.track));
}
- }
- }
+ }*/
+ }
+ // Sync transition tracks with MLT playlist
+ Transition *tr;
+ TransitionInfo info;
+ for (int i = 0; i < transitionInfos.count(); i++) {
+ info = transitionInfos.at(i);
+ tr = getTransitionItem(info);
+ if (tr) tr->setForcedTrack(info.forceTrack, info.a_track);
+ else kDebug()<<"// Cannot update TRANSITION AT: "<<info.b_track<<" / "<<info.startPos.frames(m_document->fps());
+ }
+
resetSelectionGroup(false);
m_document->renderer()->unlockService(tractor);
}
if (m_menuPosition.isNull()) {
pos = GenTime(cursorPos(), m_document->fps());
- TrackDialog d(m_document, parentWidget());
- d.comboTracks->setCurrentIndex(m_selectedTrack);
- d.label->setText(i18n("Track"));
- d.before_select->setHidden(true);
- d.setWindowTitle(i18n("Remove Space"));
- d.video_track->setHidden(true);
- d.audio_track->setHidden(true);
- if (d.exec() != QDialog::Accepted) return;
- track = d.comboTracks->currentIndex();
+ QPointer<TrackDialog> d = new TrackDialog(m_document, parentWidget());
+ d->comboTracks->setCurrentIndex(m_selectedTrack);
+ d->label->setText(i18n("Track"));
+ d->before_select->setHidden(true);
+ d->setWindowTitle(i18n("Remove Space"));
+ d->video_track->setHidden(true);
+ d->audio_track->setHidden(true);
+ if (d->exec() != QDialog::Accepted) {
+ delete d;
+ return;
+ }
+ track = d->comboTracks->currentIndex();
+ delete d;
} else {
pos = GenTime((int)(mapToScene(m_menuPosition).x()), m_document->fps());
track = (int)(mapToScene(m_menuPosition).y() / m_tracksHeight);
pos = GenTime((int)(mapToScene(m_menuPosition).x()), m_document->fps());
track = (int)(mapToScene(m_menuPosition).y() / m_tracksHeight) + 1;
}
- SpacerDialog d(GenTime(65, m_document->fps()), m_document->timecode(), track, m_document->tracksList(), this);
- if (d.exec() != QDialog::Accepted) return;
- GenTime spaceDuration = d.selectedDuration();
- track = d.selectedTrack();
+ QPointer<SpacerDialog> d = new SpacerDialog(GenTime(65, m_document->fps()),
+ m_document->timecode(), track, m_document->tracksList(), this);
+ if (d->exec() != QDialog::Accepted) {
+ delete d;
+ return;
+ }
+ GenTime spaceDuration = d->selectedDuration();
+ track = d->selectedTrack();
+ delete d;
QList<QGraphicsItem *> items;
if (track >= 0) {
}
}
+void CustomTrackView::seekCursorPos(int pos)
+{
+ m_document->renderer()->seek(pos);
+ emit updateRuler();
+}
+
+int CustomTrackView::seekPosition() const
+{
+ return m_document->renderer()->requestedSeekPosition;
+}
+
+
void CustomTrackView::setCursorPos(int pos, bool seek)
{
- if (pos == m_cursorPos) return;
- emit cursorMoved((int)(m_cursorPos), (int)(pos));
- m_cursorPos = pos;
- if (seek) m_document->renderer()->seek(m_cursorPos);
+ if (pos != m_cursorPos) {
+ emit cursorMoved((int)(m_cursorPos), (int)(pos));
+ m_cursorPos = pos;
+ m_cursorLine->setPos(m_cursorPos, 0);
+ }
else if (m_autoScroll) checkScrolling();
- m_cursorLine->setPos(m_cursorPos, 0);
}
void CustomTrackView::updateCursorPos()
void CustomTrackView::moveCursorPos(int delta)
{
- if (m_cursorPos + delta < 0) delta = 0 - m_cursorPos;
- emit cursorMoved((int)(m_cursorPos), (int)((m_cursorPos + delta)));
- m_cursorPos += delta;
- m_cursorLine->setPos(m_cursorPos, 0);
- m_document->renderer()->seek(m_cursorPos);
+ int currentPos = m_document->renderer()->requestedSeekPosition;
+ if (currentPos == SEEK_INACTIVE) currentPos = m_document->renderer()->seekFramePosition();
+ if (currentPos + delta < 0) delta = 0 - currentPos;
+ currentPos += delta;
+ m_document->renderer()->seek(currentPos);
+ emit updateRuler();
}
void CustomTrackView::initCursorPos(int pos)
KdenliveSettings::setSnaptopoints(false);
item->setPos((int) m_dragItemInfo.startPos.frames(m_document->fps()), (int)(m_dragItemInfo.track * m_tracksHeight + 1));
KdenliveSettings::setSnaptopoints(snap);
- emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(m_dragItemInfo.startPos.frames(m_document->fps()))), ErrorMessage);
+ emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(info.startPos.frames(m_document->fps()))), ErrorMessage);
}
setDocumentModified();
} else if (m_dragItem->type() == TRANSITIONWIDGET && (m_dragItemInfo.startPos != info.startPos || m_dragItemInfo.track != info.track)) {
adjustTimelineClips(m_scene->editMode(), clip, ItemInfo(), moveGroup);
m_document->renderer()->mltInsertClip(info, clip->xml(), clip->getProducer(trackProducer), m_scene->editMode() == OVERWRITEEDIT, m_scene->editMode() == INSERTEDIT);
for (int i = 0; i < clip->effectsCount(); i++) {
- m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(clip->effectAt(i)), false);
+ m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(clip->effect(i)), false);
}
} else {
Transition *tr = static_cast <Transition*>(item);
int ix = item->hasEffect("volume", "fadein");
int ix2 = item->hasEffect("", "fade_from_black");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAtIndex(ix);
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
slotUpdateClipEffect(item, -1, effect, oldeffect, ix);
- emit clipItemSelected(item, ix);
+ emit clipItemSelected(item);
}
} else if (item->fadeIn() != 0 && ix2 == -1) {
QDomElement effect;
slotAddEffect(effect, m_dragItem->startPos(), m_dragItem->track());
}
if (ix2 != -1) {
- QDomElement oldeffect = item->effectAt(ix2);
+ QDomElement oldeffect = item->effectAtIndex(ix2);
int start = item->cropStart().frames(m_document->fps());
int end = item->fadeIn();
if (end == 0) {
EffectsList::setParameter(oldeffect, "in", QString::number(start));
EffectsList::setParameter(oldeffect, "out", QString::number(end));
slotUpdateClipEffect(item, -1, effect, oldeffect, ix2);
- emit clipItemSelected(item, ix2);
+ emit clipItemSelected(item);
}
}
} else if (m_operationMode == FADEOUT) {
- // resize fade in effect
+ // resize fade out effect
ClipItem * item = static_cast <ClipItem *>(m_dragItem);
int ix = item->hasEffect("volume", "fadeout");
int ix2 = item->hasEffect("", "fade_to_black");
if (ix != -1) {
- QDomElement oldeffect = item->effectAt(ix);
+ QDomElement oldeffect = item->effectAtIndex(ix);
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
EffectsList::setParameter(oldeffect, "out", QString::number(end));
// kDebug()<<"EDIT FADE OUT : "<<start<<"x"<<end;
slotUpdateClipEffect(item, -1, effect, oldeffect, ix);
- emit clipItemSelected(item, ix);
+ emit clipItemSelected(item);
}
} else if (item->fadeOut() != 0 && ix2 == -1) {
QDomElement effect;
// add video fade
effect = MainWindow::videoEffects.getEffectByTag("", "fade_to_black").cloneNode().toElement();
} else effect = MainWindow::audioEffects.getEffectByTag("volume", "fadeout").cloneNode().toElement();
- EffectsList::setParameter(effect, "in", QString::number(item->fadeOut()));
- EffectsList::setParameter(effect, "out", QString::number(0));
+ int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
+ int start = end-item->fadeOut();
+ EffectsList::setParameter(effect, "in", QString::number(start));
+ EffectsList::setParameter(effect, "out", QString::number(end));
slotAddEffect(effect, m_dragItem->startPos(), m_dragItem->track());
}
if (ix2 != -1) {
- QDomElement oldeffect = item->effectAt(ix2);
+ QDomElement oldeffect = item->effectAtIndex(ix2);
int end = (item->cropDuration() + item->cropStart()).frames(m_document->fps());
int start = item->fadeOut();
if (start == 0) {
EffectsList::setParameter(oldeffect, "out", QString::number(end));
// kDebug()<<"EDIT FADE OUT : "<<start<<"x"<<end;
slotUpdateClipEffect(item, -1, effect, oldeffect, ix2);
- emit clipItemSelected(item, ix2);
+ emit clipItemSelected(item);
}
}
} else if (m_operationMode == KEYFRAME) {
if ((val < -50 || val > 150) && item->editedKeyFramePos() != start && item->editedKeyFramePos() != end && item->keyFrameNumber() > 1) {
//delete keyframe
- item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), -1, 0);
+ item->movedKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), item->selectedKeyFramePos(), -1, 0);
} else {
- item->movedKeyframe(item->getEffectAt(item->selectedEffectIndex()), item->selectedKeyFramePos(), item->editedKeyFramePos(), item->editedKeyFrameValue());
+ item->movedKeyframe(item->getEffectAtIndex(item->selectedEffectIndex()), item->selectedKeyFramePos(), item->editedKeyFramePos(), item->editedKeyFrameValue());
}
QDomElement newEffect = item->selectedEffect().cloneNode().toElement();
//item->updateKeyframeEffect();
//QString next = item->keyframes(item->selectedEffectIndex());
//EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
- EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
m_commandStack->push(command);
- updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
- emit clipItemSelected(item, item->selectedEffectIndex());
+ updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
+ emit clipItemSelected(item);
}
if (m_dragItem && m_dragItem->type() == TRANSITIONWIDGET && m_dragItem->isSelected()) {
// A transition is selected
info.track = m_document->tracksCount() - info.track;
m_document->renderer()->mltInsertClip(info, xml, item->getProducer(producerTrack), overwrite, push);
for (int i = 0; i < item->effectsCount(); i++) {
- m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(item->effectAt(i)), false);
+ m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(item->effect(i)), false);
}
setDocumentModified();
if (refresh)
return getClipItemAt((int) pos.frames(m_document->fps()), track);
}
+
+Transition *CustomTrackView::getTransitionItem(TransitionInfo info)
+{
+ int pos = info.startPos.frames(m_document->fps());
+ int track = m_document->tracksCount() - info.b_track;
+ return getTransitionItemAt(pos, track);
+}
+
Transition *CustomTrackView::getTransitionItemAt(int pos, int track)
{
const QPointF p(pos, track * m_tracksHeight + Transition::itemOffset() + 1);
info.track = m_document->tracksCount() - info.track;
m_document->renderer()->mltInsertClip(info, clip->xml(), clip->getProducer(trackProducer));
for (int i = 0; i < clip->effectsCount(); i++) {
- m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(clip->effectAt(i)), false);
+ m_document->renderer()->mltAddEffect(info.track, info.startPos, getEffectArgs(clip->effect(i)), false);
}
} else if (item->type() == TRANSITIONWIDGET) {
Transition *tr = static_cast <Transition*>(item);
kDebug() << "// RESIZE CROP, DIFF: " << (end.cropStart - start.cropStart).frames(25);
ItemInfo clipinfo = end;
clipinfo.track = m_document->tracksCount() - end.track;
- bool success = m_document->renderer()->mltResizeClipCrop(clipinfo, end.cropStart - start.cropStart);
+ bool success = m_document->renderer()->mltResizeClipCrop(clipinfo, end.cropStart);
if (success) {
item->setCropStart(end.cropStart);
item->resetThumbs(true);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
adjustEffects(clip, oldInfo, command);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
- emit clipItemSelected(clip);
} else {
KdenliveSettings::setSnaptopoints(false);
item->resizeStart((int) oldInfo.startPos.frames(m_document->fps()));
new ResizeClipCommand(this, oldInfo, info, false, true, command);
adjustEffects(clip, oldInfo, command);
new ResizeClipCommand(this, oldInfo, info, false, true, command);
- emit clipItemSelected(clip);
} else {
KdenliveSettings::setSnaptopoints(false);
item->resizeEnd((int) oldInfo.endPos.frames(m_document->fps()));
// there is a fade in effect
int effectPos = item->hasEffect("volume", "fadein");
if (effectPos != -1) {
- QDomElement effect = item->getEffectAt(effectPos);
+ QDomElement effect = item->getEffectAtIndex(effectPos);
int start = item->cropStart().frames(m_document->fps());
int max = item->cropDuration().frames(m_document->fps());
if (end > max) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
// if fade effect is displayed, update the effect edit widget with new clip duration
if (item->isSelected() && effectPos == item->selectedEffectIndex())
- emit clipItemSelected(item, effectPos);
+ emit clipItemSelected(item);
}
}
effectPos = item->hasEffect("brightness", "fade_from_black");
if (effectPos != -1) {
- QDomElement effect = item->getEffectAt(effectPos);
+ QDomElement effect = item->getEffectAtIndex(effectPos);
int start = item->cropStart().frames(m_document->fps());
int max = item->cropDuration().frames(m_document->fps());
if (end > max) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
// if fade effect is displayed, update the effect edit widget with new clip duration
if (item->isSelected() && effectPos == item->selectedEffectIndex())
- emit clipItemSelected(item, effectPos);
+ emit clipItemSelected(item);
}
}
}
// there is a fade out effect
int effectPos = item->hasEffect("volume", "fadeout");
if (effectPos != -1) {
- QDomElement effect = item->getEffectAt(effectPos);
+ QDomElement effect = item->getEffectAtIndex(effectPos);
int max = item->cropDuration().frames(m_document->fps());
int end = max + item->cropStart().frames(m_document->fps());
if (start > max) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
// if fade effect is displayed, update the effect edit widget with new clip duration
if (item->isSelected() && effectPos == item->selectedEffectIndex())
- emit clipItemSelected(item, effectPos);
+ emit clipItemSelected(item);
}
}
effectPos = item->hasEffect("brightness", "fade_to_black");
if (effectPos != -1) {
- QDomElement effect = item->getEffectAt(effectPos);
+ QDomElement effect = item->getEffectAtIndex(effectPos);
int max = item->cropDuration().frames(m_document->fps());
int end = max + item->cropStart().frames(m_document->fps());
if (start > max) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
// if fade effect is displayed, update the effect edit widget with new clip duration
if (item->isSelected() && effectPos == item->selectedEffectIndex())
- emit clipItemSelected(item, effectPos);
+ emit clipItemSelected(item);
}
}
}
if (effectPos != -1) {
// Freeze effect needs to be adjusted with clip resize
int diff = (info.startPos - item->startPos()).frames(m_document->fps());
- QDomElement eff = item->getEffectAt(effectPos);
+ QDomElement eff = item->getEffectAtIndex(effectPos);
if (!eff.isNull() && diff != 0) {
int freeze_pos = EffectsList::parameter(eff, "frame").toInt() + diff;
EffectsList::setParameter(eff, "frame", QString::number(freeze_pos));
if (standalone) {
if (item->isSelected() && item->selectedEffect().attribute("id") == "freeze") {
- emit clipItemSelected(item, item->selectedEffectIndex());
+ emit clipItemSelected(item);
}
}
}
{
updateSnapPoints(NULL);
GenTime res = m_scene->previousSnapPoint(GenTime(m_cursorPos, m_document->fps()));
- setCursorPos((int) res.frames(m_document->fps()));
+ seekCursorPos((int) res.frames(m_document->fps()));
checkScrolling();
}
{
updateSnapPoints(NULL);
GenTime res = m_scene->nextSnapPoint(GenTime(m_cursorPos, m_document->fps()));
- setCursorPos((int) res.frames(m_document->fps()));
+ seekCursorPos((int) res.frames(m_document->fps()));
checkScrolling();
}
{
AbstractClipItem *item = getMainActiveClip();
if (item != NULL) {
- setCursorPos((int) item->startPos().frames(m_document->fps()));
+ seekCursorPos((int) item->startPos().frames(m_document->fps()));
checkScrolling();
}
}
{
AbstractClipItem *item = getMainActiveClip();
if (item != NULL) {
- setCursorPos((int) item->endPos().frames(m_document->fps()) - 1);
+ seekCursorPos((int) item->endPos().frames(m_document->fps()) - 1);
checkScrolling();
}
}
goMenu->clear();
double fps = m_document->fps();
for (int i = 0; i < m_guides.count(); i++) {
- act = goMenu->addAction(m_guides.at(i)->label() + "/" + Timecode::getStringTimecode(m_guides.at(i)->position().frames(fps), fps));
+ act = goMenu->addAction(m_guides.at(i)->label() + '/' + Timecode::getStringTimecode(m_guides.at(i)->position().frames(fps), fps));
act->setData(m_guides.at(i)->position().frames(m_document->fps()));
}
goMenu->setEnabled(!m_guides.isEmpty());
{
CommentedTime marker(GenTime(m_cursorPos, m_document->fps()), i18n("Guide"));
if (dialog) {
- MarkerDialog d(NULL, marker, m_document->timecode(), i18n("Add Guide"), this);
- if (d.exec() != QDialog::Accepted) return;
- marker = d.newMarker();
-
+ QPointer<MarkerDialog> d = new MarkerDialog(NULL, marker,
+ m_document->timecode(), i18n("Add Guide"), this);
+ if (d->exec() != QDialog::Accepted) {
+ delete d;
+ return;
+ }
+ marker = d->newMarker();
+ delete d;
} else {
marker.setComment(m_document->timecode().getDisplayTimecodeFromFrames(m_cursorPos, false));
}
void CustomTrackView::slotEditGuide(CommentedTime guide)
{
- MarkerDialog d(NULL, guide, m_document->timecode(), i18n("Edit Guide"), this);
- if (d.exec() == QDialog::Accepted) {
- EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d.newMarker().time(), d.newMarker().comment(), true);
+ QPointer<MarkerDialog> d = new MarkerDialog(NULL, guide, m_document->timecode(), i18n("Edit Guide"), this);
+ if (d->exec() == QDialog::Accepted) {
+ EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d->newMarker().time(), d->newMarker().comment(), true);
m_commandStack->push(command);
}
+ delete d;
}
{
if (m_dragGuide == NULL) return;
CommentedTime guide = m_dragGuide->info();
- MarkerDialog d(NULL, guide, m_document->timecode(), i18n("Edit Guide"), this);
- if (d.exec() == QDialog::Accepted) {
- EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d.newMarker().time(), d.newMarker().comment(), true);
+ QPointer<MarkerDialog> d = new MarkerDialog(NULL, guide,
+ m_document->timecode(), i18n("Edit Guide"), this);
+ if (d->exec() == QDialog::Accepted) {
+ EditGuideCommand *command = new EditGuideCommand(this, guide.time(), guide.comment(), d->newMarker().time(), d->newMarker().comment(), true);
m_commandStack->push(command);
}
+ delete d;
}
void CustomTrackView::slotDeleteGuide(int guidePos)
for (int i = 0; i < m_searchPoints.size(); ++i) {
marker = m_searchPoints.at(i).comment();
if (marker.contains(text, Qt::CaseInsensitive)) {
- setCursorPos(m_searchPoints.at(i).time().frames(m_document->fps()), true);
+ seekCursorPos(m_searchPoints.at(i).time().frames(m_document->fps()));
int vert = verticalScrollBar()->value();
int hor = cursorPos();
ensureVisible(hor, vert + 10, 2, 2, 50, 0);
void CustomTrackView::selectFound(QString track, QString pos)
{
- setCursorPos(m_document->timecode().getFrameCount(pos), true);
+ seekCursorPos(m_document->timecode().getFrameCount(pos));
slotSelectTrack(track.toInt());
selectClip(true);
int vert = verticalScrollBar()->value();
for (int i = m_findIndex + 1; i < m_searchPoints.size(); ++i) {
marker = m_searchPoints.at(i).comment();
if (marker.contains(text, Qt::CaseInsensitive)) {
- setCursorPos(m_searchPoints.at(i).time().frames(m_document->fps()), true);
+ seekCursorPos(m_searchPoints.at(i).time().frames(m_document->fps()));
int vert = verticalScrollBar()->value();
int hor = cursorPos();
ensureVisible(hor, vert + 10, 2, 2, 50, 0);
if (clips.at(i)->type() == AVWIDGET) {
ClipItem *item = static_cast < ClipItem *>(clips.at(i));
for (int j = 0; j < clip->effectsCount(); j++) {
- QDomElement eff = clip->effectAt(j);
+ QDomElement eff = clip->effect(j);
if (eff.attribute("unique", "0") == "0" || item->hasEffect(eff.attribute("tag"), eff.attribute("id")) == -1) {
adjustKeyfames(clip->cropStart(), item->cropStart(), item->cropDuration(), eff);
new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), eff, true, paste);
if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe")) {
QString def = e.attribute("default");
// Effect has a keyframe type parameter, we need to adjust the values
- QStringList keys = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
+ QStringList keys = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
QStringList newKeyFrames;
foreach(const QString &str, keys) {
int pos = str.section(':', 0, 0).toInt();
void CustomTrackView::slotInsertTrack(int ix)
{
- TrackDialog d(m_document, parentWidget());
- d.comboTracks->setCurrentIndex(ix);
- d.label->setText(i18n("Insert track"));
- d.setWindowTitle(i18n("Insert New Track"));
+ QPointer<TrackDialog> d = new TrackDialog(m_document, parentWidget());
+ d->comboTracks->setCurrentIndex(ix);
+ d->label->setText(i18n("Insert track"));
+ d->setWindowTitle(i18n("Insert New Track"));
- if (d.exec() == QDialog::Accepted) {
- ix = d.comboTracks->currentIndex();
- if (d.before_select->currentIndex() == 1)
+ if (d->exec() == QDialog::Accepted) {
+ ix = d->comboTracks->currentIndex();
+ if (d->before_select->currentIndex() == 1)
ix++;
TrackInfo info;
info.duration = 0;
info.isMute = false;
info.isLocked = false;
- if (d.video_track->isChecked()) {
+ info.effectsList = EffectsList(true);
+ if (d->video_track->isChecked()) {
info.type = VIDEOTRACK;
info.isBlind = false;
} else {
m_commandStack->push(addTrack);
setDocumentModified();
}
+ delete d;
}
void CustomTrackView::slotDeleteTrack(int ix)
{
if (m_document->tracksCount() < 2) return;
- TrackDialog d(m_document, parentWidget());
- d.comboTracks->setCurrentIndex(ix);
- d.label->setText(i18n("Delete track"));
- d.before_select->setHidden(true);
- d.setWindowTitle(i18n("Delete Track"));
- d.video_track->setHidden(true);
- d.audio_track->setHidden(true);
- if (d.exec() == QDialog::Accepted) {
- ix = d.comboTracks->currentIndex();
+ QPointer<TrackDialog> d = new TrackDialog(m_document, parentWidget());
+ d->comboTracks->setCurrentIndex(ix);
+ d->label->setText(i18n("Delete track"));
+ d->before_select->setHidden(true);
+ d->setWindowTitle(i18n("Delete Track"));
+ d->video_track->setHidden(true);
+ d->audio_track->setHidden(true);
+ if (d->exec() == QDialog::Accepted) {
+ ix = d->comboTracks->currentIndex();
TrackInfo info = m_document->trackInfoAt(m_document->tracksCount() - ix - 1);
deleteTimelineTrack(ix, info);
setDocumentModified();
/*AddTrackCommand* command = new AddTrackCommand(this, ix, info, false);
m_commandStack->push(command);*/
}
+ delete d;
}
void CustomTrackView::slotConfigTracks(int ix)
{
- TracksConfigDialog d(m_document, ix, parentWidget());
- if (d.exec() == QDialog::Accepted) {
- ConfigTracksCommand *configTracks = new ConfigTracksCommand(this, m_document->tracksList(), d.tracksList());
+ QPointer<TracksConfigDialog> d = new TracksConfigDialog(m_document,
+ ix, parentWidget());
+ if (d->exec() == QDialog::Accepted) {
+ ConfigTracksCommand *configTracks = new ConfigTracksCommand(this, m_document->tracksList(), d->tracksList());
m_commandStack->push(configTracks);
- QList <int> toDelete = d.deletedTracks();
+ QList <int> toDelete = d->deletedTracks();
for (int i = 0; i < toDelete.count(); ++i) {
TrackInfo info = m_document->trackInfoAt(m_document->tracksCount() - toDelete.at(i) + i - 1);
deleteTimelineTrack(toDelete.at(i) - i, info);
}
setDocumentModified();
}
+ delete d;
}
void CustomTrackView::deleteTimelineTrack(int ix, TrackInfo trackinfo)
AudioEnvelope *envelope = new AudioEnvelope(clip->getProducer(clip->track()));
m_audioCorrelator = new AudioCorrelation(envelope);
+
+#ifdef DEBUG
envelope->drawEnvelope().save("kdenlive-audio-reference-envelope.png");
envelope->dumpInfo();
+#endif
+
emit displayMessage(i18n("Audio align reference set."), InformationMessage);
}
int shift = m_audioCorrelator->getShift(index);
counter++;
+
+#ifdef DEBUG
m_audioCorrelator->info(index)->toImage().save("kdenlive-audio-align-cross-correlation.png");
envelope->drawEnvelope().save("kdenlive-audio-align-envelope.png");
envelope->dumpInfo();
-#ifdef DEBUG
int targetPos = m_audioAlignmentReference->startPos().frames(m_document->fps()) + shift;
qDebug() << "Reference starts at " << m_audioAlignmentReference->startPos().frames(m_document->fps());
qDebug() << "We will start at " << targetPos;
if (counter == 0) {
emit displayMessage(i18n("No audio clips selected."), ErrorMessage);
} else {
- emit displayMessage(i18n("Auto-aligned %1 clips.").arg(counter), InformationMessage);
+ emit displayMessage(i18n("Auto-aligned %1 clips.", counter), InformationMessage);
}
}
int audioIx = 0;
for (int i = 0; i < effects.count(); ++i) {
if (effects.at(i).attribute("type") == "audio") {
- deleteEffect(m_document->tracksCount() - track, pos, clip->effectAt(videoIx));
+ deleteEffect(m_document->tracksCount() - track, pos, clip->effect(videoIx));
audioIx++;
} else {
- deleteEffect(freetrack, pos, audioClip->effectAt(audioIx));
+ deleteEffect(freetrack, pos, audioClip->effect(audioIx));
videoIx++;
}
}
void CustomTrackView::slotGoToMarker(QAction *action)
{
int pos = action->data().toInt();
- setCursorPos(pos, true);
+ seekCursorPos(pos);
}
void CustomTrackView::reloadTransitionLumas()
splitAudio();
}
-void CustomTrackView::clearSelection()
+void CustomTrackView::clearSelection(bool emitInfo)
{
resetSelectionGroup();
scene()->clearSelection();
m_dragItem = NULL;
- emit clipItemSelected(NULL);
+ if (emitInfo) emit clipItemSelected(NULL);
}
void CustomTrackView::updatePalette()
pen1.setColor(palette().text().color());
m_cursorLine->setPen(pen1);
}
- emit tracksChanged();
}
void CustomTrackView::removeTipAnimation()
void CustomTrackView::slotAddTrackEffect(const QDomElement &effect, int ix)
{
- AddEffectCommand *command = new AddEffectCommand(this, m_document->tracksCount() - ix, GenTime(-1), effect, true);
- m_commandStack->push(command);
- setDocumentModified();
+
+ QUndoCommand *effectCommand = new QUndoCommand();
+ QString effectName;
+ if (effect.tagName() == "effectgroup") {
+ effectName = effect.attribute("name");
+ } else {
+ QDomElement namenode = effect.firstChildElement("name");
+ if (!namenode.isNull()) effectName = i18n(namenode.text().toUtf8().data());
+ else effectName = i18n("effect");
+ }
+ effectCommand->setText(i18n("Add %1", effectName));
+ if (effect.tagName() == "effectgroup") {
+ QDomNodeList effectlist = effect.elementsByTagName("effect");
+ for (int j = 0; j < effectlist.count(); j++) {
+ QDomElement trackeffect = effectlist.at(j).toElement();
+ if (trackeffect.attribute("unique", "0") != "0" && m_document->hasTrackEffect(m_document->tracksCount() - ix - 1, trackeffect.attribute("tag"), trackeffect.attribute("id")) != -1) {
+ emit displayMessage(i18n("Effect already present in track"), ErrorMessage);
+ continue;
+ }
+ new AddEffectCommand(this, m_document->tracksCount() - ix, GenTime(-1), trackeffect, true, effectCommand);
+ }
+ }
+ else {
+ if (effect.attribute("unique", "0") != "0" && m_document->hasTrackEffect(m_document->tracksCount() - ix - 1, effect.attribute("tag"), effect.attribute("id")) != -1) {
+ emit displayMessage(i18n("Effect already present in track"), ErrorMessage);
+ delete effectCommand;
+ return;
+ }
+ new AddEffectCommand(this, m_document->tracksCount() - ix, GenTime(-1), effect, true, effectCommand);
+ }
+
+ if (effectCommand->childCount() > 0) {
+ m_commandStack->push(effectCommand);
+ setDocumentModified();
+ }
+ else delete effectCommand;
}
EffectsParameterList parameters;
QLocale locale;
parameters.addParam("tag", effect.attribute("tag"));
- if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region"));
+ //if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region"));
parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
+ parameters.addParam("kdenlive_info", effect.attribute("kdenlive_info"));
parameters.addParam("id", effect.attribute("id"));
if (effect.hasAttribute("src")) parameters.addParam("src", effect.attribute("src"));
if (effect.hasAttribute("disable")) parameters.addParam("disable", effect.attribute("disable"));
if (effect.hasAttribute("in")) parameters.addParam("in", effect.attribute("in"));
if (effect.hasAttribute("out")) parameters.addParam("out", effect.attribute("out"));
+ if (effect.attribute("id") == "region") {
+ QDomNodeList subeffects = effect.elementsByTagName("effect");
+ for (int i = 0; i < subeffects.count(); i++) {
+ QDomElement subeffect = subeffects.at(i).toElement();
+ int subeffectix = subeffect.attribute("region_ix").toInt();
+ parameters.addParam(QString("filter%1").arg(subeffectix), subeffect.attribute("id"));
+ parameters.addParam(QString("filter%1.tag").arg(subeffectix), subeffect.attribute("tag"));
+ parameters.addParam(QString("filter%1.kdenlive_info").arg(subeffectix), subeffect.attribute("kdenlive_info"));
+ QDomNodeList subparams = subeffect.elementsByTagName("parameter");
+ adjustEffectParameters(parameters, subparams, QString("filter%1.").arg(subeffectix));
+ }
+ }
QDomNodeList params = effect.elementsByTagName("parameter");
- for (int i = 0; i < params.count(); i++) {
+ adjustEffectParameters(parameters, params);
+
+ return parameters;
+}
+
+
+void CustomTrackView::adjustEffectParameters(EffectsParameterList ¶meters, QDomNodeList params, const QString &prefix)
+{
+ QLocale locale;
+ for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
+ QString paramname = prefix + e.attribute("name");
if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) {
// effects with geometry param need in / out synced with the clip, request it...
parameters.addParam("_sync_in_out", "1");
}
if (e.attribute("type") == "simplekeyframe") {
-
- QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
+ QStringList values = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
double factor = e.attribute("factor", "1").toDouble();
double offset = e.attribute("offset", "0").toDouble();
for (int j = 0; j < values.count(); j++) {
QString pos = values.at(j).section(':', 0, 0);
double val = (values.at(j).section(':', 1, 1).toDouble() - offset) / factor;
- values[j] = pos + "=" + locale.toString(val);
+ values[j] = pos + '=' + locale.toString(val);
}
// kDebug() << "/ / / /SENDING KEYFR:" << values;
- parameters.addParam(e.attribute("name"), values.join(";"));
+ parameters.addParam(paramname, values.join(";"));
/*parameters.addParam(e.attribute("name"), e.attribute("keyframes").replace(":", "="));
parameters.addParam("max", e.attribute("max"));
parameters.addParam("min", e.attribute("min"));
fact = e.attribute("factor", "1").toDouble();
}
double offset = e.attribute("offset", "0").toDouble();
- parameters.addParam(e.attribute("name"), locale.toString((e.attribute("value").toDouble() - offset) / fact));
+ parameters.addParam(paramname, locale.toString((e.attribute("value").toDouble() - offset) / fact));
} else {
- parameters.addParam(e.attribute("name"), e.attribute("value"));
+ parameters.addParam(paramname, e.attribute("value"));
}
}
}
- return parameters;
}
+
void CustomTrackView::updateTrackNames(int track, bool added)
{
QList <TrackInfo> tracks = m_document->tracksList();
if (effects.count()) {
QMap<int, QDomElement>::const_iterator i = effects.constBegin();
while (i != effects.constEnd()) {
- new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), i.value(), item->effectAt(i.key()), i.key(), false, command);
+ new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), i.value(), item->effect(i.key()), i.value().attribute("kdenlive_ix").toInt(), true, true, command);
++i;
}
}
return;
}
QDomElement newEffect;
- QDomElement effect = clip->getEffectAt(clip->selectedEffectIndex());
+ QDomElement effect = clip->getEffectAtIndex(clip->selectedEffectIndex());
if (effect.attribute("id") == filter) {
newEffect = effect.cloneNode().toElement();
QMap<QString, QString>::const_iterator i = filterParams.constBegin();
kDebug()<<"// RESULT FILTER: "<<i.key()<<"="<< i.value();
++i;
}
- EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, newEffect, clip->selectedEffectIndex(), true);
+ EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, newEffect, clip->selectedEffectIndex(), true, true);
m_commandStack->push(command);
- emit clipItemSelected(clip, clip->selectedEffectIndex());
+ emit clipItemSelected(clip);
}
}