diff --git a/app/widget/timelinewidget/tool/pointer.cpp b/app/widget/timelinewidget/tool/pointer.cpp index af2a3c667..3d2ffee40 100644 --- a/app/widget/timelinewidget/tool/pointer.cpp +++ b/app/widget/timelinewidget/tool/pointer.cpp @@ -319,33 +319,19 @@ void PointerTool::InitiateDragInternal(Block *clicked_item, } while (b != latest); } } else { - // Prepare for a standard pointer move + // Prepare for a standard pointer move by creating ghosts for them and any related blocks foreach (Block* block, clips) { if (dynamic_cast(block) || dynamic_cast(block)) { // Gaps cannot move, and we handle transitions further down continue; } - // Create ghost - TimelineViewGhostItem* ghost = AddGhostFromBlock(block, - trim_mode); - Q_UNUSED(ghost) + // Create ghost for this block + AddGhostFromBlock(block, trim_mode, true); - // Add transitions if this has any - TransitionBlock* opening_transition = block->in_transition(); - TransitionBlock* closing_transition = block->out_transition(); - - if (opening_transition) { - TimelineViewGhostItem* ot_ghost = AddGhostFromBlock(opening_transition, - trim_mode); - Q_UNUSED(ot_ghost) - } - - if (closing_transition) { - TimelineViewGhostItem* cl_ghost = AddGhostFromBlock(closing_transition, - trim_mode); - Q_UNUSED(cl_ghost) - } + // Create ghosts for this block's transitions if any + AddGhostFromBlock(block->in_transition(), trim_mode, true); + AddGhostFromBlock(block->out_transition(), trim_mode, true); } } @@ -733,6 +719,10 @@ void PointerTool::InitiateDrag(Block *clicked_item, TimelineViewGhostItem* PointerTool::AddGhostFromBlock(Block* block, Timeline::MovementMode mode, bool check_if_exists) { + if (!block) { + return nullptr; + } + if (check_if_exists) { foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) { if (Node::ValueToPtr(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)) == block) { @@ -810,54 +800,6 @@ bool PointerTool::IsClipTrimmable(Block *clip, return true; } -bool PointerTool::AddMovingTransitionsToClipGhost(Block* block, - Timeline::MovementMode movement, - const QVector &selected_items) -{ - // Assume block is a clip and see if it has any transitions - TransitionBlock* transitions[2]; - - if (movement == Timeline::kMove || movement == Timeline::kTrimOut) { - transitions[0] = block->out_transition(); - } else { - transitions[0] = nullptr; - } - - if (movement == Timeline::kMove || movement == Timeline::kTrimIn) { - transitions[1] = block->in_transition(); - } else { - transitions[1] = nullptr; - } - - bool ret = false; - - for (int i=0;i<2;i++) { - if (!transitions[i]) { - continue; - } - - bool found = false; - - foreach (Block* item, selected_items) { - if (item == transitions[i]) { - // Do nothing - found = true; - break; - } - } - - if (!found) { - TimelineViewGhostItem* transition_ghost = AddGhostFromBlock(transitions[i], Timeline::kMove); - - Q_UNUSED(transition_ghost) - - ret = true; - } - } - - return ret; -} - rational PointerTool::ValidateInTrimming(rational movement) { bool first_ghost = true; diff --git a/app/widget/timelinewidget/tool/pointer.h b/app/widget/timelinewidget/tool/pointer.h index f26210bf1..ca23b7fd9 100644 --- a/app/widget/timelinewidget/tool/pointer.h +++ b/app/widget/timelinewidget/tool/pointer.h @@ -107,8 +107,6 @@ private: void ProcessGhostsForRolling(); - bool AddMovingTransitionsToClipGhost(Block *block, Timeline::MovementMode movement, const QVector &selected_items); - bool movement_allowed_; bool trimming_allowed_; bool track_movement_allowed_;