timeline: various work to improve timeline behavior, particularly when dealing with transitions

This commit is contained in:
itsmattkc
2020-07-22 18:09:57 +10:00
parent 73769d9e85
commit ce353ccbed
16 changed files with 737 additions and 467 deletions
+7 -7
View File
@@ -73,9 +73,9 @@ TimelineViewBlockItem *TimelineWidget::Tool::GetItemAtScenePos(const TimelineCoo
return nullptr;
}
rational TimelineWidget::Tool::ValidateTimeMovement(rational movement, const QVector<TimelineViewGhostItem *> ghosts)
rational TimelineWidget::Tool::ValidateTimeMovement(rational movement)
{
foreach (TimelineViewGhostItem* ghost, ghosts) {
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
if (ghost->mode() != Timeline::kMove) {
continue;
}
@@ -106,7 +106,7 @@ rational TimelineWidget::Tool::ValidateTimeMovement(rational movement, const QVe
return movement;
}
int TimelineWidget::Tool::ValidateTrackMovement(int movement, const QVector<TimelineViewGhostItem *> ghosts)
int TimelineWidget::Tool::ValidateTrackMovement(int movement, const QVector<TimelineViewGhostItem*>& ghosts)
{
foreach (TimelineViewGhostItem* ghost, ghosts) {
if (ghost->mode() != Timeline::kMove) {
@@ -115,7 +115,7 @@ int TimelineWidget::Tool::ValidateTrackMovement(int movement, const QVector<Time
if (!ghost->CanMoveTracks()) {
movement = 0;
return 0;
} else if (ghost->Track().index() + movement < 0) {
@@ -128,7 +128,7 @@ int TimelineWidget::Tool::ValidateTrackMovement(int movement, const QVector<Time
return movement;
}
void TimelineWidget::Tool::GetGhostData(const QVector<TimelineViewGhostItem *> &ghosts, rational *earliest_point, rational *latest_point)
void TimelineWidget::Tool::GetGhostData(rational *earliest_point, rational *latest_point)
{
rational ep = RATIONAL_MAX;
rational lp = RATIONAL_MIN;
@@ -147,11 +147,11 @@ void TimelineWidget::Tool::GetGhostData(const QVector<TimelineViewGhostItem *> &
}
}
void TimelineWidget::Tool::InsertGapsAtGhostDestination(const QVector<TimelineViewGhostItem *> &ghosts, QUndoCommand *command)
void TimelineWidget::Tool::InsertGapsAtGhostDestination(QUndoCommand *command)
{
rational earliest_point, latest_point;
GetGhostData(ghosts, &earliest_point, &latest_point);
GetGhostData(&earliest_point, &latest_point);
parent()->InsertGapsAt(earliest_point, latest_point - earliest_point, command);
}