Shift + razor tool shows current frame while moving mouse in timeline to help precise cuts

parent c870fc5f
......@@ -1565,7 +1565,7 @@ void MainWindow::connectDocument()
connect(pCore->bin(), SIGNAL(clipNameChanged(QString)), trackView->projectView(), SLOT(clipNameChanged(QString)));
connect(pCore->bin(), SIGNAL(displayMessage(QString,MessageType)), m_messageLabel, SLOT(setMessage(QString,MessageType)));
//connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase*,QPoint,bool,int)), m_clipMonitor, SLOT(slotSetClipProducer(DocClipBase*,QPoint,bool,int)));
connect(trackView->projectView(), SIGNAL(showClipFrame(ClipController*,int)), m_clipMonitor, SLOT(slotSeekController(ClipController*,int)));
connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
connect(m_projectMonitor, &Monitor::addEffect, trackView->projectView(), &CustomTrackView::slotAddEffectToCurrentItem);
......
......@@ -1143,6 +1143,14 @@ void Monitor::updateClipProducer(const QString &playlist)
render->play(1.0);
}
void Monitor::slotSeekController(ClipController *controller, int pos)
{
if (controller != m_controller) {
slotOpenClip(controller, pos, -1);
}
else slotSeek(pos);
}
void Monitor::slotOpenClip(ClipController *controller, int in, int out)
{
if (render == NULL) return;
......
......@@ -225,6 +225,8 @@ public slots:
void updateClipProducer(Mlt::Producer *prod);
void updateClipProducer(const QString &playlist);
void slotOpenClip(ClipController *controller, int in = -1, int out = -1);
/** @brief Seek clip monitor to a requested position. */
void slotSeekController(ClipController *controller, int pos);
void refreshMonitor(bool visible = true);
void slotSeek(int pos);
void stop();
......
......@@ -655,9 +655,9 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
AbstractClipItem *clip = static_cast <AbstractClipItem*>(item);
if (m_tool == RazorTool) {
// razor tool over a clip, display current frame in monitor
if (false && item->type() == AVWidget) {
if (event->modifiers() == Qt::ShiftModifier && item->type() == AVWidget) {
//TODO: solve crash when showing frame when moving razor over clip
//emit showClipFrame(static_cast<ClipItem*>(item)->baseClip(), QPoint(), false, mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
emit showClipFrame(static_cast<ClipItem*>(item)->binClip()->controller(), mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
}
event->accept();
return;
......@@ -930,7 +930,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
}
if (event->button() == Qt::LeftButton) {
if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() & Qt::ShiftModifier && m_tool == SelectTool) {
createRectangleSelection(event);
return;
}
......
......@@ -564,6 +564,8 @@ signals:
void guidesUpdated();
/** @brief Prepare importing and expand of a playlist clip */
void importPlaylistClips(ItemInfo info, QUrl url, QUndoCommand *expandCommand);
/** @brief Show a specific frame in clip monitor */
void showClipFrame(ClipController *, int);
};
#endif
......
Markdown is supported
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