]> git.sesse.net Git - kdenlive/commitdiff
Fix effects + transitions with geometry parameter behaving strange after resize becau...
authorTill Theato <root@ttill.de>
Mon, 30 Aug 2010 21:39:47 +0000 (21:39 +0000)
committerTill Theato <root@ttill.de>
Mon, 30 Aug 2010 21:39:47 +0000 (21:39 +0000)
svn path=/trunk/kdenlive/; revision=4785

src/clipitem.cpp
src/effectstackedit.cpp
src/geometrywidget.cpp
src/monitorscene.cpp

index a210aa1a69a872fe0bd6f439cfea2b743d655e11..974ecf1cb1cec91fffc0ec0c18ba71e01949e42b 100644 (file)
@@ -196,8 +196,10 @@ void ClipItem::setEffectList(const EffectsList effectList)
                     }
                 }
             }
-            if (fade > 0) m_startFade = fade;
-            else if (fade < 0) m_endFade = -fade;
+            if (fade > 0)
+                m_startFade = fade;
+            else if (fade < 0)
+                m_endFade = -fade;
         }
         setSelectedEffect(0);
     }
index 42e8a418939c547a60c00a45a432ee9c401b8dfa..4907493305ec04308c67c50c42eeda1155451fec 100644 (file)
@@ -262,13 +262,13 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
                 GeometryWidget *geometry = new GeometryWidget(m_monitor, m_timecode, pos, isEffect, this);
                 // connect this before setupParam to make sure the monitor scene shows up at startup
                 connect(geometry, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int)));
+                connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
                 if (minFrame == maxFrame)
                     geometry->setupParam(pa, m_in, m_out);
                 else
                     geometry->setupParam(pa, minFrame, maxFrame);
                 m_vbox->addWidget(geometry);
                 m_valueItems[paramName+"geometry"] = geometry;
-                connect(geometry, SIGNAL(parameterChanged()), this, SLOT(collectAllParameters()));
                 connect(geometry, SIGNAL(seekToPos(int)), this, SIGNAL(seekTimeline(int)));
                 connect(this, SIGNAL(syncEffectsPos(int)), geometry, SLOT(slotSyncPosition(int)));
             } else {
index c10389dc5ddb4457e26d9651e168ba05088f80d7..496214237bbab221486e6d530af405415b5ff33d 100644 (file)
@@ -190,6 +190,14 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
         m_geometry = new Mlt::Geometry(tmp, maxframe - minframe, m_monitor->render->renderWidth(), m_monitor->render->renderHeight());
     delete[] tmp;
 
+    // remove keyframes out of range
+    Mlt::GeometryItem invalidItem;
+    bool foundInvalidItem = false;
+    while (!m_geometry->next_key(&invalidItem, maxframe - minframe)) {
+        foundInvalidItem = true;
+        m_geometry->remove(invalidItem.frame());
+    }
+
     if (elem.attribute("fixed") == "1") {
         // Keyframes are disabled
         m_ui.widgetTimeWrapper->setHidden(true);
@@ -221,6 +229,10 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
 
     slotPositionChanged(0, false);
     slotCheckMonitorPosition(m_monitor->render->seekFramePosition());
+
+    // update if we had to remove a keyframe which got out of range
+    if (foundInvalidItem)
+        QTimer::singleShot(300, this, SIGNAL(parameterChanged()));
 }
 
 void GeometryWidget::slotSyncPosition(int relTimelinePos)
@@ -237,13 +249,14 @@ void GeometryWidget::slotSyncPosition(int relTimelinePos)
 
 void GeometryWidget::slotPositionChanged(int pos, bool seek)
 {
-    if (pos == -1)
+    if (pos == -1) {
         pos = m_timePos->getValue();
-
-    m_timePos->setValue(pos);
-    m_timeline->blockSignals(true);
-    m_timeline->setValue(pos);
-    m_timeline->blockSignals(false);
+        m_timeline->blockSignals(true);
+        m_timeline->setValue(pos);
+        m_timeline->blockSignals(false);
+    } else {
+        m_timePos->setValue(pos);
+    }
 
     Mlt::GeometryItem item;
     if (m_geometry->fetch(&item, pos) || item.key() == false) {
index 077ca6054d7e9fbb86ec5b5c8de6af730cc7fd99..857caab990d0a56ee7b64c9bfda77f659efc5ada 100644 (file)
@@ -219,6 +219,11 @@ void MonitorScene::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
     if (!m_enabled)
         return;
 
+    /*if (event->buttons() != Qt::NoButton && (event->screenPos() - m_screenClickPoint).manhattanLength() < QApplication::startDragDistance()) {
+        event->accept();
+        return;
+    }*/
+
     QPointF mousePos = event->scenePos();
 
     if (m_selectedItem && event->buttons() & Qt::LeftButton) {