change: change code style to Linux style except indent.
This commit is contained in:
@@ -22,13 +22,14 @@
|
||||
|
||||
#include "node/block/transition/transition.h"
|
||||
|
||||
namespace olive {
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const int TimelineTool::kDefaultDistanceFromOutput = -4;
|
||||
|
||||
TimelineTool::TimelineTool(TimelineWidget *parent) :
|
||||
dragging_(false),
|
||||
parent_(parent)
|
||||
TimelineTool::TimelineTool(TimelineWidget *parent)
|
||||
: dragging_(false)
|
||||
, parent_(parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,110 +39,116 @@ TimelineTool::~TimelineTool()
|
||||
|
||||
TimelineWidget *TimelineTool::parent()
|
||||
{
|
||||
return parent_;
|
||||
return parent_;
|
||||
}
|
||||
|
||||
Sequence *TimelineTool::sequence()
|
||||
{
|
||||
return parent_->sequence();
|
||||
return parent_->sequence();
|
||||
}
|
||||
|
||||
Timeline::MovementMode TimelineTool::FlipTrimMode(const Timeline::MovementMode &trim_mode)
|
||||
Timeline::MovementMode
|
||||
TimelineTool::FlipTrimMode(const Timeline::MovementMode &trim_mode)
|
||||
{
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
return Timeline::kTrimOut;
|
||||
}
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
return Timeline::kTrimOut;
|
||||
}
|
||||
|
||||
if (trim_mode == Timeline::kTrimOut) {
|
||||
return Timeline::kTrimIn;
|
||||
}
|
||||
if (trim_mode == Timeline::kTrimOut) {
|
||||
return Timeline::kTrimIn;
|
||||
}
|
||||
|
||||
return trim_mode;
|
||||
return trim_mode;
|
||||
}
|
||||
|
||||
rational TimelineTool::SnapMovementToTimebase(const rational &start, rational movement, const rational &timebase)
|
||||
rational TimelineTool::SnapMovementToTimebase(const rational &start,
|
||||
rational movement,
|
||||
const rational &timebase)
|
||||
{
|
||||
rational proposed_position = start + movement;
|
||||
rational snapped = Timecode::snap_time_to_timebase(proposed_position, timebase);
|
||||
rational proposed_position = start + movement;
|
||||
rational snapped =
|
||||
Timecode::snap_time_to_timebase(proposed_position, timebase);
|
||||
|
||||
if (proposed_position != snapped) {
|
||||
movement += snapped - proposed_position;
|
||||
}
|
||||
if (proposed_position != snapped) {
|
||||
movement += snapped - proposed_position;
|
||||
}
|
||||
|
||||
return movement;
|
||||
return movement;
|
||||
}
|
||||
|
||||
rational TimelineTool::ValidateTimeMovement(rational movement)
|
||||
{
|
||||
bool first_ghost = true;
|
||||
bool first_ghost = true;
|
||||
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||
if (ghost->GetMode() != Timeline::kMove) {
|
||||
continue;
|
||||
}
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
if (ghost->GetMode() != Timeline::kMove) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Prevents any ghosts from going below 0:00:00 time
|
||||
if (ghost->GetIn() + movement < 0) {
|
||||
movement = -ghost->GetIn();
|
||||
} else if (first_ghost) {
|
||||
// Ensure ghost is snapped to a grid
|
||||
movement = SnapMovementToTimebase(ghost->GetIn(), movement, parent()->GetTimebaseForTrackType(ghost->GetTrack().type()));
|
||||
// Prevents any ghosts from going below 0:00:00 time
|
||||
if (ghost->GetIn() + movement < 0) {
|
||||
movement = -ghost->GetIn();
|
||||
} else if (first_ghost) {
|
||||
// Ensure ghost is snapped to a grid
|
||||
movement = SnapMovementToTimebase(
|
||||
ghost->GetIn(), movement,
|
||||
parent()->GetTimebaseForTrackType(ghost->GetTrack().type()));
|
||||
|
||||
first_ghost = false;
|
||||
}
|
||||
}
|
||||
first_ghost = false;
|
||||
}
|
||||
}
|
||||
|
||||
return movement;
|
||||
return movement;
|
||||
}
|
||||
|
||||
int TimelineTool::ValidateTrackMovement(int movement, const QVector<TimelineViewGhostItem*>& ghosts)
|
||||
int TimelineTool::ValidateTrackMovement(
|
||||
int movement, const QVector<TimelineViewGhostItem *> &ghosts)
|
||||
{
|
||||
foreach (TimelineViewGhostItem* ghost, ghosts) {
|
||||
if (ghost->GetMode() != Timeline::kMove) {
|
||||
continue;
|
||||
}
|
||||
foreach (TimelineViewGhostItem *ghost, ghosts) {
|
||||
if (ghost->GetMode() != Timeline::kMove) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ghost->GetCanMoveTracks()) {
|
||||
if (!ghost->GetCanMoveTracks()) {
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
} else if (ghost->GetTrack().index() + movement < 0) {
|
||||
// Prevents any ghosts from going to a non-existent negative track
|
||||
movement = -ghost->GetTrack().index();
|
||||
}
|
||||
}
|
||||
|
||||
} else if (ghost->GetTrack().index() + movement < 0) {
|
||||
|
||||
// Prevents any ghosts from going to a non-existent negative track
|
||||
movement = -ghost->GetTrack().index();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return movement;
|
||||
return movement;
|
||||
}
|
||||
|
||||
void TimelineTool::GetGhostData(rational *earliest_point, rational *latest_point)
|
||||
void TimelineTool::GetGhostData(rational *earliest_point,
|
||||
rational *latest_point)
|
||||
{
|
||||
rational ep = RATIONAL_MAX;
|
||||
rational lp = RATIONAL_MIN;
|
||||
rational ep = RATIONAL_MAX;
|
||||
rational lp = RATIONAL_MIN;
|
||||
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||
ep = qMin(ep, ghost->GetAdjustedIn());
|
||||
lp = qMax(lp, ghost->GetAdjustedOut());
|
||||
}
|
||||
foreach (TimelineViewGhostItem *ghost, parent()->GetGhostItems()) {
|
||||
ep = qMin(ep, ghost->GetAdjustedIn());
|
||||
lp = qMax(lp, ghost->GetAdjustedOut());
|
||||
}
|
||||
|
||||
if (earliest_point) {
|
||||
*earliest_point = ep;
|
||||
}
|
||||
if (earliest_point) {
|
||||
*earliest_point = ep;
|
||||
}
|
||||
|
||||
if (latest_point) {
|
||||
*latest_point = lp;
|
||||
}
|
||||
if (latest_point) {
|
||||
*latest_point = lp;
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineTool::InsertGapsAtGhostDestination(olive::MultiUndoCommand *command)
|
||||
{
|
||||
rational earliest_point, latest_point;
|
||||
rational earliest_point, latest_point;
|
||||
|
||||
GetGhostData(&earliest_point, &latest_point);
|
||||
GetGhostData(&earliest_point, &latest_point);
|
||||
|
||||
parent()->InsertGapsAt(earliest_point, latest_point - earliest_point, command);
|
||||
parent()->InsertGapsAt(earliest_point, latest_point - earliest_point,
|
||||
command);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user