]> git.sesse.net Git - kdenlive/commitdiff
correct length/start in transition
authorMarco Gittler <marco@gitma.de>
Mon, 10 Mar 2008 23:21:12 +0000 (23:21 +0000)
committerMarco Gittler <marco@gitma.de>
Mon, 10 Mar 2008 23:21:12 +0000 (23:21 +0000)
resize (start+end) correct

svn path=/branches/KDE4/; revision=2046

src/abstractclipitem.cpp
src/clipitem.cpp
src/clipitem.h
src/customtrackview.cpp
src/transition.cpp

index 9c87d3a62c4656bf2f1f06d14b88e974a0960a04..08f6c27cf77b2049bdf17bfa74a7583a6f397e8b 100644 (file)
@@ -60,11 +60,13 @@ void AbstractClipItem::resizeStart(int posx, double scale) {
     GenTime durationDiff = GenTime(posx, m_fps) - m_startPos;
     if (durationDiff == GenTime()) return;
     //kDebug() << "-- RESCALE: CROP=" << m_cropStart << ", DIFF = " << durationDiff;
-    if (m_cropStart + durationDiff < GenTime()) {
+
+    if (m_cropStart + durationDiff < GenTime() && type() == 70000) {
         durationDiff = GenTime() - m_cropStart;
     } else if (durationDiff >= m_cropDuration) {
         durationDiff = m_cropDuration - GenTime(3, m_fps);
     }
+
     m_startPos += durationDiff;
     m_cropStart += durationDiff;
     m_cropDuration = m_cropDuration - durationDiff;
index 655dda7036b7a5fa1ef6d7d3b0e9371ec03401cb..cd60dff0fa6213fa4c93be392ce84665abc02b16 100644 (file)
@@ -154,10 +154,6 @@ int ClipItem::clipProducer() {
     return m_producer;
 }
 
-GenTime ClipItem::cropStart() const {
-    return m_cropStart;
-}
-
 void ClipItem::flashClip() {
     if (m_timeLine == 0) {
         m_timeLine = new QTimeLine(750, this);
index bba588b7c130656ca9be1468b444aae698875b36..a576c310cc174bc6f8f99d2a0f02d2a318b96158 100644 (file)
@@ -51,8 +51,6 @@ public:
     int clipType();
     DocClipBase *baseClip();
     QString clipName();
-
-    GenTime cropStart() const;
     QDomElement xml() const;
 
     void setFadeOut(int pos, double scale);
index bd6327600f54cc6aaa556c994a9c67f1bbbc19af..dd569e52c12f74ecad0b7bba3723d2bc1abba734 100644 (file)
@@ -99,7 +99,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
             if (m_operationMode == MOVE) {
                 double snappedPos = getSnapPointForPos(mapToScene(event->pos()).x() - m_clickPoint);
                 kDebug() << "///////  MOVE CLIP, EVENT Y: ";//<<event->scenePos().y()<<", SCENE HEIGHT: "<<scene()->sceneRect().height();
-                int moveTrack = (int)  mapToScene(event->pos()).y() / 50;
+                int moveTrack = (int)  mapToScene(event->pos() - QPoint(0, (m_dragItem->type() == 70001 ? 25 : 0))).y() / 50;
                 int currentTrack = m_dragItem->track();
 
                 if (moveTrack > m_tracksCount - 1) moveTrack = m_tracksCount - 1;
@@ -347,7 +347,12 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
                 else if (m_operationMode == RESIZEEND)
                     m_startPos = QPointF(m_dragItem->endPos().frames(m_document->fps()), m_dragItem->track());
                 else if (m_operationMode == TRANSITIONSTART) {
-                    Transition *tr = new Transition(QRect(m_dragItem->rect().x() , m_dragItem->rect().height() / 2, (m_dragItem->startPos() + GenTime(2.5)).frames(25.0) ,  m_dragItem->rect().height()), (ClipItem*)m_dragItem, LUMA_TRANSITION, m_dragItem->startPos(), m_dragItem->startPos() + GenTime(2.5), m_document->fps());
+                    Transition *tr = new Transition(
+                        QRect(m_dragItem->startPos().frames(m_document->fps()) *m_scale , m_dragItem->rect().height() / 2,
+                              GenTime(2.5).frames(m_document->fps()) *m_scale ,  m_dragItem->rect().height()
+                             ),
+                        (ClipItem*)m_dragItem, LUMA_TRANSITION, m_dragItem->startPos(), m_dragItem->startPos() + GenTime(2.5), m_document->fps());
+                    tr->setTrack(m_dragItem->track());
                     scene()->addItem(tr);
                     //m_dragItem->addTransition(tra);
                 }
index ae6b6cd2b6546c7cde2a07c8323c02ff32185034..70b60b627f9b53405786205d85a4f68a9b6b8871 100644 (file)
@@ -42,6 +42,7 @@ Transition::Transition(const QRectF& rect , ClipItem * clipa, const TRANSITIONTY
     m_fps = fps;
     m_cropDuration = endTime - startTime;
     m_startPos = startTime;
+    m_maxDuration = GenTime(1000000);
     // Default duration = 2.5 seconds
     GenTime defaultTransitionDuration = GenTime(2.5);