]> git.sesse.net Git - kdenlive/blobdiff - src/clipitem.cpp
- fix guides width being smaller when just added
[kdenlive] / src / clipitem.cpp
index 190343209baf75dba58a77d9bf366ef357fe71df..db222a1df2077fcb6548a5a222320f7209bcf9e4 100644 (file)
@@ -402,9 +402,24 @@ void ClipItem::resetThumbs()
 }
 
 
-void ClipItem::refreshClip()
-{
-    m_maxDuration = m_clip->maxDuration();
+void ClipItem::refreshClip(bool checkDuration)
+{
+    if (checkDuration && (m_maxDuration != m_clip->maxDuration())) {
+        m_maxDuration = m_clip->maxDuration();
+        if (m_clipType != IMAGE && m_clipType != TEXT && m_clipType != COLOR) {
+            if (m_cropStart + m_cropDuration > m_maxDuration) {
+                // Clip duration changed, make sure to stay in correct range
+                if (m_cropStart > m_maxDuration) {
+                    m_cropStart = GenTime();
+                    m_cropDuration = qMin(m_cropDuration, m_maxDuration);
+                    updateRectGeometry();
+                } else {
+                    m_cropDuration = m_maxDuration;
+                    updateRectGeometry();
+                }
+            }
+        }
+    }
     if (m_clipType == COLOR) {
         QString colour = m_clip->getProperty("colour");
         colour = colour.replace(0, 2, "#");
@@ -611,9 +626,9 @@ void ClipItem::paint(QPainter *painter,
     painter->setClipRect(exposed);
 
     //Fill clip rectangle
-    QRectF bgRect = br;
-    bgRect.setLeft(br.left() + xoffset);
-    painter->fillRect(bgRect, paintColor);
+    /*QRectF bgRect = br;
+    bgRect.setLeft(br.left() + xoffset);*/
+    painter->fillRect(exposed, paintColor);
 
     //painter->setClipPath(resultClipPath, Qt::IntersectClip);
 
@@ -777,7 +792,6 @@ void ClipItem::paint(QPainter *painter,
     }
 
     // Draw clip name
-    // draw frame around clip
     QColor frameColor(Qt::black);
     int alphaBase = 60;
     if (isSelected() || (parentItem() && parentItem()->isSelected())) {