]> git.sesse.net Git - kdenlive/blobdiff - src/abstractclipitem.cpp
enable / disable delete keyframe button when necessary
[kdenlive] / src / abstractclipitem.cpp
index 370a781bf7c580347413e94885d3574b31e5c2b6..0008c8b157a20e573866f446974ff4a4339aaf37 100644 (file)
@@ -148,9 +148,6 @@ void AbstractClipItem::resizeEnd(int posx, double speed, bool /*updateKeyFrames*
     //kDebug() << "// DUR DIFF1:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
     if (cropDuration() + durationDiff <= GenTime()) {
         durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
-    } else if (type() == AVWIDGET && (cropStart() + cropDuration() + durationDiff >= maxDuration())) {
-        //kDebug() << "// MAX OVERLOAD:" << cropDuration().frames(25) << " + " << durationDiff.frames(25) << ", MAX:" << maxDuration().frames(25);
-        durationDiff = maxDuration() - cropDuration() - cropStart();
     }
     //kDebug() << "// DUR DIFF2:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
     m_cropDuration += durationDiff * speed;
@@ -197,11 +194,6 @@ GenTime AbstractClipItem::maxDuration() const
     return m_maxDuration;
 }
 
-void AbstractClipItem::setMaxDuration(const GenTime &max)
-{
-    m_maxDuration = max;
-}
-
 QPainterPath AbstractClipItem::upperRectPart(QRectF br)
 {
     QPainterPath roundRectPathUpper;
@@ -263,7 +255,8 @@ void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF /*exposedRect*/)
     double y2;
 
     // draw line showing default value
-    if (isSelected()) {
+    bool active = isSelected() || (parentItem() && parentItem()->isSelected());
+    if (active) {
         x1 = br.x();
         x2 = br.right();
         y1 = br.bottom() - m_keyframeDefault * maxh;
@@ -293,13 +286,13 @@ void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF /*exposedRect*/)
         QLineF l(x1, y1, x2, y2);
         l2 = painter->matrix().map(l);
         painter->drawLine(l2);
-        if (isSelected()) {
+        if (active) {
             painter->fillRect(l2.x1() - 3, l2.y1() - 3, 6, 6, QBrush(color));
         }
         x1 = x2;
         y1 = y2;
     }
-    if (isSelected()) painter->fillRect(l2.x2() - 3, l2.y2() - 3, 6, 6, QBrush(color));
+    if (active) painter->fillRect(l2.x2() - 3, l2.y2() - 3, 6, 6, QBrush(color));
 }
 
 int AbstractClipItem::mouseOverKeyFrames(QPointF pos)
@@ -331,9 +324,9 @@ void AbstractClipItem::updateSelectedKeyFrame()
     QRectF br = sceneBoundingRect();
     double maxw = br.width() / m_cropDuration.frames(m_fps);
     double maxh = br.height() / 100.0 * m_keyframeFactor;
-    update(br.x() + maxw * (m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
+    update(br.x() + maxw *(m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
     m_selectedKeyframe = m_editedKeyframe;
-    update(br.x() + maxw * (m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
+    update(br.x() + maxw *(m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
 }
 
 int AbstractClipItem::selectedKeyFramePos() const