X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fcustomtrackscene.cpp;h=35d12061730a6662a261164e2f3d821869bcfc5d;hb=bf85ada7922e7e71efe54ca62c86fb53e265e3a6;hp=13672c1f0c18da2c20e7a8b1330be442961fa952;hpb=d43383d14efb17899c439d85c257f5be5d2a118e;p=kdenlive diff --git a/src/customtrackscene.cpp b/src/customtrackscene.cpp index 13672c1f..35d12061 100644 --- a/src/customtrackscene.cpp +++ b/src/customtrackscene.cpp @@ -25,7 +25,8 @@ CustomTrackScene::CustomTrackScene(KdenliveDoc *doc, QObject *parent) : QGraphicsScene(parent), m_document(doc), - m_scale(1.0, 1.0) + m_scale(1.0, 1.0), + m_editMode(NormalEdit) { } @@ -43,29 +44,30 @@ double CustomTrackScene::getSnapPointForPos(double pos, bool doSnap) if (qAbs((int)(pos - m_snapPoints.at(i).frames(m_document->fps()))) < maximumOffset) { return m_snapPoints.at(i).frames(m_document->fps()); } - if (m_snapPoints.at(i).frames(m_document->fps()) > pos) break; + if (m_snapPoints.at(i).frames(m_document->fps()) > pos) + break; } } return GenTime(pos, m_document->fps()).frames(m_document->fps()); } -void CustomTrackScene::setSnapList(QList snaps) +void CustomTrackScene::setSnapList(const QList & snaps) { m_snapPoints = snaps; } -GenTime CustomTrackScene::previousSnapPoint(GenTime pos) +GenTime CustomTrackScene::previousSnapPoint(const GenTime &pos) const { for (int i = 0; i < m_snapPoints.size(); ++i) { if (m_snapPoints.at(i) >= pos) { - if (i == 0) i = 1; + if (i == 0) return GenTime(); return m_snapPoints.at(i - 1); } } return GenTime(); } -GenTime CustomTrackScene::nextSnapPoint(GenTime pos) +GenTime CustomTrackScene::nextSnapPoint(const GenTime &pos) const { for (int i = 0; i < m_snapPoints.size(); ++i) { if (m_snapPoints.at(i) > pos) { @@ -96,4 +98,14 @@ MltVideoProfile CustomTrackScene::profile() const return m_document->mltProfile(); } +void CustomTrackScene::setEditMode(EditMode mode) +{ + m_editMode = mode; +} + +EditMode CustomTrackScene::editMode() const +{ + return m_editMode; +} + #include "customtrackscene.moc"