Commit 839fc059 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Move timeline cursor after insert point when using insert zone in timeline

parent 031f55b1
......@@ -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);
}
}
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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:
......
......@@ -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)
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment