]> git.sesse.net Git - kdenlive/commitdiff
Fix adjusting position with clip dialog (double click on clip)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 30 May 2009 00:20:34 +0000 (00:20 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 30 May 2009 00:20:34 +0000 (00:20 +0000)
svn path=/trunk/kdenlive/; revision=3452

src/clipdurationdialog.cpp
src/customtrackview.cpp

index 5f144bdc512a361a4b53683e1d778fb6506f0f19..cfcef5e6cfdc9e8910b679e2fe442afb8f2e7f5a 100644 (file)
@@ -23,6 +23,7 @@
 #include "kdenlivesettings.h"
 
 #include <KDebug>
+#include <KMessageBox>
 
 #include <QWheelEvent>
 
@@ -80,9 +81,9 @@ void ClipDurationDialog::slotCheckStart()
     int dur = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
     GenTime start(pos, m_fps);
     GenTime duration(dur, m_fps);
-    if (start < m_min) {
+    if (m_min != GenTime() && start < m_min) {
         m_view.clip_position->setText(m_tc.getTimecode(m_min, m_fps));
-    } else if (start + duration > m_max) {
+    } else if (m_max != GenTime() && start + duration > m_max) {
         m_view.clip_position->setText(m_tc.getTimecode(m_max - duration, m_fps));
     }
 }
index 9e6a543bdf2017ab79b5f35626cad42c35d81629..746740d8b39fb00a00c7d6b88e4b445d20f2c698 100644 (file)
@@ -1016,7 +1016,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
             m_commandStack->push(command);
             updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
         }
-    } else if (m_dragItem) {
+    } else if (m_dragItem && !m_dragItem->isItemLocked()) {
         ClipDurationDialog d(m_dragItem, m_document->timecode(), this);
         GenTime minimum;
         GenTime maximum;
@@ -1045,13 +1045,21 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
                 QUndoCommand *moveCommand = new QUndoCommand();
                 moveCommand->setText(i18n("Edit clip"));
                 ItemInfo clipInfo = m_dragItem->info();
+                if (d.duration() < m_dragItem->duration() || d.cropStart() != clipInfo.cropStart) {
+                    // duration was reduced, so process it first
+                    ItemInfo startInfo = clipInfo;
+                    clipInfo.endPos = clipInfo.startPos + d.duration();
+                    clipInfo.cropStart = d.cropStart();
+                    new ResizeClipCommand(this, startInfo, clipInfo, true, moveCommand);
+                }
                 if (d.startPos() != clipInfo.startPos) {
                     ItemInfo startInfo = clipInfo;
                     clipInfo.startPos = d.startPos();
                     clipInfo.endPos = m_dragItem->endPos() + (clipInfo.startPos - startInfo.startPos);
                     new MoveClipCommand(this, startInfo, clipInfo, true, moveCommand);
                 }
-                if (d.duration() != m_dragItem->duration() || d.cropStart() != clipInfo.cropStart) {
+                if (d.duration() > m_dragItem->duration()) {
+                    // duration was increased, so process it after move
                     ItemInfo startInfo = clipInfo;
                     clipInfo.endPos = clipInfo.startPos + d.duration();
                     clipInfo.cropStart = d.cropStart();