summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-08-30 23:33:58 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-08-30 23:33:58 (GMT)
commit839fc059e672cf389409e9716839d168fedbe64a (patch)
tree604fa13eeb03c786da3940297d9c2092a8cfe6d3
parent031f55b1b5c410e38d7bd80c6fa9faeb8f2a247b (diff)
Move timeline cursor after insert point when using insert zone in timeline
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/monitor/monitor.cpp10
-rw-r--r--src/monitor/monitor.h2
-rw-r--r--src/renderer.cpp14
-rw-r--r--src/renderer.h1
-rw-r--r--src/timeline/customtrackview.cpp9
-rw-r--r--src/timeline/customtrackview.h2
7 files changed, 35 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 53464d8..9ac2ed8 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2371,7 +2371,9 @@ void MainWindow::slotInsertClipInsert()
{
if (pCore->projectManager()->currentTimeline()) {
QPoint binZone = m_clipMonitor->getZoneInfo();
- pCore->projectManager()->currentTimeline()->projectView()->insertZone(TimelineMode::InsertEdit, m_clipMonitor->activeClipId(), binZone);
+ int pos = pCore->projectManager()->currentTimeline()->projectView()->insertZone(TimelineMode::InsertEdit, m_clipMonitor->activeClipId(), binZone);
+ if (pos > 0)
+ m_projectMonitor->silentSeek(pos);
}
}
diff --git a/src/monitor/monitor.cpp b/src/monitor/monitor.cpp
index a28daa6..bbd2040 100644
--- a/src/monitor/monitor.cpp
+++ b/src/monitor/monitor.cpp
@@ -980,6 +980,16 @@ void Monitor::slotSeek(int pos)
m_ruler->update();
}
+void Monitor::silentSeek(int pos)
+{
+ if (render == NULL) return;
+ if (m_ruler->slotNewValue(pos)) {
+ m_timePos->setValue(pos);
+ render->silentSeek(pos);
+ render->rendererPosition(pos);
+ }
+}
+
void Monitor::checkOverlay(int pos)
{
if (m_qmlManager->sceneType() != MonitorSceneDefault) {
diff --git a/src/monitor/monitor.h b/src/monitor/monitor.h
index b5c42a2..39679d8 100644
--- a/src/monitor/monitor.h
+++ b/src/monitor/monitor.h
@@ -153,6 +153,8 @@ public:
void activateSplit();
/** @brief Clear monitor display **/
void clearDisplay();
+ /** @brief Seeks timeline without refreshing if monitor is not active **/
+ void silentSeek(int pos);
protected:
void mousePressEvent(QMouseEvent * event);
diff --git a/src/renderer.cpp b/src/renderer.cpp
index d55e011..2ef987e 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -146,6 +146,16 @@ void Render::seek(const GenTime &time)
seek(pos);
}
+void Render::silentSeek(int time)
+{
+ if (m_isActive) {
+ seek(time);
+ return;
+ }
+ m_mltProducer->seek(time);
+ m_mltConsumer->set("refresh", 1);
+}
+
void Render::seek(int time)
{
resetZoneMode();
@@ -827,7 +837,7 @@ void Render::seekToFrameDiff(int diff)
if (!m_mltProducer || !m_isActive)
return;
if (requestedSeekPosition == SEEK_INACTIVE) {
- seek(m_mltConsumer->position() + diff);
+ seek(seekFramePosition() + diff);
}
else {
seek(requestedSeekPosition + diff);
@@ -904,6 +914,8 @@ GenTime Render::seekPosition() const
int Render::seekFramePosition() const
{
+ if (m_mltProducer && m_mltProducer->get_speed() == 0)
+ return (int) m_mltProducer->position();
if (m_mltConsumer) return (int) m_mltConsumer->position();
return 0;
}
diff --git a/src/renderer.h b/src/renderer.h
index 58871c0..a381a6e 100644
--- a/src/renderer.h
+++ b/src/renderer.h
@@ -252,6 +252,7 @@ class Render: public AbstractRender
void finishProfileReset();
void updateSlowMotionProducers(const QString &id, QMap <QString, QString> passProperties);
void preparePreviewRendering(const QString sceneListFile);
+ void silentSeek(int time);
private:
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index cdbb089..7c6df84 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -7803,14 +7803,14 @@ void CustomTrackView::checkTrackSequence(int track)
if (times != timelineList) KMessageBox::sorry(this, i18n("error"), i18n("TRACTOR"));
}
-void CustomTrackView::insertZone(TimelineMode::EditMode sceneMode, const QString clipId, QPoint binZone)
+int CustomTrackView::insertZone(TimelineMode::EditMode sceneMode, const QString clipId, QPoint binZone)
{
bool extractAudio = true;
bool extractVideo = true;
ProjectClip *clp = m_document->getBinClip(clipId);
if (!clp) {
emit displayMessage(i18n("Select a Bin Clip to perform operation"), ErrorMessage);
- return;
+ return -1;
}
ClipType cType = clp->clipType();
if (KdenliveSettings::splitaudio()) {
@@ -7822,9 +7822,9 @@ void CustomTrackView::insertZone(TimelineMode::EditMode sceneMode, const QString
else if (m_timeline->getTrackInfo(m_selectedTrack).isLocked) {
// Cannot perform an Extract operation on a locked track
emit displayMessage(i18n("Cannot perform operation on a locked track"), ErrorMessage);
- return;
+ return -1;
}
- if (binZone.isNull()) return;
+ if (binZone.isNull()) return -1;
QPoint timelineZone;
if (KdenliveSettings::useTimelineZoneToEdit()) {
timelineZone = m_document->zone();
@@ -7888,6 +7888,7 @@ void CustomTrackView::insertZone(TimelineMode::EditMode sceneMode, const QString
updateTrackDuration(info.track, addCommand);
m_commandStack->push(addCommand);
selectClip(true, false, m_selectedTrack, timelineZone.x());
+ return info.endPos.frames(m_document->fps());
}
void CustomTrackView::clearSelection(bool emitInfo)
diff --git a/src/timeline/customtrackview.h b/src/timeline/customtrackview.h
index 8e320b5..6a1ec1e 100644
--- a/src/timeline/customtrackview.h
+++ b/src/timeline/customtrackview.h
@@ -369,7 +369,7 @@ public slots:
void slotTrackUp();
void slotTrackDown();
void slotSelectTrack(int ix, bool switchTarget = false);
- void insertZone(TimelineMode::EditMode sceneMode, const QString clipId, QPoint binZone);
+ int insertZone(TimelineMode::EditMode sceneMode, const QString clipId, QPoint binZone);
/** @brief Rebuilds a group to fit again after children changed.
* @param childTrack the track of one of the groups children