timeline: moved tools to separate source files
This commit is contained in:
@@ -72,7 +72,6 @@ void AddTool::MousePress(TimelineViewMouseEvent *event)
|
|||||||
ghost_->SetIn(drag_start_point_);
|
ghost_->SetIn(drag_start_point_);
|
||||||
ghost_->SetOut(drag_start_point_);
|
ghost_->SetOut(drag_start_point_);
|
||||||
ghost_->SetTrack(track);
|
ghost_->SetTrack(track);
|
||||||
ghost_->SetYCoords(parent()->GetTrackY(track), parent()->GetTrackHeight(track));
|
|
||||||
parent()->AddGhost(ghost_);
|
parent()->AddGhost(ghost_);
|
||||||
|
|
||||||
snap_points_.append(drag_start_point_);
|
snap_points_.append(drag_start_point_);
|
||||||
@@ -90,7 +89,7 @@ void AddTool::MouseMove(TimelineViewMouseEvent *event)
|
|||||||
|
|
||||||
void AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
void AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||||
{
|
{
|
||||||
const TrackReference& track = ghost_->Track();
|
const TrackReference& track = ghost_->GetTrack();
|
||||||
|
|
||||||
if (ghost_) {
|
if (ghost_) {
|
||||||
if (!ghost_->GetAdjustedLength().isNull()) {
|
if (!ghost_->GetAdjustedLength().isNull()) {
|
||||||
|
|||||||
@@ -38,8 +38,18 @@ void EditTool::MousePress(TimelineViewMouseEvent *event)
|
|||||||
void EditTool::MouseMove(TimelineViewMouseEvent *event)
|
void EditTool::MouseMove(TimelineViewMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (dragging_) {
|
if (dragging_) {
|
||||||
|
rational end_frame = event->GetFrame(true);
|
||||||
|
|
||||||
|
if (Core::instance()->snapping()) {
|
||||||
|
rational movement;
|
||||||
|
parent()->SnapPoint({end_frame}, &movement);
|
||||||
|
if (!movement.isNull()) {
|
||||||
|
end_frame += movement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parent()->SetSelections(start_selections_);
|
parent()->SetSelections(start_selections_);
|
||||||
parent()->AddSelection(TimeRange(start_coord_.GetFrame(), event->GetFrame()),
|
parent()->AddSelection(TimeRange(start_coord_.GetFrame(), end_frame),
|
||||||
start_coord_.GetTrack());
|
start_coord_.GetTrack());
|
||||||
} else {
|
} else {
|
||||||
start_selections_ = parent()->GetSelections();
|
start_selections_ = parent()->GetSelections();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "beam.h"
|
#include "beam.h"
|
||||||
#include "tool.h"
|
#include "tool.h"
|
||||||
|
#include "widget/timelinewidget/timelinewidgetselections.h"
|
||||||
|
|
||||||
OLIVE_NAMESPACE_ENTER
|
OLIVE_NAMESPACE_ENTER
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ public:
|
|||||||
virtual void MouseDoubleClick(TimelineViewMouseEvent *event) override;
|
virtual void MouseDoubleClick(TimelineViewMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<TrackReference, TimeRangeList> start_selections_;
|
TimelineWidgetSelections start_selections_;
|
||||||
|
|
||||||
TimelineCoordinate start_coord_;
|
TimelineCoordinate start_coord_;
|
||||||
|
|
||||||
|
|||||||
@@ -142,9 +142,6 @@ void ImportTool::DragMove(TimelineViewMouseEvent *event)
|
|||||||
ghost->SetOutAdjustment(time_movement);
|
ghost->SetOutAdjustment(time_movement);
|
||||||
ghost->SetTrackAdjustment(track_movement);
|
ghost->SetTrackAdjustment(track_movement);
|
||||||
|
|
||||||
TrackReference adjusted_track = ghost->GetAdjustedTrack();
|
|
||||||
ghost->SetYCoords(parent()->GetTrackY(adjusted_track), parent()->GetTrackHeight(adjusted_track));
|
|
||||||
|
|
||||||
earliest_ghost = qMin(earliest_ghost, ghost->GetAdjustedIn());
|
earliest_ghost = qMin(earliest_ghost, ghost->GetAdjustedIn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +255,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
|||||||
// Increment track count for this track type
|
// Increment track count for this track type
|
||||||
track_offsets[track_type]++;
|
track_offsets[track_type]++;
|
||||||
|
|
||||||
ghost->setData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(stream));
|
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(stream));
|
||||||
ghost->SetMode(Timeline::kMove);
|
ghost->SetMode(Timeline::kMove);
|
||||||
|
|
||||||
footage_ghosts.append(ghost);
|
footage_ghosts.append(ghost);
|
||||||
@@ -404,7 +401,7 @@ void ImportTool::DropGhosts(bool insert)
|
|||||||
for (int i=0;i<parent()->GetGhostItems().size();i++) {
|
for (int i=0;i<parent()->GetGhostItems().size();i++) {
|
||||||
TimelineViewGhostItem* ghost = parent()->GetGhostItems().at(i);
|
TimelineViewGhostItem* ghost = parent()->GetGhostItems().at(i);
|
||||||
|
|
||||||
StreamPtr footage_stream = ghost->data(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
StreamPtr footage_stream = ghost->GetData(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
||||||
|
|
||||||
ClipBlock* clip = new ClipBlock();
|
ClipBlock* clip = new ClipBlock();
|
||||||
clip->set_media_in(ghost->GetMediaIn());
|
clip->set_media_in(ghost->GetMediaIn());
|
||||||
@@ -463,7 +460,7 @@ void ImportTool::DropGhosts(bool insert)
|
|||||||
|
|
||||||
// Link any clips so far that share the same Footage with this one
|
// Link any clips so far that share the same Footage with this one
|
||||||
for (int j=0;j<i;j++) {
|
for (int j=0;j<i;j++) {
|
||||||
StreamPtr footage_compare = parent()->GetGhostItems().at(j)->data(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
StreamPtr footage_compare = parent()->GetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
||||||
|
|
||||||
if (footage_compare->footage() == footage_stream->footage()) {
|
if (footage_compare->footage() == footage_stream->footage()) {
|
||||||
Block::Link(block_items.at(j), clip);
|
Block::Link(block_items.at(j), clip);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If this item is already selected, no further selection needs to be made
|
// If this item is already selected, no further selection needs to be made
|
||||||
if (parent()->IsItemSelected(clicked_item_)) {
|
if (parent()->IsBlockSelected(clicked_item_->block())) {
|
||||||
|
|
||||||
// Collect item deselections
|
// Collect item deselections
|
||||||
QList<Block*> deselected_blocks;
|
QList<Block*> deselected_blocks;
|
||||||
@@ -93,7 +93,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit parent()->BlocksDeselected(deselected_blocks);
|
parent()->SignalDeselectedBlocks(deselected_blocks);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
|
|||||||
selected_blocks.append(clicked_item_->block()->linked_clips().toList());
|
selected_blocks.append(clicked_item_->block()->linked_clips().toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
emit parent()->BlocksSelected(selected_blocks);
|
parent()->SignalSelectedBlocks(selected_blocks);
|
||||||
|
|
||||||
} else if (event->GetButton() == Qt::LeftButton) {
|
} else if (event->GetButton() == Qt::LeftButton) {
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ void PointerTool::HoverMove(TimelineViewMouseEvent *event)
|
|||||||
void SetGhostToSlideMode(TimelineViewGhostItem* g)
|
void SetGhostToSlideMode(TimelineViewGhostItem* g)
|
||||||
{
|
{
|
||||||
g->SetCanMoveTracks(false);
|
g->SetCanMoveTracks(false);
|
||||||
g->setData(TimelineViewGhostItem::kGhostIsSliding, true);
|
g->SetData(TimelineViewGhostItem::kGhostIsSliding, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PointerTool::InitiateDragInternal(TimelineViewBlockItem *clicked_item,
|
void PointerTool::InitiateDragInternal(TimelineViewBlockItem *clicked_item,
|
||||||
@@ -427,16 +427,16 @@ void PointerTool::InitiateDragInternal(TimelineViewBlockItem *clicked_item,
|
|||||||
|
|
||||||
// If we have an adjacent block (for any reason), this is a roll edit and the adjacent is
|
// If we have an adjacent block (for any reason), this is a roll edit and the adjacent is
|
||||||
// expected to fill the remaining space (no gap needs to be created)
|
// expected to fill the remaining space (no gap needs to be created)
|
||||||
ghost->setData(TimelineViewGhostItem::kTrimIsARollEdit, static_cast<bool>(adjacent));
|
ghost->SetData(TimelineViewGhostItem::kTrimIsARollEdit, static_cast<bool>(adjacent));
|
||||||
|
|
||||||
if (adjacent_ghost) {
|
if (adjacent_ghost) {
|
||||||
if (treat_trim_as_slide) {
|
if (treat_trim_as_slide) {
|
||||||
// We're sliding a transition rather than a pure trim/roll
|
// We're sliding a transition rather than a pure trim/roll
|
||||||
SetGhostToSlideMode(adjacent_ghost);
|
SetGhostToSlideMode(adjacent_ghost);
|
||||||
} else if (block->type() == Block::kGap) {
|
} else if (block->type() == Block::kGap) {
|
||||||
ghost->setData(TimelineViewGhostItem::kTrimShouldBeIgnored, true);
|
ghost->SetData(TimelineViewGhostItem::kTrimShouldBeIgnored, true);
|
||||||
} else {
|
} else {
|
||||||
adjacent_ghost->setData(TimelineViewGhostItem::kTrimShouldBeIgnored, true);
|
adjacent_ghost->SetData(TimelineViewGhostItem::kTrimShouldBeIgnored, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -472,7 +472,7 @@ void PointerTool::ProcessDrag(const TimelineCoordinate &mouse_pos)
|
|||||||
{
|
{
|
||||||
QVector<TimelineViewGhostItem*> validate_track_ghosts = parent()->GetGhostItems();
|
QVector<TimelineViewGhostItem*> validate_track_ghosts = parent()->GetGhostItems();
|
||||||
for (int i=0;i<validate_track_ghosts.size();i++) {
|
for (int i=0;i<validate_track_ghosts.size();i++) {
|
||||||
if (validate_track_ghosts.at(i)->Track().type() != drag_track_type_) {
|
if (validate_track_ghosts.at(i)->GetTrack().type() != drag_track_type_) {
|
||||||
validate_track_ghosts.removeAt(i);
|
validate_track_ghosts.removeAt(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@@ -498,11 +498,8 @@ void PointerTool::ProcessDrag(const TimelineCoordinate &mouse_pos)
|
|||||||
|
|
||||||
// Track movement is only legal for moving, not for trimming
|
// Track movement is only legal for moving, not for trimming
|
||||||
// Also, we only move the clips on the same track type that the drag started from
|
// Also, we only move the clips on the same track type that the drag started from
|
||||||
if (ghost->Track().type() == drag_track_type_) {
|
if (ghost->GetTrack().type() == drag_track_type_) {
|
||||||
ghost->SetTrackAdjustment(track_movement);
|
ghost->SetTrackAdjustment(track_movement);
|
||||||
|
|
||||||
const TrackReference& track = ghost->GetAdjustedTrack();
|
|
||||||
ghost->SetYCoords(parent()->GetTrackY(track), parent()->GetTrackHeight(track));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -534,9 +531,9 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
// Sort ghosts depending on which ones are trimming, which are moving, and which are sliding
|
// Sort ghosts depending on which ones are trimming, which are moving, and which are sliding
|
||||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||||
if (ghost->HasBeenAdjusted()) {
|
if (ghost->HasBeenAdjusted()) {
|
||||||
Block* b = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
|
Block* b = Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||||
|
|
||||||
if (ghost->data(TimelineViewGhostItem::kGhostIsSliding).toBool()) {
|
if (ghost->GetData(TimelineViewGhostItem::kGhostIsSliding).toBool()) {
|
||||||
blocks_sliding.append({ghost, b});
|
blocks_sliding.append({ghost, b});
|
||||||
} else if (ghost->GetMode() == Timeline::kMove) {
|
} else if (ghost->GetMode() == Timeline::kMove) {
|
||||||
blocks_moving.append({ghost, b});
|
blocks_moving.append({ghost, b});
|
||||||
@@ -560,7 +557,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
foreach (const GhostBlockPair& p, blocks_trimming) {
|
foreach (const GhostBlockPair& p, blocks_trimming) {
|
||||||
TimelineViewGhostItem* ghost = p.ghost;
|
TimelineViewGhostItem* ghost = p.ghost;
|
||||||
|
|
||||||
if (!ghost->data(TimelineViewGhostItem::kTrimShouldBeIgnored).toBool()) {
|
if (!ghost->GetData(TimelineViewGhostItem::kTrimShouldBeIgnored).toBool()) {
|
||||||
// Must be an ordinary trim/roll
|
// Must be an ordinary trim/roll
|
||||||
BlockTrimCommand* c = new BlockTrimCommand(parent()->GetTrackFromReference(ghost->GetAdjustedTrack()),
|
BlockTrimCommand* c = new BlockTrimCommand(parent()->GetTrackFromReference(ghost->GetAdjustedTrack()),
|
||||||
p.block,
|
p.block,
|
||||||
@@ -568,7 +565,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
ghost->GetMode(),
|
ghost->GetMode(),
|
||||||
command);
|
command);
|
||||||
|
|
||||||
c->SetTrimIsARollEdit(ghost->data(TimelineViewGhostItem::kTrimIsARollEdit).toBool());
|
c->SetTrimIsARollEdit(ghost->GetData(TimelineViewGhostItem::kTrimIsARollEdit).toBool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,6 +615,12 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
p.ghost->GetAdjustedIn(),
|
p.ghost->GetAdjustedIn(),
|
||||||
command);
|
command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust selections
|
||||||
|
TimelineWidgetSelections new_sel = parent()->GetSelections();
|
||||||
|
new_sel.ShiftTime(blocks_moving.first().ghost->GetInAdjustment());
|
||||||
|
new_sel.ShiftTracks(drag_track_type_, blocks_moving.first().ghost->GetTrackAdjustment());
|
||||||
|
new TimelineSetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), command);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!blocks_sliding.isEmpty()) {
|
if (!blocks_sliding.isEmpty()) {
|
||||||
@@ -630,7 +633,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
rational movement;
|
rational movement;
|
||||||
|
|
||||||
foreach (const GhostBlockPair& p, blocks_sliding) {
|
foreach (const GhostBlockPair& p, blocks_sliding) {
|
||||||
const TrackReference& track = p.ghost->Track();
|
const TrackReference& track = p.ghost->GetTrack();
|
||||||
|
|
||||||
switch (p.ghost->GetMode()) {
|
switch (p.ghost->GetMode()) {
|
||||||
case Timeline::kNone:
|
case Timeline::kNone:
|
||||||
@@ -675,6 +678,11 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
movement,
|
movement,
|
||||||
command);
|
command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adjust selections
|
||||||
|
TimelineWidgetSelections new_sel = parent()->GetSelections();
|
||||||
|
new_sel.ShiftTime(movement);
|
||||||
|
new TimelineSetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,16 +721,13 @@ TimelineViewGhostItem* PointerTool::AddGhostFromBlock(Block* block, const TrackR
|
|||||||
{
|
{
|
||||||
if (check_if_exists) {
|
if (check_if_exists) {
|
||||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||||
if (Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock)) == block) {
|
if (Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)) == block) {
|
||||||
return ghost;
|
return ghost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineViewGhostItem* ghost = TimelineViewGhostItem::FromBlock(block,
|
TimelineViewGhostItem* ghost = TimelineViewGhostItem::FromBlock(block, track);
|
||||||
track,
|
|
||||||
parent()->GetTrackY(track),
|
|
||||||
parent()->GetTrackHeight(track));
|
|
||||||
|
|
||||||
#ifdef HIDE_GAP_GHOSTS
|
#ifdef HIDE_GAP_GHOSTS
|
||||||
if (block->type() == Block::kGap) {
|
if (block->type() == Block::kGap) {
|
||||||
@@ -742,7 +747,6 @@ TimelineViewGhostItem* PointerTool::AddGhostFromNull(const rational &in, const r
|
|||||||
ghost->SetIn(in);
|
ghost->SetIn(in);
|
||||||
ghost->SetOut(out);
|
ghost->SetOut(out);
|
||||||
ghost->SetTrack(track);
|
ghost->SetTrack(track);
|
||||||
ghost->SetYCoords(parent()->GetTrackY(track), parent()->GetTrackHeight(track));
|
|
||||||
|
|
||||||
#ifdef HIDE_GAP_GHOSTS
|
#ifdef HIDE_GAP_GHOSTS
|
||||||
ghost->SetInvisible(true);
|
ghost->SetInvisible(true);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void RippleTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
|||||||
bool ghost_on_this_track_exists = false;
|
bool ghost_on_this_track_exists = false;
|
||||||
|
|
||||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||||
if (parent()->GetTrackFromReference(ghost->Track()) == track) {
|
if (parent()->GetTrackFromReference(ghost->GetTrack()) == track) {
|
||||||
ghost_on_this_track_exists = true;
|
ghost_on_this_track_exists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ void RippleTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
|||||||
} else {
|
} else {
|
||||||
// If next is NOT a gap, we'll need to create one, for which we'll use a null ghost
|
// If next is NOT a gap, we'll need to create one, for which we'll use a null ghost
|
||||||
ghost = AddGhostFromNull(block_before_ripple->out(), block_before_ripple->out(), track_ref, trim_mode);
|
ghost = AddGhostFromNull(block_before_ripple->out(), block_before_ripple->out(), track_ref, trim_mode);
|
||||||
ghost->setData(TimelineViewGhostItem::kReferenceBlock, Node::PtrToValue(block_before_ripple));
|
ghost->SetData(TimelineViewGhostItem::kReferenceBlock, Node::PtrToValue(block_before_ripple));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,10 +111,10 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
QVector< QList<TrackListRippleToolCommand::RippleInfo> > info_list(Timeline::kTrackTypeCount);
|
QVector< QList<TrackListRippleToolCommand::RippleInfo> > info_list(Timeline::kTrackTypeCount);
|
||||||
|
|
||||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||||
TrackOutput* track = parent()->GetTrackFromReference(ghost->Track());
|
TrackOutput* track = parent()->GetTrackFromReference(ghost->GetTrack());
|
||||||
|
|
||||||
TrackListRippleToolCommand::RippleInfo i = {Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock)),
|
TrackListRippleToolCommand::RippleInfo i = {Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)),
|
||||||
Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kReferenceBlock)),
|
Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kReferenceBlock)),
|
||||||
track,
|
track,
|
||||||
ghost->GetAdjustedLength(),
|
ghost->GetAdjustedLength(),
|
||||||
ghost->GetLength()};
|
ghost->GetLength()};
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void SlipTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
|
|
||||||
// Find earliest point to ripple around
|
// Find earliest point to ripple around
|
||||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||||
Block* b = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
|
Block* b = Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||||
|
|
||||||
new BlockSetMediaInCommand(b, ghost->GetAdjustedMediaIn(), command);
|
new BlockSetMediaInCommand(b, ghost->GetAdjustedMediaIn(), command);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ int TimelineTool::ValidateTrackMovement(int movement, const QVector<TimelineView
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} else if (ghost->Track().index() + movement < 0) {
|
} else if (ghost->GetTrack().index() + movement < 0) {
|
||||||
|
|
||||||
// Prevents any ghosts from going to a non-existent negative track
|
// Prevents any ghosts from going to a non-existent negative track
|
||||||
movement = -ghost->Track().index();
|
movement = -ghost->GetTrack().index();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,15 +78,14 @@ void TransitionTool::MousePress(TimelineViewMouseEvent *event)
|
|||||||
// Create ghost
|
// Create ghost
|
||||||
ghost_ = new TimelineViewGhostItem();
|
ghost_ = new TimelineViewGhostItem();
|
||||||
ghost_->SetTrack(track);
|
ghost_->SetTrack(track);
|
||||||
ghost_->SetYCoords(parent()->GetTrackY(track), parent()->GetTrackHeight(track));
|
|
||||||
ghost_->SetIn(transition_start_point);
|
ghost_->SetIn(transition_start_point);
|
||||||
ghost_->SetOut(transition_start_point);
|
ghost_->SetOut(transition_start_point);
|
||||||
ghost_->SetMode(trim_mode);
|
ghost_->SetMode(trim_mode);
|
||||||
ghost_->setData(TimelineViewGhostItem::kAttachedBlock, Node::PtrToValue(block_at_time));
|
ghost_->SetData(TimelineViewGhostItem::kAttachedBlock, Node::PtrToValue(block_at_time));
|
||||||
|
|
||||||
dual_transition_ = (other_block);
|
dual_transition_ = (other_block);
|
||||||
if (other_block)
|
if (other_block)
|
||||||
ghost_->setData(TimelineViewGhostItem::kReferenceBlock, Node::PtrToValue(other_block));
|
ghost_->SetData(TimelineViewGhostItem::kReferenceBlock, Node::PtrToValue(other_block));
|
||||||
|
|
||||||
parent()->AddGhost(ghost_);
|
parent()->AddGhost(ghost_);
|
||||||
|
|
||||||
@@ -107,7 +106,7 @@ void TransitionTool::MouseMove(TimelineViewMouseEvent *event)
|
|||||||
|
|
||||||
void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||||
{
|
{
|
||||||
const TrackReference& track = ghost_->Track();
|
const TrackReference& track = ghost_->GetTrack();
|
||||||
|
|
||||||
if (ghost_) {
|
if (ghost_) {
|
||||||
if (!ghost_->GetAdjustedLength().isNull()) {
|
if (!ghost_->GetAdjustedLength().isNull()) {
|
||||||
@@ -138,10 +137,10 @@ void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
|||||||
transition->set_media_in(-ghost_->GetAdjustedLength()/2);
|
transition->set_media_in(-ghost_->GetAdjustedLength()/2);
|
||||||
|
|
||||||
// Block mouse is hovering over
|
// Block mouse is hovering over
|
||||||
Block* active_block = Node::ValueToPtr<Block>(ghost_->data(TimelineViewGhostItem::kAttachedBlock));
|
Block* active_block = Node::ValueToPtr<Block>(ghost_->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||||
|
|
||||||
// Block mouse is next to
|
// Block mouse is next to
|
||||||
Block* friend_block = Node::ValueToPtr<Block>(ghost_->data(TimelineViewGhostItem::kReferenceBlock));
|
Block* friend_block = Node::ValueToPtr<Block>(ghost_->GetData(TimelineViewGhostItem::kReferenceBlock));
|
||||||
|
|
||||||
// Use ghost mode to determine which block is which
|
// Use ghost mode to determine which block is which
|
||||||
Block* out_block = (ghost_->GetMode() == Timeline::kTrimIn) ? friend_block : active_block;
|
Block* out_block = (ghost_->GetMode() == Timeline::kTrimIn) ? friend_block : active_block;
|
||||||
@@ -156,7 +155,7 @@ void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
|||||||
transition->in_block_input(),
|
transition->in_block_input(),
|
||||||
command);
|
command);
|
||||||
} else {
|
} else {
|
||||||
Block* block_to_transition = Node::ValueToPtr<Block>(ghost_->data(TimelineViewGhostItem::kAttachedBlock));
|
Block* block_to_transition = Node::ValueToPtr<Block>(ghost_->GetData(TimelineViewGhostItem::kAttachedBlock));
|
||||||
NodeInput* transition_input_to_connect;
|
NodeInput* transition_input_to_connect;
|
||||||
|
|
||||||
if (ghost_->GetMode() == Timeline::kTrimIn) {
|
if (ghost_->GetMode() == Timeline::kTrimIn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user