implemented basic trimming

This commit is contained in:
itsmattkc
2019-08-22 13:06:21 +10:00
parent 0ede7bd319
commit 51a441bc29
7 changed files with 118 additions and 21 deletions
+5 -2
View File
@@ -22,11 +22,15 @@
#include <QMimeData>
#include "common/qtversionabstraction.h"
#include "node/input/media/media.h"
TimelineView::ImportTool::ImportTool(TimelineView *parent) :
Tool(parent)
{
// Calculate width used for importing to give ghosts a slight lead-in so the ghosts aren't right on the cursor
QFontMetrics fm = parent->fontMetrics();
import_pre_buffer_ = QFontMetricsWidth(&fm, "HHHHHHHH");
}
void TimelineView::ImportTool::DragEnter(QDragEnterEvent *event)
@@ -51,8 +55,7 @@ void TimelineView::ImportTool::DragEnter(QDragEnterEvent *event)
drag_start_ = GetScenePos(event->pos());
// Set ghosts to start where the cursor entered
// FIXME: 100 = magic number so that imported clips are not right on the cursor when dragged in
rational ghost_start = parent()->SceneToTime(drag_start_.x() - 100);
rational ghost_start = parent()->SceneToTime(drag_start_.x() - import_pre_buffer_);
while (!stream.atEnd()) {
stream >> r >> item_ptr;