// special cases (middle click button or ctrl / shift click
if (event->button() == Qt::MidButton) {
- m_document->renderer()->switchPlay();
+ emit playMonitor();
m_blockRefresh = false;
m_operationMode = NONE;
return;
return;
} else if (m_operationMode == MOVE) {
setCursor(Qt::ClosedHandCursor);
- if (m_dragItem) m_dragItem->setZValue(10);
- if (m_selectionGroup) m_selectionGroup->setZValue(10);
} else if (m_operationMode == TRANSITIONSTART && event->modifiers() != Qt::ControlModifier) {
ItemInfo info;
info.startPos = m_dragItem->startPos();
updateSnapPoints(NULL, offsetList);
m_selectionGroup->setPos(framePos);
scene()->addItem(m_selectionGroup);
- m_selectionGroup->setZValue(10);
+ //m_selectionGroup->setZValue(10);
return true;
} else if (data->hasFormat("kdenlive/producerslist")) {
m_clipDrag = true;
start += info.cropDuration;
offsetList.append(start);
ClipItem *item = new ClipItem(clip, info, m_document->fps(), 1.0, 1, false);
- item->setZValue(10);
+ //item->setZValue(10);
item->setFlag(QGraphicsItem::ItemIsMovable, false);
m_selectionGroup->addToGroup(item);
m_waitingThumbs.append(item);
updateSnapPoints(NULL, offsetList);
m_selectionGroup->setPos(framePos);
scene()->addItem(m_selectionGroup);
- m_selectionGroup->setZValue(10);
+ //m_selectionGroup->setZValue(10);
m_thumbsTimer.start();
return true;
ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
if (!item || cutTime >= item->endPos() || cutTime <= item->startPos()) {
emit displayMessage(i18n("Cannot find clip to cut"), ErrorMessage);
- kDebug() << "///////// ERROR CUTTING CLIP : (" << item->startPos().frames(25) << "-" << item->endPos().frames(25) << "), INFO: (" << info.startPos.frames(25) << "-" << info.endPos.frames(25) << ")" << ", CUT: " << cutTime.frames(25);
+ if (item) kDebug() << "///////// ERROR CUTTING CLIP : (" << item->startPos().frames(25) << "-" << item->endPos().frames(25) << "), INFO: (" << info.startPos.frames(25) << "-" << info.endPos.frames(25) << ")" << ", CUT: " << cutTime.frames(25);
+ else kDebug() << "/// ERROR NO CLIP at: " << info.startPos.frames(m_document->fps()) << ", track: " << info.track;
m_blockRefresh = false;
return NULL;
}
//TODO: take care of edit mode for undo
item->baseClip()->addReference();
- item->setZValue(item->defaultZValue());
+ //item->setZValue(item->defaultZValue());
m_document->updateClip(item->baseClip()->getId());
ItemInfo info = item->info();
new ResizeClipCommand(this, clip->info(), newclipInfo, false, false, command);
clip->resizeEnd(info.startPos.frames(m_document->fps()));
}
- } else if (clip->endPos() < info.endPos) {
+ } else if (clip->endPos() <= info.endPos) {
new AddTimelineClipCommand(this, clip->xml(), clip->clipProducer(), clip->info(), clip->effectList(), false, false, false, true, command);
scene()->removeItem(clip);
delete clip;
void CustomTrackView::addTrack(TrackInfo type, int ix)
{
if (ix == -1 || ix == m_document->tracksCount()) {
- m_document->insertTrack(ix, type);
+ m_document->insertTrack(0, type);
m_document->renderer()->mltInsertTrack(1, type.type == VIDEOTRACK);
} else {
m_document->insertTrack(m_document->tracksCount() - ix, type);
ItemInfo clipinfo = item->info();
if (item->type() == AVWIDGET) {
ClipItem *clip = static_cast <ClipItem *>(item);
+ // slowmotion clips are not track dependant, so no need to update them
+ if (clip->speed() != 1.0) continue;
// We add a move clip command so that we get the correct producer for new track number
if (clip->clipType() == AV || clip->clipType() == AUDIO) {
Mlt::Producer *prod;
if (m_operationMode == MOVE) {
setCursor(Qt::OpenHandCursor);
- if (m_dragItem) m_dragItem->setZValue(m_dragItem->defaultZValue());
- if (m_selectionGroup) m_selectionGroup->setZValue(1);
if (m_dragItem->parentItem() == 0) {
// we are moving one clip, easy
if (m_dragItem->type() == AVWIDGET && (m_dragItemInfo.startPos != info.startPos || m_dragItemInfo.track != info.track)) {
for (int j = 0; j < clip->effectsCount(); j++) {
QDomElement eff = clip->effectAt(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);
}
}
}
+void CustomTrackView::adjustKeyfames(GenTime oldstart, GenTime newstart, GenTime duration, QDomElement xml)
+{
+ // parse parameters to check if we need to adjust to the new crop start
+ int diff = (newstart - oldstart).frames(m_document->fps());
+ int max = (newstart + duration).frames(m_document->fps());
+ QDomNodeList params = xml.elementsByTagName("parameter");
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ 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 newKeyFrames;
+ foreach(const QString &str, keys) {
+ int pos = str.section(':', 0, 0).toInt();
+ double val = str.section(':', 1, 1).toDouble();
+ pos += diff;
+ if (pos > max) {
+ newKeyFrames.append(QString::number(max) + ':' + QString::number(val));
+ break;
+ } else newKeyFrames.append(QString::number(pos) + ':' + QString::number(val));
+ }
+ //kDebug()<<"ORIGIN: "<<keys<<", FIXED: "<<newKeyFrames;
+ e.setAttribute("keyframes", newKeyFrames.join(";"));
+ }
+ }
+}
+
ClipItem *CustomTrackView::getClipUnderCursor() const
{
QRectF rect((double) m_cursorPos, 0.0, 1.0, (double)(m_tracksHeight * m_document->tracksCount()));
void CustomTrackView::slotUpdateAllThumbs()
{
+ if (!isEnabled()) return;
QList<QGraphicsItem *> itemList = items();
//if (itemList.isEmpty()) return;
ClipItem *item;