From 7fe12c8706cbf3798158a3cd85fff5230e9e8d40 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 27 Nov 2008 12:09:31 +0000 Subject: [PATCH] Fix several issues with spacer tool + some indent fixes svn path=/branches/KDE4/; revision=2737 --- src/abstractclipitem.cpp | 36 ++++++++++++++++------------------ src/customtrackview.cpp | 7 ++++++- src/kdenlivesettingsdialog.cpp | 4 ++-- src/recmonitor.cpp | 4 ++-- src/renderer.cpp | 3 +++ 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index 103a01d6..9c8d7d94 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -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 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 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()) { diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 4487a8ea..325692fa 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -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); diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 53ccff20..60e2a5b2 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -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: "<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: "< 0.0) diff --git a/src/renderer.cpp b/src/renderer.cpp index 467632e6..d220f3ec 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -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 -- 2.39.2