]> git.sesse.net Git - kdenlive/commitdiff
Fix several issues with spacer tool + some indent fixes
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 27 Nov 2008 12:09:31 +0000 (12:09 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 27 Nov 2008 12:09:31 +0000 (12:09 +0000)
svn path=/branches/KDE4/; revision=2737

src/abstractclipitem.cpp
src/customtrackview.cpp
src/kdenlivesettingsdialog.cpp
src/recmonitor.cpp
src/renderer.cpp

index 103a01d62f0a1f67e3d00ae472e4602c798a6556..9c8d7d94d8e545538eb811e82b2cd50f4fcf784b 100644 (file)
@@ -86,36 +86,34 @@ void AbstractClipItem::resizeStart(int posx, double speed) {
     if (type() == AVWIDGET) m_cropStart += durationDiff * speed;
     m_cropDuration = m_cropDuration - durationDiff * speed;
 
-    setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
     setPos(m_startPos.frames(m_fps), pos().y());
-
     if (pos().x() != m_startPos.frames(m_fps)) {
         GenTime diff = GenTime(pos().x(), m_fps) - m_startPos;
         m_startPos += diff;
         m_cropDuration = m_cropDuration - diff;
         if (type() == AVWIDGET) m_cropStart = m_cropStart + diff;
-        setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
     }
+    setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
 
     //kDebug() << "-- NEW CLIP=" << startPos().frames(25) << "-" << endPos().frames(25);
     //setRect((double) m_startPos.frames(m_fps) * scale, rect().y(), (double) m_cropDuration.frames(m_fps) * scale, rect().height());
 
-    if (durationDiff < GenTime()) {
-        QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
-        for (int i = 0; i < collisionList.size(); ++i) {
-            QGraphicsItem *item = collisionList.at(i);
-            if (item->type() == type() && item->pos().x() < pos().x()) {
-                kDebug() << "/////////  COLLISION DETECTED!!!!!!!!!";
-                GenTime diff = ((AbstractClipItem *)item)->endPos() + GenTime(1, m_fps) - m_startPos;
-                setRect(0, 0, (m_cropDuration - diff).frames(m_fps) - 0.02, rect().height());
-                setPos((m_startPos + diff).frames(m_fps), pos().y());
-                m_startPos += diff;
-                if (type() == AVWIDGET) m_cropStart += diff;
-                m_cropDuration = m_cropDuration - diff;
-                break;
+    /*    if (durationDiff < GenTime()) {
+            QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
+            for (int i = 0; i < collisionList.size(); ++i) {
+                QGraphicsItem *item = collisionList.at(i);
+                if (item->type() == type() && item->pos().x() < pos().x()) {
+                    kDebug() << "/////////  COLLISION DETECTED!!!!!!!!!";
+                    GenTime diff = ((AbstractClipItem *)item)->endPos() + GenTime(1, m_fps) - m_startPos;
+                    setRect(0, 0, (m_cropDuration - diff).frames(m_fps) - 0.02, rect().height());
+                    setPos((m_startPos + diff).frames(m_fps), pos().y());
+                    m_startPos += diff;
+                    if (type() == AVWIDGET) m_cropStart += diff;
+                    m_cropDuration = m_cropDuration - diff;
+                    break;
+                }
             }
-        }
-    }
+        }*/
 }
 
 void AbstractClipItem::resizeEnd(int posx, double speed, bool updateKeyFrames) {
@@ -129,7 +127,7 @@ void AbstractClipItem::resizeEnd(int posx, double speed, bool updateKeyFrames) {
         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;
+    //kDebug() << "// DUR DIFF2:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
     m_cropDuration += durationDiff * speed;
     setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
     if (durationDiff > GenTime()) {
index 4487a8ea6297aa7c4689b2185a77f7204c5d001b..325692facf589faf0c089f62e4dbbbe0feeb89c0 100644 (file)
@@ -1339,6 +1339,9 @@ void CustomTrackView::slotInsertSpace() {
     if (d.exec() != QDialog::Accepted) return;
     GenTime spaceDuration = d.selectedDuration();
     track = d.selectedTrack();
+    ClipItem *item = getClipItemAt(pos, track);
+    if (item) pos = item->startPos();
+
     InsertSpaceCommand *command = new InsertSpaceCommand(this, pos, track, spaceDuration, true);
     m_commandStack->push(command);
 }
@@ -1450,9 +1453,11 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) {
     } else if (m_operationMode == SPACER) {
         int endClick = (int)(mapToScene(event->pos()).x() + 0.5);
         int mappedClick = (int)(mapToScene(m_clickEvent).x() + 0.5);
+        int track = (int)(mapToScene(m_clickEvent).y() / m_tracksHeight);
+        ClipItem *item = getClipItemAt(mappedClick, track);
+        if (item) mappedClick = item->startPos().frames(m_document->fps());
         int diff = m_selectionGroup->pos().x() - m_spacerStart;//endClick - mappedClick;
         kDebug() << "// MOVING SPACER DIFF:" << diff;
-        int track = (int)(mapToScene(m_clickEvent).y() / m_tracksHeight);
         if (diff < 0) mappedClick += diff;
         InsertSpaceCommand *command = new InsertSpaceCommand(this, GenTime(mappedClick, m_document->fps()), track, GenTime(diff, m_document->fps()), false);
         m_commandStack->push(command);
index 53ccff20a44651246b894b09b98a00ac0f9aea0e..60e2a5b2c50f945ec130671444575b7e6f989a48 100644 (file)
@@ -381,9 +381,9 @@ void KdenliveSettingsDialog::updateSettings() {
     }
 
     value = m_configCapture.kcfg_rmd_audio_freq->itemText(m_configCapture.kcfg_rmd_audio_freq->currentIndex());
-    kDebug()<<"// AUDIO FREQ VALUE: "<<value<<", CURRENT: "<<KdenliveSettings::rmd_freq()<<", IX: "<<m_configCapture.kcfg_rmd_audio_freq->currentIndex();
+    kDebug() << "// AUDIO FREQ VALUE: " << value << ", CURRENT: " << KdenliveSettings::rmd_freq() << ", IX: " << m_configCapture.kcfg_rmd_audio_freq->currentIndex();
     if (value != KdenliveSettings::rmd_freq()) {
-       kDebug()<<"// SETTING AUDIO FREQ TO: "<<value;
+        kDebug() << "// SETTING AUDIO FREQ TO: " << value;
         KdenliveSettings::setRmd_freq(value);
     }
 
index c0c602fa3bb391b3c71674ee9ac599ac23b6a6d0..d2693b620192d197777934b692948954405c6d40 100644 (file)
@@ -455,8 +455,8 @@ void RecMonitor::slotRecord() {
             }
             m_isCapturing = true;
             if (KdenliveSettings::rmd_capture_audio()) {
-               m_captureArgs << "-freq" << KdenliveSettings::rmd_freq();
-               m_captureArgs << "-channels" << QString::number(KdenliveSettings::rmd_audio_channels());
+                m_captureArgs << "-freq" << KdenliveSettings::rmd_freq();
+                m_captureArgs << "-channels" << QString::number(KdenliveSettings::rmd_audio_channels());
                 if (KdenliveSettings::rmd_use_jack()) {
                     m_captureArgs << "-use-jack" << KdenliveSettings::rmd_jackports();
                     if (KdenliveSettings::rmd_jack_buffer() > 0.0)
index 467632e6a44e11a0adc109a0cb801a05481e89a6..d220f3ec231d4cd3e3d0403ec135d8f37763e099 100644 (file)
@@ -1472,6 +1472,8 @@ void Render::mltInsertSpace(const GenTime pos, int track, const GenTime duration
             int position = trackPlaylist.clip_start(clipIndex);
             trackPlaylist.remove_region(position, -diff - 1);
         }
+        trackPlaylist.consolidate_blanks(0);
+
         // now move transitions
         mlt_service serv = m_mltProducer->parent().get_service();
         mlt_service nextservice = mlt_service_get_producer(serv);
@@ -1505,6 +1507,7 @@ void Render::mltInsertSpace(const GenTime pos, int track, const GenTime duration
                 int position = trackPlaylist.clip_start(clipIndex);
                 trackPlaylist.remove_region(position, -diff - 1);
             }
+            trackPlaylist.consolidate_blanks(0);
             trackNb--;
         }
         // now move transitions