newPos.track = info.track;
ClipItem *dup = new ClipItem(item->baseClip(), newPos, m_scale, m_document->fps());
dup->setCropStart(dup->cropStart() + (cutTime - info.startPos));
- item->resizeEnd(cutPos - 1, m_scale);
+ item->resizeEnd(cutPos, m_scale);
scene()->addItem(dup);
m_document->renderer()->mltCutClip(m_tracksList.count() - info.track, cutTime);
} else {
event->setDropAction(Qt::IgnoreAction);
kDebug() << "+++++++++++++ DRAG MOVE, : " << mapToScene(event->pos()).x() << ", SCAL: " << m_scale;
if (m_dropItem) {
- int track = (int)(event->pos().y() / m_tracksHeight); //) * (m_scale * 50) + m_scale;
+ int track = (int)(mapToScene(event->pos()).y() / m_tracksHeight); //) * (m_scale * 50) + m_scale;
m_dropItem->moveTo((int)(mapToScene(event->pos()).x() / m_scale), m_scale, (int)((track - m_dropItem->track()) * m_tracksHeight), track);
event->setDropAction(Qt::MoveAction);
if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
return (int)(m_cursorPos * m_scale);
}
+void CustomTrackView::moveCursorPos(int delta) {
+ emit cursorMoved((int)(m_cursorPos * m_scale), (int)((m_cursorPos + delta) * m_scale));
+ m_cursorPos += delta;
+ m_cursorLine->setPos(m_cursorPos * m_scale, 0);
+ m_document->renderer()->seek(GenTime(m_cursorPos, m_document->fps()));
+ //if (m_autoScroll && m_scale < 50) checkScrolling();
+}
+
void CustomTrackView::checkScrolling() {
QRect rectInView = viewport()->rect();
int delta = rectInView.width() / 3;
m_document->renderer()->doRefresh();
}
+void CustomTrackView::slotUpdateClip(int clipId) {
+ QList<QGraphicsItem *> list = scene()->items();
+ ClipItem *clip = NULL;
+ for (int i = 0; i < list.size(); ++i) {
+ if (list.at(i)->type() == AVWIDGET) {
+ clip = static_cast <ClipItem *>(list.at(i));
+ if (clip->clipProducer() == clipId) {
+ clip->refreshClip();
+ m_document->renderer()->mltUpdateClip(m_tracksList.count() - clip->track(), clip->startPos(), clip->xml());
+ }
+ }
+ }
+}
+
ClipItem *CustomTrackView::getClipItemAt(int pos, int track) {
QList<QGraphicsItem *> list = scene()->items(QPointF(pos * m_scale, track * m_tracksHeight + m_tracksHeight / 2));
ClipItem *clip = NULL;
// kDebug() << "SNAP POINT: " << m_snapPoints.at(i).frames(25);
}
+void CustomTrackView::slotSeekToPreviousSnap() {
+ updateSnapPoints(NULL);
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ GenTime res = GenTime();
+ for (int i = 0; i < m_snapPoints.size(); ++i) {
+ if (m_snapPoints.at(i) >= pos) {
+ if (i == 0) i = 1;
+ res = m_snapPoints.at(i - 1);
+ break;
+ }
+ }
+ setCursorPos((int) res.frames(m_document->fps()));
+}
+
+void CustomTrackView::slotSeekToNextSnap() {
+ updateSnapPoints(NULL);
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ GenTime res = GenTime(m_projectDuration, m_document->fps());
+ for (int i = 0; i < m_snapPoints.size(); ++i) {
+ if (m_snapPoints.at(i) > pos) {
+ res = m_snapPoints.at(i);
+ break;
+ }
+ }
+ setCursorPos((int) res.frames(m_document->fps()));
+}
+
void CustomTrackView::setTool(PROJECTTOOL tool) {
m_tool = tool;
}