]> git.sesse.net Git - kdenlive/blobdiff - src/customtrackview.cpp
When adding an existing kdenlive title clip to the project , detach embedded images:
[kdenlive] / src / customtrackview.cpp
index c2240b663fac5b8ba3c791e9d5f5290f24f22de8..bc10df9c101d7e9157f4e7025dbe5c698199dba6 100644 (file)
@@ -398,19 +398,26 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
                 if (!m_controlModifier && m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
                     AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
                     if (parent)
-                        parent->resizeStart((int)(snappedPos) - m_dragItemInfo.startPos.frames(m_document->fps()));
+                        parent->resizeStart((int)(snappedPos - m_dragItemInfo.startPos.frames(m_document->fps())));
                 } else {
                     m_dragItem->resizeStart((int)(snappedPos));
                 }
+                QString crop = m_document->timecode().getDisplayTimecode(m_dragItem->cropStart(), KdenliveSettings::frametimecode());
+                QString duration = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration(), KdenliveSettings::frametimecode());
+                QString offset = m_document->timecode().getDisplayTimecode(m_dragItem->cropStart() - m_dragItemInfo.cropStart, KdenliveSettings::frametimecode());
+                emit displayMessage(i18n("Crop from start:") + ' ' + crop + ' ' + i18n("Duration:") + ' ' + duration + ' ' + i18n("Offset:") + ' ' + offset, InformationMessage);
             } else if (m_operationMode == RESIZEEND && move) {
                 m_document->renderer()->pause();
                 if (!m_controlModifier && m_dragItem->type() == AVWIDGET && m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
                     AbstractGroupItem *parent = static_cast <AbstractGroupItem *>(m_dragItem->parentItem());
                     if (parent)
-                        parent->resizeEnd((int)(snappedPos) - m_dragItemInfo.endPos.frames(m_document->fps()));
+                        parent->resizeEnd((int)(snappedPos - m_dragItemInfo.endPos.frames(m_document->fps())));
                 } else {
                     m_dragItem->resizeEnd((int)(snappedPos));
                 }
+                QString duration = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration(), KdenliveSettings::frametimecode());
+                QString offset = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration() - m_dragItemInfo.cropDuration, KdenliveSettings::frametimecode());
+                emit displayMessage(i18n("Duration:") + ' ' + duration + ' ' + i18n("Offset:") + ' ' + offset, InformationMessage);
             } else if (m_operationMode == FADEIN && move) {
                 ((ClipItem*) m_dragItem)->setFadeIn((int)(mappedXPos - m_dragItem->startPos().frames(m_document->fps())));
             } else if (m_operationMode == FADEOUT && move) {
@@ -2662,8 +2669,8 @@ void CustomTrackView::configTracks(QList < TrackInfo > trackInfos)
         lockTrack(m_document->tracksCount() - i - 1, m_document->trackInfoAt(i).isLocked, false);
     }
 
-    QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
     viewport()->update();
+    emit trackHeightChanged();
 }
 
 void CustomTrackView::slotSwitchTrackAudio(int ix)
@@ -4929,13 +4936,18 @@ bool CustomTrackView::addGuide(const GenTime pos, const QString &comment)
     return true;
 }
 
-void CustomTrackView::slotAddGuide()
+void CustomTrackView::slotAddGuide(bool dialog)
 {
     CommentedTime marker(GenTime(m_cursorPos, m_document->fps()), i18n("Guide"));
-    MarkerDialog d(NULL, marker, m_document->timecode(), i18n("Add Guide"), this);
-    if (d.exec() != QDialog::Accepted) return;
-    if (addGuide(d.newMarker().time(), d.newMarker().comment())) {
-        EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), d.newMarker().time(), d.newMarker().comment(), false);
+    if (dialog) {
+        MarkerDialog d(NULL, marker, m_document->timecode(), i18n("Add Guide"), this);
+        if (d.exec() != QDialog::Accepted) return;
+        marker.setComment(d.newMarker().comment());
+    } else {
+        marker.setComment(m_document->timecode().getDisplayTimecodeFromFrames(m_cursorPos, false));
+    }
+    if (addGuide(marker.time(), marker.comment())) {
+        EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), marker.time(), marker.comment(), false);
         m_commandStack->push(command);
     }
 }
@@ -5806,6 +5818,11 @@ void CustomTrackView::doSplitAudio(const GenTime &pos, int track, bool split)
     if (split) {
         int start = pos.frames(m_document->fps());
         int freetrack = m_document->tracksCount() - track - 1;
+
+        // do not split audio when we are on an audio track
+        if (m_document->trackInfoAt(freetrack).type == AUDIOTRACK)
+            return;
+
         for (; freetrack > 0; freetrack--) {
             kDebug() << "// CHK DOC TRK:" << freetrack << ", DUR:" << m_document->renderer()->mltTrackDuration(freetrack);
             if (m_document->trackInfoAt(freetrack - 1).type == AUDIOTRACK && !m_document->trackInfoAt(freetrack - 1).isLocked) {