some timeline refactoring, preparing for rewrites
This commit is contained in:
@@ -639,7 +639,7 @@ void ProjectExplorer::DeleteSelected()
|
||||
QVector<Block*> blocks_to_remove;
|
||||
|
||||
foreach (Sequence* s, used_in_sequences) {
|
||||
foreach (TrackOutput* track, s->viewer_output()->GetTracks()) {
|
||||
foreach (Track* track, s->viewer_output()->GetTracks()) {
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
QVector<Node*> deps = b->GetDependencies();
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ void TimeBasedWidget::GoToPrevCut()
|
||||
|
||||
int64_t closest_cut = 0;
|
||||
|
||||
foreach (TrackOutput* track, viewer_node_->GetTracks()) {
|
||||
foreach (Track* track, viewer_node_->GetTracks()) {
|
||||
int64_t this_track_closest_cut = 0;
|
||||
|
||||
foreach (Block* block, track->Blocks()) {
|
||||
@@ -328,7 +328,7 @@ void TimeBasedWidget::GoToNextCut()
|
||||
|
||||
int64_t closest_cut = INT64_MAX;
|
||||
|
||||
foreach (TrackOutput* track, GetConnectedNode()->GetTracks()) {
|
||||
foreach (Track* track, GetConnectedNode()->GetTracks()) {
|
||||
int64_t this_track_closest_cut = Timecode::time_to_timestamp(track->track_length(), timebase());
|
||||
|
||||
if (this_track_closest_cut <= GetTimestamp()) {
|
||||
|
||||
@@ -176,12 +176,6 @@ TimelineWidget::~TimelineWidget()
|
||||
|
||||
void TimelineWidget::Clear()
|
||||
{
|
||||
// Delete all items
|
||||
for (auto iterator=block_items_.begin(); iterator!=block_items_.end(); iterator++) {
|
||||
delete iterator.value();
|
||||
}
|
||||
block_items_.clear();
|
||||
|
||||
// Emit that we've deselected any selected blocks
|
||||
SignalDeselectedAllBlocks();
|
||||
|
||||
@@ -197,14 +191,6 @@ void TimelineWidget::TimebaseChangedEvent(const rational &timebase)
|
||||
|
||||
timecode_label_->setVisible(!timebase.isNull());
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*>::const_iterator iterator;
|
||||
|
||||
for (iterator=block_items_.begin();iterator!=block_items_.end();iterator++) {
|
||||
if (iterator.value()) {
|
||||
iterator.value()->SetTimebase(timebase);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateViewTimebases();
|
||||
}
|
||||
|
||||
@@ -227,14 +213,6 @@ void TimelineWidget::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimeBasedWidget::ScaleChangedEvent(scale);
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*>::const_iterator iterator;
|
||||
|
||||
for (iterator=block_items_.begin();iterator!=block_items_.end();iterator++) {
|
||||
if (iterator.value()) {
|
||||
iterator.value()->SetScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (TimelineAndTrackView* view, views_) {
|
||||
view->view()->SetScale(scale);
|
||||
}
|
||||
@@ -254,7 +232,7 @@ void TimelineWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
SetTimebase(n->video_params().time_base());
|
||||
|
||||
for (int i=0;i<views_.size();i++) {
|
||||
Timeline::TrackType track_type = static_cast<Timeline::TrackType>(i);
|
||||
Track::Type track_type = static_cast<Track::Type>(i);
|
||||
TimelineView* view = views_.at(i)->view();
|
||||
TrackList* track_list = n->track_list(track_type);
|
||||
TrackView* track_view = views_.at(i)->track_view();
|
||||
@@ -263,7 +241,7 @@ void TimelineWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
view->ConnectTrackList(track_list);
|
||||
|
||||
// Defer to the track to make all the block UI items necessary
|
||||
foreach (TrackOutput* track, n->track_list(track_type)->GetTracks()) {
|
||||
foreach (Track* track, n->track_list(track_type)->GetTracks()) {
|
||||
AddTrack(track, track_type);
|
||||
}
|
||||
}
|
||||
@@ -280,7 +258,7 @@ void TimelineWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
|
||||
DeselectAll();
|
||||
|
||||
foreach (TrackOutput* track, n->GetTracks()) {
|
||||
foreach (Track* track, n->GetTracks()) {
|
||||
RemoveTrack(track);
|
||||
}
|
||||
|
||||
@@ -299,24 +277,22 @@ void TimelineWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
void TimelineWidget::CopyNodesToClipboardInternal(QXmlStreamWriter *writer, void* userdata)
|
||||
{
|
||||
// Cache the earliest in point so all copied clips have a "relative" in point that can be pasted anywhere
|
||||
QVector<TimelineViewBlockItem*>& selected = *static_cast<QVector<TimelineViewBlockItem*>*>(userdata);
|
||||
QVector<Block*>& selected = *static_cast<QVector<Block*>*>(userdata);
|
||||
rational earliest_in = RATIONAL_MAX;
|
||||
|
||||
foreach (TimelineViewBlockItem* item, selected) {
|
||||
foreach (Block* item, selected) {
|
||||
Block* block = item->block();
|
||||
|
||||
earliest_in = qMin(earliest_in, block->in());
|
||||
}
|
||||
|
||||
foreach (TimelineViewBlockItem* item, selected) {
|
||||
Block* block = item->block();
|
||||
|
||||
foreach (Block* block, selected) {
|
||||
writer->writeStartElement(QStringLiteral("block"));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("ptr"), QString::number(reinterpret_cast<quintptr>(block)));
|
||||
writer->writeAttribute(QStringLiteral("in"), (block->in() - earliest_in).toString());
|
||||
|
||||
TrackOutput* track = TrackOutput::TrackFromBlock(block);
|
||||
Track* track = GetTrackFromBlock(block);
|
||||
|
||||
if (track) {
|
||||
writer->writeAttribute(QStringLiteral("tracktype"), QString::number(track->track_type()));
|
||||
@@ -341,7 +317,7 @@ void TimelineWidget::PasteNodesFromClipboardInternal(QXmlStreamReader *reader, X
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
bpd.in = rational::fromString(attr.value().toString());
|
||||
} else if (attr.name() == QStringLiteral("tracktype")) {
|
||||
bpd.track_type = static_cast<Timeline::TrackType>(attr.value().toInt());
|
||||
bpd.track_type = static_cast<Track::Type>(attr.value().toInt());
|
||||
} else if (attr.name() == QStringLiteral("trackindex")) {
|
||||
bpd.track_index = attr.value().toInt();
|
||||
}
|
||||
@@ -417,7 +393,7 @@ void TimelineWidget::SplitAtPlayhead()
|
||||
bool some_blocks_are_selected = false;
|
||||
|
||||
// Get all blocks at the playhead
|
||||
foreach (TrackOutput* track, GetConnectedNode()->GetTracks()) {
|
||||
foreach (Track* track, GetConnectedNode()->GetTracks()) {
|
||||
Block* b = track->BlockContainingTime(playhead_time);
|
||||
|
||||
if (b && b->type() == Block::kClip) {
|
||||
@@ -464,7 +440,7 @@ void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
|
||||
continue;
|
||||
}
|
||||
|
||||
TrackOutput* original_track = TrackOutput::TrackFromBlock(b);
|
||||
Track* original_track = Track::TrackFromBlock(b);
|
||||
|
||||
new TrackReplaceBlockWithGapCommand(original_track, b, command);
|
||||
|
||||
@@ -505,7 +481,7 @@ void TimelineWidget::DeleteSelected(bool ripple)
|
||||
|
||||
// For transitions, remove them but extend their attached blocks to fill their place
|
||||
foreach (TransitionBlock* transition, transitions_to_delete) {
|
||||
new TransitionRemoveCommand(TrackOutput::TrackFromBlock(transition),
|
||||
new TransitionRemoveCommand(Track::TrackFromBlock(transition),
|
||||
transition,
|
||||
command);
|
||||
|
||||
@@ -538,11 +514,11 @@ void TimelineWidget::IncreaseTrackHeight()
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<TrackOutput*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
QVector<Track*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
|
||||
// Increase the height of each track by one "unit"
|
||||
foreach (TrackOutput* t, all_tracks) {
|
||||
t->SetTrackHeight(t->GetTrackHeight() + TrackOutput::kTrackHeightInterval);
|
||||
foreach (Track* t, all_tracks) {
|
||||
t->SetTrackHeight(t->GetTrackHeight() + Track::kTrackHeightInterval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,11 +528,11 @@ void TimelineWidget::DecreaseTrackHeight()
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<TrackOutput*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
QVector<Track*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
|
||||
// Decrease the height of each track by one "unit"
|
||||
foreach (TrackOutput* t, all_tracks) {
|
||||
t->SetTrackHeight(qMax(t->GetTrackHeight() - TrackOutput::kTrackHeightInterval, TrackOutput::kTrackHeightMinimum));
|
||||
foreach (Track* t, all_tracks) {
|
||||
t->SetTrackHeight(qMax(t->GetTrackHeight() - Track::kTrackHeightInterval, Track::kTrackHeightMinimum));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,9 +664,9 @@ void TimelineWidget::DeleteInToOut(bool ripple)
|
||||
command);
|
||||
|
||||
} else {
|
||||
QVector<TrackOutput*> unlocked_tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
QVector<Track*> unlocked_tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
|
||||
foreach (TrackOutput* track, unlocked_tracks) {
|
||||
foreach (Track* track, unlocked_tracks) {
|
||||
GapBlock* gap = new GapBlock();
|
||||
|
||||
gap->set_length_and_media_out(GetConnectedTimelinePoints()->workarea()->length());
|
||||
@@ -740,9 +716,9 @@ void TimelineWidget::ToggleSelectedEnabled()
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
QVector<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
QVector<Block *> TimelineWidget::GetSelectedBlocks()
|
||||
{
|
||||
QVector<TimelineViewBlockItem *> list(selected_blocks_.size());
|
||||
QVector<Block*> list(selected_blocks_.size());
|
||||
|
||||
for (int i=0; i<selected_blocks_.size(); i++) {
|
||||
list[i] = block_items_.value(selected_blocks_.at(i));
|
||||
@@ -754,14 +730,14 @@ QVector<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
void TimelineWidget::InsertGapsAt(const rational &earliest_point, const rational &insert_length, QUndoCommand *command)
|
||||
{
|
||||
for (int i=0;i<Timeline::kTrackTypeCount;i++) {
|
||||
new TrackListInsertGaps(GetConnectedNode()->track_list(static_cast<Timeline::TrackType>(i)),
|
||||
new TrackListInsertGaps(GetConnectedNode()->track_list(static_cast<Track::Type>(i)),
|
||||
earliest_point,
|
||||
insert_length,
|
||||
command);
|
||||
}
|
||||
}
|
||||
|
||||
TrackOutput *TimelineWidget::GetTrackFromReference(const TrackReference &ref)
|
||||
Track *TimelineWidget::GetTrackFromReference(const TrackReference &ref) const
|
||||
{
|
||||
return GetConnectedNode()->track_list(ref.type())->GetTrackAt(ref.index());
|
||||
}
|
||||
@@ -895,7 +871,6 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
|
||||
// Add item to graphics scene
|
||||
views_.at(track.type())->view()->scene()->addItem(item);
|
||||
|
||||
connect(block, &Block::Refreshed, this, &TimelineWidget::BlockRefreshed);
|
||||
connect(block, &Block::LinksChanged, this, &TimelineWidget::BlockUpdated);
|
||||
connect(block, &Block::LabelChanged, this, &TimelineWidget::BlockUpdated);
|
||||
connect(block, &Block::EnabledChanged, this, &TimelineWidget::BlockUpdated);
|
||||
@@ -911,7 +886,6 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
|
||||
void TimelineWidget::RemoveBlock(Block *b)
|
||||
{
|
||||
// Disconnect all signals
|
||||
disconnect(b, &Block::Refreshed, this, &TimelineWidget::BlockRefreshed);
|
||||
disconnect(b, &Block::LinksChanged, this, &TimelineWidget::BlockUpdated);
|
||||
disconnect(b, &Block::LabelChanged, this, &TimelineWidget::BlockUpdated);
|
||||
disconnect(b, &Block::EnabledChanged, this, &TimelineWidget::BlockUpdated);
|
||||
@@ -932,20 +906,20 @@ void TimelineWidget::RemoveBlock(Block *b)
|
||||
emit BlocksDeselected({b});
|
||||
}
|
||||
|
||||
void TimelineWidget::AddTrack(TrackOutput *track, Timeline::TrackType type)
|
||||
void TimelineWidget::AddTrack(Track *track, Track::Type type)
|
||||
{
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
AddBlock(b, TrackReference(type, track->Index()));
|
||||
}
|
||||
|
||||
connect(track, &TrackOutput::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
connect(track, &TrackOutput::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
connect(track, &Track::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
connect(track, &Track::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
}
|
||||
|
||||
void TimelineWidget::RemoveTrack(TrackOutput *track)
|
||||
void TimelineWidget::RemoveTrack(Track *track)
|
||||
{
|
||||
disconnect(track, &TrackOutput::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
disconnect(track, &TrackOutput::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
disconnect(track, &Track::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
disconnect(track, &Track::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
RemoveBlock(b);
|
||||
@@ -954,7 +928,7 @@ void TimelineWidget::RemoveTrack(TrackOutput *track)
|
||||
|
||||
void TimelineWidget::TrackIndexChanged()
|
||||
{
|
||||
TrackOutput* track = static_cast<TrackOutput*>(sender());
|
||||
Track* track = static_cast<Track*>(sender());
|
||||
TrackReference ref(track->track_type(), track->Index());
|
||||
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
@@ -987,7 +961,7 @@ void TimelineWidget::TrackPreviewUpdated()
|
||||
{
|
||||
QMap<Block*, TimelineViewBlockItem*>::const_iterator i;
|
||||
|
||||
TrackOutput* track = static_cast<TrackOutput*>(sender());
|
||||
Track* track = static_cast<Track*>(sender());
|
||||
TrackReference track_ref(track->track_type(), track->Index());
|
||||
|
||||
for (i=block_items_.constBegin(); i!=block_items_.constEnd(); i++) {
|
||||
@@ -1019,7 +993,7 @@ void TimelineWidget::UpdateTimecodeWidthFromSplitters(QSplitter* s)
|
||||
timecode_label_->setFixedWidth(s->sizes().first() + s->handleWidth());
|
||||
}
|
||||
|
||||
void TimelineWidget::TrackHeightChanged(Timeline::TrackType type, int index, int height)
|
||||
void TimelineWidget::TrackHeightChanged(Track::Type type, int index, int height)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(height)
|
||||
@@ -1195,7 +1169,7 @@ TimelineView *TimelineWidget::GetFirstTimelineView()
|
||||
return views_.first()->view();
|
||||
}
|
||||
|
||||
rational TimelineWidget::GetTimebaseForTrackType(Timeline::TrackType type)
|
||||
rational TimelineWidget::GetTimebaseForTrackType(Track::Type type)
|
||||
{
|
||||
return views_.at(type)->view()->timebase();
|
||||
}
|
||||
@@ -1253,7 +1227,7 @@ QVector<Timeline::EditToInfo> TimelineWidget::GetEditToInfo(const rational& play
|
||||
Timeline::MovementMode mode)
|
||||
{
|
||||
// Get list of unlocked tracks
|
||||
QVector<TrackOutput*> tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
QVector<Track*> tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
|
||||
// Create list to cache nearest times and the blocks at this point
|
||||
QVector<Timeline::EditToInfo> info_list(tracks.size());
|
||||
@@ -1261,7 +1235,7 @@ QVector<Timeline::EditToInfo> TimelineWidget::GetEditToInfo(const rational& play
|
||||
for (int i=0;i<tracks.size();i++) {
|
||||
Timeline::EditToInfo info;
|
||||
|
||||
TrackOutput* track = tracks.at(i);
|
||||
Track* track = tracks.at(i);
|
||||
info.track = track;
|
||||
|
||||
Block* b;
|
||||
@@ -1390,7 +1364,7 @@ void TimelineWidget::ShowSnap(const QList<rational> ×)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::UpdateViewports(const Timeline::TrackType &type)
|
||||
void TimelineWidget::UpdateViewports(const Track::Type &type)
|
||||
{
|
||||
if (type == Timeline::kTrackTypeNone) {
|
||||
foreach (TimelineAndTrackView* tview, views_) {
|
||||
@@ -1475,7 +1449,7 @@ void TimelineWidget::MoveRubberBandSelect(bool enable_selecting, bool select_lin
|
||||
continue;
|
||||
}
|
||||
|
||||
TrackOutput* t = GetTrackFromReference(block_item->Track());
|
||||
Track* t = GetTrackFromReference(block_item->Track());
|
||||
if (t && t->IsLocked()) {
|
||||
continue;
|
||||
}
|
||||
@@ -1515,7 +1489,7 @@ void TimelineWidget::AddSelection(const TimeRange &time, const TrackReference &t
|
||||
UpdateViewports(track.type());
|
||||
}
|
||||
|
||||
void TimelineWidget::AddSelection(TimelineViewBlockItem *item)
|
||||
void TimelineWidget::AddSelection(Block *item)
|
||||
{
|
||||
AddSelection(item->block()->range(), item->Track());
|
||||
}
|
||||
@@ -1527,7 +1501,7 @@ void TimelineWidget::RemoveSelection(const TimeRange &time, const TrackReference
|
||||
UpdateViewports(track.type());
|
||||
}
|
||||
|
||||
void TimelineWidget::RemoveSelection(TimelineViewBlockItem *item)
|
||||
void TimelineWidget::RemoveSelection(Block *item)
|
||||
{
|
||||
RemoveSelection(item->block()->range(), item->Track());
|
||||
}
|
||||
@@ -1539,7 +1513,7 @@ void TimelineWidget::SetSelections(const TimelineWidgetSelections &s)
|
||||
UpdateViewports();
|
||||
}
|
||||
|
||||
TimelineViewBlockItem *TimelineWidget::GetItemAtScenePos(const TimelineCoordinate& coord)
|
||||
Block *TimelineWidget::GetItemAtScenePos(const TimelineCoordinate& coord)
|
||||
{
|
||||
for (auto it=block_items_.cbegin(); it!=block_items_.cend(); it++) {
|
||||
Block* b = it.key();
|
||||
|
||||
@@ -89,7 +89,20 @@ public:
|
||||
|
||||
void ToggleSelectedEnabled();
|
||||
|
||||
QVector<TimelineViewBlockItem*> GetSelectedBlocks();
|
||||
const QVector<Block*>& GetSelectedBlocks() const
|
||||
{
|
||||
return selected_blocks_;
|
||||
}
|
||||
|
||||
Track* GetTrackFromBlock(Block* block) const
|
||||
{
|
||||
return GetTrackFromReference(GetTrackReferenceFromBlock(block));
|
||||
}
|
||||
|
||||
TrackReference GetTrackReferenceFromBlock(Block* block) const
|
||||
{
|
||||
return track_lookup_.value(block);
|
||||
}
|
||||
|
||||
virtual bool SnapPoint(QList<rational> start_times, rational *movement, int snap_points = kSnapAll) override;
|
||||
|
||||
@@ -107,18 +120,13 @@ public:
|
||||
* Requires a float-based scene position. If you have a screen position, use GetScenePos() first to convert it to a
|
||||
* scene position
|
||||
*/
|
||||
TimelineViewBlockItem* GetItemAtScenePos(const TimelineCoordinate &coord);
|
||||
|
||||
const QMap<Block*, TimelineViewBlockItem*>& GetBlockItems() const
|
||||
{
|
||||
return block_items_;
|
||||
}
|
||||
Block* GetItemAtScenePos(const TimelineCoordinate &coord);
|
||||
|
||||
void AddSelection(const TimeRange& time, const TrackReference& track);
|
||||
void AddSelection(TimelineViewBlockItem* item);
|
||||
void AddSelection(Block* item);
|
||||
|
||||
void RemoveSelection(const TimeRange& time, const TrackReference& track);
|
||||
void RemoveSelection(TimelineViewBlockItem* item);
|
||||
void RemoveSelection(Block* item);
|
||||
|
||||
const TimelineWidgetSelections& GetSelections() const
|
||||
{
|
||||
@@ -127,7 +135,7 @@ public:
|
||||
|
||||
void SetSelections(const TimelineWidgetSelections &s);
|
||||
|
||||
TrackOutput* GetTrackFromReference(const TrackReference& ref);
|
||||
Track* GetTrackFromReference(const TrackReference& ref) const;
|
||||
|
||||
void SetViewBeamCursor(const TimelineCoordinate& coord);
|
||||
|
||||
@@ -165,7 +173,7 @@ public:
|
||||
|
||||
TimelineView* GetFirstTimelineView();
|
||||
|
||||
rational GetTimebaseForTrackType(Timeline::TrackType type);
|
||||
rational GetTimebaseForTrackType(Track::Type type);
|
||||
|
||||
const QRect &GetRubberBandGeometry() const;
|
||||
|
||||
@@ -218,7 +226,7 @@ protected:
|
||||
struct BlockPasteData {
|
||||
Block* block;
|
||||
rational in;
|
||||
Timeline::TrackType track_type;
|
||||
Track::Type track_type;
|
||||
int track_index;
|
||||
};
|
||||
|
||||
@@ -231,7 +239,7 @@ private:
|
||||
|
||||
void ShowSnap(const QList<rational>& times);
|
||||
|
||||
void UpdateViewports(const Timeline::TrackType& type = Timeline::kTrackTypeNone);
|
||||
void UpdateViewports(const Track::Type& type = Track::kNone);
|
||||
|
||||
QPoint drag_origin_;
|
||||
|
||||
@@ -251,7 +259,7 @@ private:
|
||||
|
||||
QVector<TimelineViewGhostItem*> ghost_items_;
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*> block_items_;
|
||||
QHash<Block*, TrackReference> track_lookup_;
|
||||
|
||||
QList<TimelineAndTrackView*> views_;
|
||||
|
||||
@@ -283,8 +291,8 @@ private slots:
|
||||
void AddBlock(Block* block, TrackReference track);
|
||||
void RemoveBlock(Block *blocks);
|
||||
|
||||
void AddTrack(TrackOutput* track, Timeline::TrackType type);
|
||||
void RemoveTrack(TrackOutput* track);
|
||||
void AddTrack(Track* track, Track::Type type);
|
||||
void RemoveTrack(Track* track);
|
||||
void TrackIndexChanged();
|
||||
|
||||
/**
|
||||
@@ -303,7 +311,7 @@ private slots:
|
||||
|
||||
void UpdateTimecodeWidthFromSplitters(QSplitter *s);
|
||||
|
||||
void TrackHeightChanged(Timeline::TrackType type, int index, int height);
|
||||
void TrackHeightChanged(Track::Type type, int index, int height);
|
||||
|
||||
void ShowContextMenu();
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void TimelineWidgetSelections::ShiftTime(const rational &diff)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidgetSelections::ShiftTracks(Timeline::TrackType type, int diff)
|
||||
void TimelineWidgetSelections::ShiftTracks(Track::Type type, int diff)
|
||||
{
|
||||
TimelineWidgetSelections cached_selections;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
void ShiftTime(const rational& diff);
|
||||
|
||||
void ShiftTracks(Timeline::TrackType type, int diff);
|
||||
void ShiftTracks(Track::Type type, int diff);
|
||||
|
||||
void TrimIn(const rational& diff);
|
||||
|
||||
|
||||
@@ -40,21 +40,21 @@ void AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
const TrackReference& track = event->GetTrack();
|
||||
|
||||
// Check if track is locked
|
||||
TrackOutput* t = parent()->GetTrackFromReference(track);
|
||||
Track* t = parent()->GetTrackFromReference(track);
|
||||
if (t && t->IsLocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Timeline::TrackType add_type = Timeline::kTrackTypeNone;
|
||||
Track::Type add_type = Track::kNone;
|
||||
|
||||
switch (Core::instance()->GetSelectedAddableObject()) {
|
||||
case olive::Tool::kAddableBars:
|
||||
case olive::Tool::kAddableSolid:
|
||||
case olive::Tool::kAddableTitle:
|
||||
add_type = Timeline::kTrackTypeVideo;
|
||||
add_type = Track::kVideo;
|
||||
break;
|
||||
case olive::Tool::kAddableTone:
|
||||
add_type = Timeline::kTrackTypeAudio;
|
||||
add_type = Track::kAudio;
|
||||
break;
|
||||
case olive::Tool::kAddableEmpty:
|
||||
// Leave as "none", which means this block can be placed on any track
|
||||
@@ -64,7 +64,7 @@ void AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (add_type == Timeline::kTrackTypeNone
|
||||
if (add_type == Track::kNone
|
||||
|| add_type == track.type()) {
|
||||
drag_start_point_ = ValidatedCoordinate(event->GetCoordinates(true)).GetFrame();
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ void EditTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
|
||||
void EditTool::MouseDoubleClick(TimelineViewMouseEvent *event)
|
||||
{
|
||||
TimelineViewBlockItem* item = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
Block* item = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
|
||||
if (item && !parent()->GetTrackFromReference(item->Track())->IsLocked()) {
|
||||
if (item && !parent()->GetTrackFromBlock(item)->IsLocked()) {
|
||||
parent()->AddSelection(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,23 +40,23 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
Timeline::TrackType TrackTypeFromStreamType(Stream::Type stream_type)
|
||||
Track::Type TrackTypeFromStreamType(Stream::Type stream_type)
|
||||
{
|
||||
switch (stream_type) {
|
||||
case Stream::kVideo:
|
||||
return Timeline::kTrackTypeVideo;
|
||||
return Track::kVideo;
|
||||
case Stream::kAudio:
|
||||
return Timeline::kTrackTypeAudio;
|
||||
return Track::kAudio;
|
||||
case Stream::kSubtitle:
|
||||
// Temporarily disabled until we figure out a better thing to do with this
|
||||
//return Timeline::kTrackTypeSubtitle;
|
||||
//return Track::kSubtitle;
|
||||
case Stream::kUnknown:
|
||||
case Stream::kData:
|
||||
case Stream::kAttachment:
|
||||
break;
|
||||
}
|
||||
|
||||
return Timeline::kTrackTypeNone;
|
||||
return Track::kNone;
|
||||
}
|
||||
|
||||
ImportTool::ImportTool(TimelineWidget *parent) :
|
||||
@@ -214,7 +214,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
foreach (const DraggedFootage& footage, footage_list) {
|
||||
|
||||
// Each stream is offset by one track per track "type", we keep track of them in this vector
|
||||
QVector<int> track_offsets(Timeline::kTrackTypeCount);
|
||||
QVector<int> track_offsets(Track::kCount);
|
||||
track_offsets.fill(track_start);
|
||||
|
||||
QVector<TimelineViewGhostItem*> footage_ghosts;
|
||||
@@ -225,13 +225,13 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
|
||||
// Loop through all streams in footage
|
||||
foreach (Stream* stream, footage.footage()->streams()) {
|
||||
Timeline::TrackType track_type = TrackTypeFromStreamType(stream->type());
|
||||
Track::Type track_type = TrackTypeFromStreamType(stream->type());
|
||||
|
||||
quint64 cached_enabled_streams = enabled_streams;
|
||||
enabled_streams >>= 1;
|
||||
|
||||
// Check if this stream has a compatible TrackList
|
||||
if (track_type == Timeline::kTrackTypeNone
|
||||
if (track_type == Track::kNone
|
||||
|| !(cached_enabled_streams & 0x1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
|
||||
}
|
||||
|
||||
// If this item is already selected, no further selection needs to be made
|
||||
if (parent()->IsBlockSelected(clicked_item_->block())) {
|
||||
if (parent()->IsBlockSelected(clicked_item_)) {
|
||||
|
||||
// Collect item deselections
|
||||
QVector<Block*> deselected_blocks;
|
||||
@@ -210,7 +210,7 @@ void PointerTool::HoverMove(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (trimming_allowed_) {
|
||||
// No dragging, but we still want to process cursors
|
||||
TimelineViewBlockItem* block_at_cursor = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
Block* block_at_cursor = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
|
||||
if (block_at_cursor) {
|
||||
switch (IsCursorInTrimHandle(block_at_cursor, event->GetSceneX())) {
|
||||
@@ -237,7 +237,7 @@ void SetGhostToSlideMode(TimelineViewGhostItem* g)
|
||||
g->SetData(TimelineViewGhostItem::kGhostIsSliding, true);
|
||||
}
|
||||
|
||||
void PointerTool::InitiateDragInternal(TimelineViewBlockItem *clicked_item,
|
||||
void PointerTool::InitiateDragInternal(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool dont_roll_trims,
|
||||
bool allow_nongap_rolling,
|
||||
@@ -731,7 +731,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
Timeline::MovementMode PointerTool::IsCursorInTrimHandle(TimelineViewBlockItem *block, qreal cursor_x)
|
||||
Timeline::MovementMode PointerTool::IsCursorInTrimHandle(Block *block, qreal cursor_x)
|
||||
{
|
||||
double kTrimHandle = QtUtils::QFontMetricsWidth(parent()->fontMetrics(), "H");
|
||||
|
||||
@@ -749,7 +749,7 @@ Timeline::MovementMode PointerTool::IsCursorInTrimHandle(TimelineViewBlockItem *
|
||||
}
|
||||
}
|
||||
|
||||
void PointerTool::InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
void PointerTool::InitiateDrag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, false, false, false);
|
||||
@@ -820,7 +820,7 @@ void PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::Movem
|
||||
parent()->AddGhost(ghost);
|
||||
}
|
||||
|
||||
bool PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
bool PointerTool::IsClipTrimmable(Block *clip,
|
||||
const QVector<TimelineViewBlockItem*>& items,
|
||||
const Timeline::MovementMode& mode)
|
||||
{
|
||||
@@ -839,7 +839,7 @@ bool PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
bool PointerTool::AddMovingTransitionsToClipGhost(Block* block,
|
||||
const TrackReference& track,
|
||||
Timeline::MovementMode movement,
|
||||
const QList<TimelineViewBlockItem*>& selected_items)
|
||||
const QVector<Block *> &selected_items)
|
||||
{
|
||||
// Assume block is a clip and see if it has any transitions
|
||||
TransitionBlock* transitions[2];
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
protected:
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event);
|
||||
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode);
|
||||
|
||||
TimelineViewGhostItem* AddGhostFromBlock(Block *block, const TrackReference& track, Timeline::MovementMode mode, bool check_if_exists = false);
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
|
||||
virtual void ProcessDrag(const TimelineCoordinate &mouse_pos);
|
||||
|
||||
void InitiateDragInternal(TimelineViewBlockItem* clicked_item,
|
||||
void InitiateDragInternal(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool dont_roll_trims,
|
||||
bool allow_nongap_rolling, bool slide_instead_of_moving);
|
||||
@@ -95,19 +95,19 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
Timeline::MovementMode IsCursorInTrimHandle(TimelineViewBlockItem* block, qreal cursor_x);
|
||||
Timeline::MovementMode IsCursorInTrimHandle(Block* block, qreal cursor_x);
|
||||
|
||||
void AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::MovementMode mode);
|
||||
|
||||
bool IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
const QVector<TimelineViewBlockItem *> &items,
|
||||
bool IsClipTrimmable(Block* clip,
|
||||
const QVector<Block*> &items,
|
||||
const Timeline::MovementMode& mode);
|
||||
|
||||
void ProcessGhostsForSliding();
|
||||
|
||||
void ProcessGhostsForRolling();
|
||||
|
||||
bool AddMovingTransitionsToClipGhost(Block *block, const TrackReference &track, Timeline::MovementMode movement, const QList<TimelineViewBlockItem *> &selected_items);
|
||||
bool AddMovingTransitionsToClipGhost(Block *block, const TrackReference &track, Timeline::MovementMode movement, const QVector<Block*> &selected_items);
|
||||
|
||||
bool movement_allowed_;
|
||||
bool trimming_allowed_;
|
||||
@@ -116,10 +116,10 @@ private:
|
||||
bool can_rubberband_select_;
|
||||
bool rubberband_selecting_;
|
||||
|
||||
Timeline::TrackType drag_track_type_;
|
||||
Track::Type drag_track_type_;
|
||||
Timeline::MovementMode drag_movement_mode_;
|
||||
|
||||
TimelineViewBlockItem* clicked_item_;
|
||||
Block* clicked_item_;
|
||||
|
||||
QPoint drag_global_start_;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void RazorTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
QVector<Block*> blocks_to_split;
|
||||
|
||||
foreach (const TrackReference& track_ref, split_tracks_) {
|
||||
TrackOutput* track = parent()->GetTrackFromReference(track_ref);
|
||||
Track* track = parent()->GetTrackFromReference(track_ref);
|
||||
|
||||
if (track == nullptr || track->IsLocked()) {
|
||||
continue;
|
||||
|
||||
@@ -33,8 +33,8 @@ RippleTool::RippleTool(TimelineWidget* parent) :
|
||||
SetGapTrimmingAllowed(true);
|
||||
}
|
||||
|
||||
void RippleTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, true, true, false);
|
||||
|
||||
@@ -58,7 +58,7 @@ void RippleTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
}
|
||||
|
||||
// For each track that does NOT have a ghost, we need to make one for Gaps
|
||||
foreach (TrackOutput* track, parent()->GetConnectedNode()->GetTracks()) {
|
||||
foreach (Track* track, parent()->GetConnectedNode()->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
continue;
|
||||
}
|
||||
@@ -109,10 +109,10 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
Q_UNUSED(event)
|
||||
|
||||
if (parent()->HasGhosts()) {
|
||||
QVector< QList<TrackListRippleToolCommand::RippleInfo> > info_list(Timeline::kTrackTypeCount);
|
||||
QVector< QList<TrackListRippleToolCommand::RippleInfo> > info_list(Track::kCount);
|
||||
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||
TrackOutput* track = parent()->GetTrackFromReference(ghost->GetTrack());
|
||||
Track* track = parent()->GetTrackFromReference(ghost->GetTrack());
|
||||
|
||||
TrackListRippleToolCommand::RippleInfo i = {Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)),
|
||||
Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kReferenceBlock)),
|
||||
@@ -127,7 +127,7 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
|
||||
if (!info_list.isEmpty()) {
|
||||
for (int i=0;i<info_list.size();i++) {
|
||||
new TrackListRippleToolCommand(parent()->GetConnectedNode()->track_list(static_cast<Timeline::TrackType>(i)),
|
||||
new TrackListRippleToolCommand(parent()->GetConnectedNode()->track_list(static_cast<Track::Type>(i)),
|
||||
info_list.at(i),
|
||||
drag_movement_mode(),
|
||||
command);
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
protected:
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event) override;
|
||||
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ RollingTool::RollingTool(TimelineWidget* parent) :
|
||||
SetGapTrimmingAllowed(true);
|
||||
}
|
||||
|
||||
void RollingTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
void RollingTool::InitiateDrag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, false, true, false);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
RollingTool(TimelineWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ SlideTool::SlideTool(TimelineWidget* parent) :
|
||||
SetGapTrimmingAllowed(true);
|
||||
}
|
||||
|
||||
void SlideTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
void SlideTool::InitiateDrag(Block *clicked_item, Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, false, true, true);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
SlideTool(TimelineWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode) override;
|
||||
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ TransitionTool::TransitionTool(TimelineWidget *parent) :
|
||||
void TransitionTool::MousePress(TimelineViewMouseEvent *event)
|
||||
{
|
||||
const TrackReference& track = event->GetTrack();
|
||||
TrackOutput* t = parent()->GetTrackFromReference(track);
|
||||
Track* t = parent()->GetTrackFromReference(track);
|
||||
rational cursor_frame = event->GetFrame();
|
||||
|
||||
if (!t || t->IsLocked()) {
|
||||
|
||||
@@ -68,7 +68,7 @@ TrackView::TrackView(Qt::Alignment vertical_alignment, QWidget *parent) :
|
||||
void TrackView::ConnectTrackList(TrackList *list)
|
||||
{
|
||||
if (list_ != nullptr) {
|
||||
foreach (TrackOutput* track, list_->GetTracks()) {
|
||||
foreach (Track* track, list_->GetTracks()) {
|
||||
RemoveTrack(track);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ void TrackView::ConnectTrackList(TrackList *list)
|
||||
list_ = list;
|
||||
|
||||
if (list_ != nullptr) {
|
||||
foreach (TrackOutput* track, list_->GetTracks()) {
|
||||
foreach (Track* track, list_->GetTracks()) {
|
||||
InsertTrack(track);
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ void TrackView::TrackHeightChanged(int index, int height)
|
||||
list_->GetTrackAt(index)->SetTrackHeightInPixels(height);
|
||||
}
|
||||
|
||||
void TrackView::InsertTrack(TrackOutput *track)
|
||||
void TrackView::InsertTrack(Track *track)
|
||||
{
|
||||
splitter_->Insert(track->Index(),
|
||||
track->GetTrackHeightInPixels(),
|
||||
new TrackViewItem(track));
|
||||
}
|
||||
|
||||
void TrackView::RemoveTrack(TrackOutput *track)
|
||||
void TrackView::RemoveTrack(Track *track)
|
||||
{
|
||||
splitter_->Remove(track->Index());
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ private slots:
|
||||
|
||||
void TrackHeightChanged(int index, int height);
|
||||
|
||||
void InsertTrack(TrackOutput* track);
|
||||
void InsertTrack(Track* track);
|
||||
|
||||
void RemoveTrack(TrackOutput* track);
|
||||
void RemoveTrack(Track* track);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
TrackViewItem::TrackViewItem(Track* track, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
track_(track)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
|
||||
label_ = new ClickableLabel();
|
||||
connect(label_, &ClickableLabel::MouseDoubleClicked, this, &TrackViewItem::LabelClicked);
|
||||
connect(track_, &TrackOutput::LabelChanged, this, &TrackViewItem::UpdateLabel);
|
||||
connect(track_, &Track::LabelChanged, this, &TrackViewItem::UpdateLabel);
|
||||
UpdateLabel();
|
||||
stack_->addWidget(label_);
|
||||
|
||||
@@ -51,19 +51,19 @@ TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
stack_->addWidget(line_edit_);
|
||||
|
||||
mute_button_ = CreateMSLButton(tr("M"), Qt::red);
|
||||
connect(mute_button_, &QPushButton::toggled, track_, &TrackOutput::SetMuted);
|
||||
connect(mute_button_, &QPushButton::toggled, track_, &Track::SetMuted);
|
||||
layout->addWidget(mute_button_);
|
||||
|
||||
/*solo_button_ = CreateMSLButton(tr("S"), Qt::yellow);
|
||||
layout->addWidget(solo_button_);*/
|
||||
|
||||
lock_button_ = CreateMSLButton(tr("L"), Qt::gray);
|
||||
connect(lock_button_, &QPushButton::toggled, track_, &TrackOutput::SetLocked);
|
||||
connect(lock_button_, &QPushButton::toggled, track_, &Track::SetLocked);
|
||||
layout->addWidget(lock_button_);
|
||||
|
||||
setMinimumHeight(mute_button_->height());
|
||||
|
||||
connect(track, &TrackOutput::MutedChanged, mute_button_, &QPushButton::setChecked);
|
||||
connect(track, &Track::MutedChanged, mute_button_, &QPushButton::setChecked);
|
||||
}
|
||||
|
||||
QPushButton *TrackViewItem::CreateMSLButton(const QString& text, const QColor& checked_color) const
|
||||
|
||||
@@ -35,7 +35,7 @@ class TrackViewItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackViewItem(TrackOutput* track,
|
||||
TrackViewItem(Track* track,
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
QPushButton* solo_button_;
|
||||
QPushButton* lock_button_;
|
||||
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
private slots:
|
||||
void LabelClicked();
|
||||
|
||||
@@ -69,7 +69,7 @@ void TrackViewSplitter::HandleReceiver(TrackViewSplitterHandle *h, int diff)
|
||||
int new_ele_sz = old_ele_sz + diff;
|
||||
|
||||
// Limit by track minimum height
|
||||
new_ele_sz = qMax(new_ele_sz, TrackOutput::GetMinimumTrackHeightInPixels());
|
||||
new_ele_sz = qMax(new_ele_sz, Track::GetMinimumTrackHeightInPixels());
|
||||
|
||||
if (alignment_ == Qt::AlignBottom) {
|
||||
ele_id = count() - ele_id - 1;
|
||||
|
||||
@@ -99,7 +99,7 @@ void BlockSetMediaInCommand::undo_internal()
|
||||
block_->set_media_in(old_media_in_);
|
||||
}
|
||||
|
||||
TrackRippleRemoveBlockCommand::TrackRippleRemoveBlockCommand(TrackOutput *track, Block *block, QUndoCommand *parent) :
|
||||
TrackRippleRemoveBlockCommand::TrackRippleRemoveBlockCommand(Track *track, Block *block, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block)
|
||||
@@ -126,7 +126,7 @@ void TrackRippleRemoveBlockCommand::undo_internal()
|
||||
}
|
||||
}
|
||||
|
||||
TrackInsertBlockAfterCommand::TrackInsertBlockAfterCommand(TrackOutput *track,
|
||||
TrackInsertBlockAfterCommand::TrackInsertBlockAfterCommand(Track *track,
|
||||
Block *block,
|
||||
Block *before,
|
||||
QUndoCommand *parent) :
|
||||
@@ -152,7 +152,7 @@ void TrackInsertBlockAfterCommand::undo_internal()
|
||||
track_->RippleRemoveBlock(block_);
|
||||
}
|
||||
|
||||
TrackRippleRemoveAreaCommand::TrackRippleRemoveAreaCommand(TrackOutput *track, rational in, rational out, QUndoCommand *parent) :
|
||||
TrackRippleRemoveAreaCommand::TrackRippleRemoveAreaCommand(Track *track, rational in, rational out, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
in_(in),
|
||||
@@ -385,12 +385,12 @@ void TrackPlaceBlockCommand::redo_internal()
|
||||
added_tracks_.resize(track_index_ - timeline_->GetTracks().size() + 1);
|
||||
|
||||
for (int i=0; i<added_tracks_.size(); i++) {
|
||||
added_tracks_[i] = new TrackOutput();
|
||||
added_tracks_[i] = new Track();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<added_tracks_.size(); i++) {
|
||||
TrackOutput* track = added_tracks_.at(i);
|
||||
Track* track = added_tracks_.at(i);
|
||||
track->setParent(timeline_->GetParentGraph());
|
||||
|
||||
timeline_->track_input()->ArrayAppend();
|
||||
@@ -435,14 +435,14 @@ void TrackPlaceBlockCommand::undo_internal()
|
||||
}
|
||||
|
||||
for (int i=added_tracks_.size()-1; i>=0; i--) {
|
||||
TrackOutput* track = added_tracks_.at(i);
|
||||
Track* track = added_tracks_.at(i);
|
||||
Node::DisconnectEdge(track, timeline_->track_input(), timeline_->track_input()->ArraySize() - 1);
|
||||
track->setParent(&memory_manager_);
|
||||
timeline_->track_input()->ArrayRemoveLast();
|
||||
}
|
||||
}
|
||||
|
||||
BlockSplitCommand::BlockSplitCommand(TrackOutput* track, Block *block, rational point, QUndoCommand *parent) :
|
||||
BlockSplitCommand::BlockSplitCommand(Track* track, Block *block, rational point, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block),
|
||||
@@ -543,7 +543,7 @@ Block *BlockSplitCommand::new_block()
|
||||
return new_block_;
|
||||
}
|
||||
|
||||
TrackSplitAtTimeCommand::TrackSplitAtTimeCommand(TrackOutput *track, rational point, QUndoCommand *parent) :
|
||||
TrackSplitAtTimeCommand::TrackSplitAtTimeCommand(Track *track, rational point, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track)
|
||||
{
|
||||
@@ -565,7 +565,7 @@ Project *TrackSplitAtTimeCommand::GetRelevantProject() const
|
||||
return static_cast<Sequence*>(track_->parent())->project();
|
||||
}
|
||||
|
||||
TrackReplaceBlockCommand::TrackReplaceBlockCommand(TrackOutput* track, Block *old, Block *replace, QUndoCommand *parent) :
|
||||
TrackReplaceBlockCommand::TrackReplaceBlockCommand(Track* track, Block *old, Block *replace, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
old_(old),
|
||||
@@ -588,7 +588,7 @@ void TrackReplaceBlockCommand::undo_internal()
|
||||
track_->ReplaceBlock(replace_, old_);
|
||||
}
|
||||
|
||||
TrackPrependBlockCommand::TrackPrependBlockCommand(TrackOutput *track, Block *block, QUndoCommand *parent) :
|
||||
TrackPrependBlockCommand::TrackPrependBlockCommand(Track *track, Block *block, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block)
|
||||
@@ -626,7 +626,7 @@ BlockSplitPreservingLinksCommand::BlockSplitPreservingLinksCommand(const QVector
|
||||
Block* b = blocks.at(j);
|
||||
|
||||
if (b->in() < time && b->out() > time) {
|
||||
TrackOutput* track = TrackOutput::TrackFromBlock(b);
|
||||
Track* track = Track::TrackFromBlock(b);
|
||||
|
||||
Q_ASSERT(track);
|
||||
|
||||
@@ -686,7 +686,7 @@ void TimelineRippleDeleteGapsAtRegionsCommand::redo_internal()
|
||||
|
||||
QList<Block*> blocks_around_range;
|
||||
|
||||
foreach (TrackOutput* track, timeline_->GetTracks()) {
|
||||
foreach (Track* track, timeline_->GetTracks()) {
|
||||
// Get the block from every other track that is either at or just before our block's in point
|
||||
Block* block_at_time = track->NearestBlockBeforeOrAt(range.in());
|
||||
|
||||
@@ -706,7 +706,7 @@ void TimelineRippleDeleteGapsAtRegionsCommand::redo_internal()
|
||||
foreach (Block* resize, blocks_around_range) {
|
||||
if (resize->length() == max_ripple_length) {
|
||||
// Remove block entirely
|
||||
TrackRippleRemoveBlockCommand* remove_command = new TrackRippleRemoveBlockCommand(TrackOutput::TrackFromBlock(resize), resize);
|
||||
TrackRippleRemoveBlockCommand* remove_command = new TrackRippleRemoveBlockCommand(Track::TrackFromBlock(resize), resize);
|
||||
remove_command->redo();
|
||||
commands_.append(remove_command);
|
||||
} else {
|
||||
@@ -880,7 +880,7 @@ void BlockEnableDisableCommand::undo_internal()
|
||||
block_->set_enabled(old_enabled_);
|
||||
}
|
||||
|
||||
BlockTrimCommand::BlockTrimCommand(TrackOutput* track, Block *block, rational new_length, Timeline::MovementMode mode, QUndoCommand *command) :
|
||||
BlockTrimCommand::BlockTrimCommand(Track* track, Block *block, rational new_length, Timeline::MovementMode mode, QUndoCommand *command) :
|
||||
UndoCommand(command),
|
||||
track_(track),
|
||||
block_(block),
|
||||
@@ -1045,7 +1045,7 @@ void BlockTrimCommand::undo_internal()
|
||||
track_->Node::InvalidateCache(invalidate_range, track_->block_input());
|
||||
}
|
||||
|
||||
TrackReplaceBlockWithGapCommand::TrackReplaceBlockWithGapCommand(TrackOutput *track, Block *block, QUndoCommand *command) :
|
||||
TrackReplaceBlockWithGapCommand::TrackReplaceBlockWithGapCommand(Track *track, Block *block, QUndoCommand *command) :
|
||||
UndoCommand(command),
|
||||
track_(track),
|
||||
block_(block),
|
||||
@@ -1187,7 +1187,7 @@ void TrackReplaceBlockWithGapCommand::undo_internal()
|
||||
track_->Node::InvalidateCache(TimeRange(block_->in(), block_->out()), track_->block_input());
|
||||
}
|
||||
|
||||
TrackSlideCommand::TrackSlideCommand(TrackOutput* track, const QList<Block*>& moving_blocks, Block *in_adjacent, Block *out_adjacent, const rational& movement, QUndoCommand* parent) :
|
||||
TrackSlideCommand::TrackSlideCommand(Track* track, const QList<Block*>& moving_blocks, Block *in_adjacent, Block *out_adjacent, const rational& movement, QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
blocks_(moving_blocks),
|
||||
@@ -1319,7 +1319,7 @@ TrackListRippleRemoveAreaCommand::TrackListRippleRemoveAreaCommand(TrackList *li
|
||||
{
|
||||
all_tracks_unlocked_ = true;
|
||||
|
||||
foreach (TrackOutput* track, list_->GetTracks()) {
|
||||
foreach (Track* track, list_->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
all_tracks_unlocked_ = false;
|
||||
continue;
|
||||
@@ -1346,13 +1346,13 @@ void TrackListRippleRemoveAreaCommand::redo_internal()
|
||||
if (all_tracks_unlocked_) {
|
||||
// We can optimize here by simply shifting the whole cache forward instead of re-caching
|
||||
// everything following this time
|
||||
if (list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftVideoCache(out_, in_);
|
||||
} else if (list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftAudioCache(out_, in_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
@@ -1362,7 +1362,7 @@ void TrackListRippleRemoveAreaCommand::redo_internal()
|
||||
}
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
@@ -1373,13 +1373,13 @@ void TrackListRippleRemoveAreaCommand::undo_internal()
|
||||
if (all_tracks_unlocked_) {
|
||||
// We can optimize here by simply shifting the whole cache forward instead of re-caching
|
||||
// everything following this time
|
||||
if (list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftVideoCache(in_, out_);
|
||||
} else if (list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftAudioCache(in_, out_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
@@ -1389,7 +1389,7 @@ void TrackListRippleRemoveAreaCommand::undo_internal()
|
||||
}
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
@@ -1399,8 +1399,8 @@ TimelineRippleRemoveAreaCommand::TimelineRippleRemoveAreaCommand(ViewerOutput *t
|
||||
UndoCommand(parent),
|
||||
timeline_(timeline)
|
||||
{
|
||||
for (int i=0; i<Timeline::kTrackTypeCount; i++) {
|
||||
new TrackListRippleRemoveAreaCommand(timeline->track_list(static_cast<Timeline::TrackType>(i)),
|
||||
for (int i=0; i<Track::kCount; i++) {
|
||||
new TrackListRippleRemoveAreaCommand(timeline->track_list(static_cast<Track::Type>(i)),
|
||||
in,
|
||||
out,
|
||||
this);
|
||||
@@ -1506,9 +1506,9 @@ void TrackListRippleToolCommand::redo_internal()
|
||||
}
|
||||
}
|
||||
|
||||
if (track_list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (track_list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftVideoCache(old_latest_pt, new_latest_pt);
|
||||
} else if (track_list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (track_list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftAudioCache(old_latest_pt, new_latest_pt);
|
||||
}
|
||||
|
||||
@@ -1574,7 +1574,7 @@ TrackListInsertGaps::TrackListInsertGaps(TrackList *track_list, const rational &
|
||||
{
|
||||
all_tracks_unlocked_ = true;
|
||||
|
||||
foreach (TrackOutput* track, track_list_->GetTracks()) {
|
||||
foreach (Track* track, track_list_->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
all_tracks_unlocked_ = false;
|
||||
continue;
|
||||
@@ -1593,13 +1593,13 @@ void TrackListInsertGaps::redo_internal()
|
||||
{
|
||||
if (all_tracks_unlocked_) {
|
||||
// Optimize by shifting over since we have a constant amount of time being inserted
|
||||
if (track_list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (track_list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftVideoCache(point_, point_ + length_);
|
||||
} else if (track_list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (track_list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftAudioCache(point_, point_ + length_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
@@ -1607,7 +1607,7 @@ void TrackListInsertGaps::redo_internal()
|
||||
QVector<Block*> blocks_to_split;
|
||||
QVector<Block*> blocks_to_append_gap_to;
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
if (b->type() == Block::kGap && b->in() <= point_ && b->out() >= point_) {
|
||||
// Found a gap at the location
|
||||
@@ -1637,12 +1637,12 @@ void TrackListInsertGaps::redo_internal()
|
||||
GapBlock* gap = new GapBlock();
|
||||
gap->set_length_and_media_out(length_);
|
||||
gap->setParent(block->parent());
|
||||
TrackOutput::TrackFromBlock(block)->InsertBlockAfter(gap, block);
|
||||
Track::TrackFromBlock(block)->InsertBlockAfter(gap, block);
|
||||
gaps_added_.append(gap);
|
||||
}
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
@@ -1652,20 +1652,20 @@ void TrackListInsertGaps::undo_internal()
|
||||
{
|
||||
if (all_tracks_unlocked_) {
|
||||
// Optimize by shifting over since we have a constant amount of time being inserted
|
||||
if (track_list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (track_list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftVideoCache(point_ + length_, point_);
|
||||
} else if (track_list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (track_list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftAudioCache(point_ + length_, point_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove added gaps
|
||||
foreach (GapBlock* gap, gaps_added_) {
|
||||
TrackOutput::TrackFromBlock(gap)->RippleRemoveBlock(gap);
|
||||
Track::TrackFromBlock(gap)->RippleRemoveBlock(gap);
|
||||
gap->setParent(&memory_manager_);
|
||||
}
|
||||
gaps_added_.clear();
|
||||
@@ -1684,13 +1684,13 @@ void TrackListInsertGaps::undo_internal()
|
||||
gaps_to_extend_.clear();
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TransitionRemoveCommand::TransitionRemoveCommand(TrackOutput* track, TransitionBlock *block, QUndoCommand* parent) :
|
||||
TransitionRemoveCommand::TransitionRemoveCommand(Track* track, TransitionBlock *block, QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block),
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
|
||||
class BlockTrimCommand : public UndoCommand {
|
||||
public:
|
||||
BlockTrimCommand(TrackOutput *track, Block* block, rational new_length, Timeline::MovementMode mode, QUndoCommand* command = nullptr);
|
||||
BlockTrimCommand(Track *track, Block* block, rational new_length, Timeline::MovementMode mode, QUndoCommand* command = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
rational old_length_;
|
||||
rational new_length_;
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
|
||||
class TrackRippleRemoveBlockCommand : public UndoCommand {
|
||||
public:
|
||||
TrackRippleRemoveBlockCommand(TrackOutput* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
TrackRippleRemoveBlockCommand(Track* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -125,7 +125,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
Block* block_;
|
||||
|
||||
@@ -134,7 +134,7 @@ private:
|
||||
|
||||
class TrackPrependBlockCommand : public UndoCommand {
|
||||
public:
|
||||
TrackPrependBlockCommand(TrackOutput* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
TrackPrependBlockCommand(Track* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -143,13 +143,13 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
};
|
||||
|
||||
class TrackInsertBlockAfterCommand : public UndoCommand {
|
||||
public:
|
||||
TrackInsertBlockAfterCommand(TrackOutput* track, Block* block, Block* before, QUndoCommand* parent = nullptr);
|
||||
TrackInsertBlockAfterCommand(Track* track, Block* block, Block* before, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -158,7 +158,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
Block* block_;
|
||||
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
*/
|
||||
class TrackRippleRemoveAreaCommand : public UndoCommand {
|
||||
public:
|
||||
TrackRippleRemoveAreaCommand(TrackOutput* track, rational in, rational out, QUndoCommand* parent = nullptr);
|
||||
TrackRippleRemoveAreaCommand(Track* track, rational in, rational out, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -187,7 +187,7 @@ protected:
|
||||
protected:
|
||||
Project* project_;
|
||||
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
rational in_;
|
||||
rational out_;
|
||||
|
||||
@@ -227,7 +227,7 @@ protected:
|
||||
private:
|
||||
TrackList* list_;
|
||||
|
||||
QList<TrackOutput*> working_tracks_;
|
||||
QList<Track*> working_tracks_;
|
||||
|
||||
rational in_;
|
||||
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
struct RippleInfo {
|
||||
Block* block;
|
||||
Block* ref_block;
|
||||
TrackOutput* track;
|
||||
Track* track;
|
||||
rational new_length;
|
||||
rational old_length;
|
||||
};
|
||||
@@ -312,13 +312,13 @@ private:
|
||||
int track_index_;
|
||||
bool append_;
|
||||
GapBlock* gap_;
|
||||
QVector<TrackOutput*> added_tracks_;
|
||||
QVector<Track*> added_tracks_;
|
||||
|
||||
};
|
||||
|
||||
class BlockSplitCommand : public UndoCommand {
|
||||
public:
|
||||
BlockSplitCommand(TrackOutput* track, Block* block, rational point, QUndoCommand* parent = nullptr);
|
||||
BlockSplitCommand(Track* track, Block* block, rational point, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -329,7 +329,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
Block* new_block_;
|
||||
|
||||
@@ -347,12 +347,12 @@ private:
|
||||
|
||||
class TrackSplitAtTimeCommand : public UndoCommand {
|
||||
public:
|
||||
TrackSplitAtTimeCommand(TrackOutput* track, rational point, QUndoCommand* parent = nullptr);
|
||||
TrackSplitAtTimeCommand(Track* track, rational point, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
};
|
||||
|
||||
@@ -375,7 +375,7 @@ private:
|
||||
*/
|
||||
class TrackReplaceBlockCommand : public UndoCommand {
|
||||
public:
|
||||
TrackReplaceBlockCommand(TrackOutput* track, Block* old, Block* replace, QUndoCommand* parent = nullptr);
|
||||
TrackReplaceBlockCommand(Track* track, Block* old, Block* replace, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -384,14 +384,14 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* old_;
|
||||
Block* replace_;
|
||||
};
|
||||
|
||||
class TrackReplaceBlockWithGapCommand : public UndoCommand {
|
||||
public:
|
||||
TrackReplaceBlockWithGapCommand(TrackOutput* track, Block* block, QUndoCommand* command = nullptr);
|
||||
TrackReplaceBlockWithGapCommand(Track* track, Block* block, QUndoCommand* command = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -400,7 +400,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
|
||||
GapBlock* existing_gap_;
|
||||
@@ -542,7 +542,7 @@ private:
|
||||
|
||||
class TrackSlideCommand : public UndoCommand {
|
||||
public:
|
||||
TrackSlideCommand(TrackOutput* track, const QList<Block*>& moving_blocks, Block* in_adjacent, Block* out_adjacent, const rational& movement, QUndoCommand* parent = nullptr);
|
||||
TrackSlideCommand(Track* track, const QList<Block*>& moving_blocks, Block* in_adjacent, Block* out_adjacent, const rational& movement, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -553,7 +553,7 @@ protected:
|
||||
private:
|
||||
void slide_internal(bool undo);
|
||||
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
QList<Block*> blocks_;
|
||||
rational movement_;
|
||||
|
||||
@@ -583,7 +583,7 @@ private:
|
||||
|
||||
rational length_;
|
||||
|
||||
QList<TrackOutput*> working_tracks_;
|
||||
QList<Track*> working_tracks_;
|
||||
|
||||
bool all_tracks_unlocked_;
|
||||
|
||||
@@ -599,7 +599,7 @@ private:
|
||||
|
||||
class TransitionRemoveCommand : public UndoCommand {
|
||||
public:
|
||||
TransitionRemoveCommand(TrackOutput *track, TransitionBlock* block, QUndoCommand *parent = nullptr);
|
||||
TransitionRemoveCommand(Track *track, TransitionBlock* block, QUndoCommand *parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -608,7 +608,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
TransitionBlock* block_;
|
||||
|
||||
|
||||
@@ -18,13 +18,7 @@ set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/view/timelineview.cpp
|
||||
widget/timelinewidget/view/timelineview.h
|
||||
widget/timelinewidget/view/timelineviewmouseevent.cpp
|
||||
widget/timelinewidget/view/timelineviewmouseevent.h
|
||||
widget/timelinewidget/view/timelineviewrect.cpp
|
||||
widget/timelinewidget/view/timelineviewrect.h
|
||||
widget/timelinewidget/view/timelineviewblockitem.cpp
|
||||
widget/timelinewidget/view/timelineviewblockitem.h
|
||||
widget/timelinewidget/view/timelineviewghostitem.cpp
|
||||
widget/timelinewidget/view/timelineviewghostitem.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -209,7 +209,7 @@ void TimelineView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
|
||||
int line_y = 0;
|
||||
|
||||
foreach (TrackOutput* track, connected_track_list_->GetTracks()) {
|
||||
foreach (Track* track, connected_track_list_->GetTracks()) {
|
||||
line_y += track->GetTrackHeightInPixels();
|
||||
|
||||
// One px gap between tracks
|
||||
@@ -322,7 +322,7 @@ void TimelineView::SceneRectUpdateEvent(QRectF &rect)
|
||||
}
|
||||
}
|
||||
|
||||
Timeline::TrackType TimelineView::ConnectedTrackType()
|
||||
Track::Type TimelineView::ConnectedTrackType()
|
||||
{
|
||||
if (connected_track_list_) {
|
||||
return connected_track_list_->type();
|
||||
@@ -331,7 +331,7 @@ Timeline::TrackType TimelineView::ConnectedTrackType()
|
||||
return Timeline::kTrackTypeNone;
|
||||
}
|
||||
|
||||
Stream::Type TimelineView::TrackTypeToStreamType(Timeline::TrackType track_type)
|
||||
Stream::Type TimelineView::TrackTypeToStreamType(Track::Type track_type)
|
||||
{
|
||||
switch (track_type) {
|
||||
case Timeline::kTrackTypeNone:
|
||||
@@ -417,7 +417,7 @@ int TimelineView::GetTrackY(int track_index) const
|
||||
int TimelineView::GetTrackHeight(int track_index) const
|
||||
{
|
||||
if (!connected_track_list_ || track_index >= connected_track_list_->GetTrackCount()) {
|
||||
return TrackOutput::GetDefaultTrackHeightInPixels();
|
||||
return Track::GetDefaultTrackHeightInPixels();
|
||||
}
|
||||
|
||||
return connected_track_list_->GetTrackAt(track_index)->GetTrackHeightInPixels();
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <QDropEvent>
|
||||
|
||||
#include "node/block/clip/clip.h"
|
||||
#include "timelineviewblockitem.h"
|
||||
#include "timelineviewmouseevent.h"
|
||||
#include "timelineviewghostitem.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
@@ -101,8 +100,8 @@ protected:
|
||||
virtual void SceneRectUpdateEvent(QRectF& rect) override;
|
||||
|
||||
private:
|
||||
Timeline::TrackType ConnectedTrackType();
|
||||
Stream::Type TrackTypeToStreamType(Timeline::TrackType track_type);
|
||||
Track::Type ConnectedTrackType();
|
||||
Stream::Type TrackTypeToStreamType(Track::Type track_type);
|
||||
|
||||
TimelineCoordinate ScreenToCoordinate(const QPoint& pt);
|
||||
TimelineCoordinate SceneToCoordinate(const QPointF& pt);
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewblockitem.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFloat16>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "common/qtutils.h"
|
||||
#include "config/config.h"
|
||||
#include "core.h"
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "widget/viewer/audiowaveformview.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewBlockItem::TimelineViewBlockItem(Block *block, QGraphicsItem* parent) :
|
||||
TimelineViewRect(parent),
|
||||
block_(block)
|
||||
{
|
||||
setBrush(Qt::white);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
Block *TimelineViewBlockItem::block() const
|
||||
{
|
||||
return block_;
|
||||
}
|
||||
|
||||
void TimelineViewBlockItem::UpdateRect()
|
||||
{
|
||||
double item_left = TimeToScene(block_->in());
|
||||
double item_width = TimeToScene(block_->length());
|
||||
|
||||
// -1 on width and height so we don't overlap any adjacent clips
|
||||
setRect(0, y_, item_width - 1, height_);
|
||||
setPos(item_left, 0.0);
|
||||
|
||||
setToolTip(QCoreApplication::translate("TimelineViewBlockItem",
|
||||
"%1\n\nIn: %2\nOut: %3\nLength: %4").arg(block_->Name(),
|
||||
Timecode::time_to_timecode(block_->in(), timebase(), Core::instance()->GetTimecodeDisplay()),
|
||||
Timecode::time_to_timecode(block_->out(), timebase(), Core::instance()->GetTimecodeDisplay()),
|
||||
Timecode::time_to_timecode(block_->out() - block_->in(), timebase(), Core::instance()->GetTimecodeDisplay())));
|
||||
}
|
||||
|
||||
void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
|
||||
{
|
||||
switch (block_->type()) {
|
||||
case Block::kClip:
|
||||
{
|
||||
QLinearGradient grad;
|
||||
grad.setStart(0, rect().top());
|
||||
grad.setFinalStop(0, rect().bottom());
|
||||
|
||||
if (block_->is_enabled()) {
|
||||
grad.setColorAt(0.0, QColor(160, 160, 240));
|
||||
grad.setColorAt(1.0, QColor(128, 128, 192));
|
||||
} else {
|
||||
grad.setColorAt(0.0, QColor(160, 160, 160));
|
||||
grad.setColorAt(1.0, QColor(128, 128, 128));
|
||||
}
|
||||
|
||||
painter->fillRect(rect(), grad);
|
||||
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
painter->fillRect(rect(), QColor(0, 0, 0, 64));
|
||||
}
|
||||
|
||||
// Draw waveform if one is available
|
||||
painter->setPen(QColor(64, 64, 64));
|
||||
TrackOutput* track = TrackOutput::TrackFromBlock(block_);
|
||||
if (track) {
|
||||
AudioVisualWaveform::DrawWaveform(painter,
|
||||
rect().toRect(),
|
||||
this->GetScale(),
|
||||
track->waveform(),
|
||||
block_->in());
|
||||
}
|
||||
|
||||
painter->setPen(Qt::white);
|
||||
painter->drawLine(rect().topLeft(), QPointF(rect().right(), rect().top()));
|
||||
painter->drawLine(rect().topLeft(), QPointF(rect().left(), rect().bottom() - 1));
|
||||
|
||||
// Draw text
|
||||
if (block_->is_enabled()) {
|
||||
painter->setPen(Qt::white);
|
||||
} else {
|
||||
painter->setPen(Qt::lightGray);
|
||||
}
|
||||
|
||||
int text_top = TrackOutput::GetMinimumTrackHeightInPixels() / 2 - painter->fontMetrics().height() / 2;
|
||||
QRectF text_rect = rect();
|
||||
text_rect.adjust(0, text_top, 0, 0);
|
||||
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignTop, block_->GetLabel());
|
||||
|
||||
// Linked clips are underlined
|
||||
if (block_->HasLinks()) {
|
||||
QFontMetrics fm = painter->fontMetrics();
|
||||
int text_width = qMin(qRound(rect().width()), QtUtils::QFontMetricsWidth(fm, block_->GetLabel()));
|
||||
|
||||
QPointF underline_start = rect().topLeft() + QPointF(0, text_top + fm.height());
|
||||
QPointF underline_end = underline_start + QPointF(text_width, 0);
|
||||
|
||||
painter->drawLine(underline_start, underline_end);
|
||||
}
|
||||
|
||||
painter->setPen(QColor(64, 64, 64));
|
||||
painter->drawLine(QPointF(rect().left(), rect().bottom() - 1), QPointF(rect().right(), rect().bottom() - 1));
|
||||
painter->drawLine(QPointF(rect().right(), rect().bottom() - 1), QPointF(rect().right(), rect().top()));
|
||||
break;
|
||||
}
|
||||
case Block::kGap:
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
// FIXME: Make this palette or CSS
|
||||
painter->fillRect(rect(), QColor(255, 255, 255, 128));
|
||||
}
|
||||
break;
|
||||
case Block::kTransition:
|
||||
{
|
||||
QLinearGradient grad;
|
||||
grad.setStart(0, rect().top());
|
||||
grad.setFinalStop(0, rect().bottom());
|
||||
grad.setColorAt(0.0, QColor(192, 160, 224));
|
||||
grad.setColorAt(1.0, QColor(160, 128, 192));
|
||||
painter->setBrush(grad);
|
||||
painter->setPen(QPen(QColor(96, 80, 112), 1));
|
||||
painter->drawRect(rect());
|
||||
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
painter->fillRect(rect(), QColor(0, 0, 0, 64));
|
||||
}
|
||||
|
||||
// Draw lines antialiased
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
TransitionBlock* t = static_cast<TransitionBlock*>(block_);
|
||||
|
||||
if (t->connected_out_block() && t->connected_in_block()) {
|
||||
|
||||
// Draw line between out offset and in offset
|
||||
qreal crossover_line = rect().left();
|
||||
crossover_line += TimeToScene(t->out_offset());
|
||||
painter->drawLine(qRound(crossover_line),
|
||||
qRound(rect().top()),
|
||||
qRound(crossover_line),
|
||||
qRound(rect().bottom()));
|
||||
|
||||
// Draw lines to mid point
|
||||
QPointF mid_point(crossover_line, rect().center().y());
|
||||
painter->drawLine(rect().topLeft(), mid_point);
|
||||
painter->drawLine(rect().bottomLeft(), mid_point);
|
||||
painter->drawLine(rect().topRight(), mid_point);
|
||||
painter->drawLine(rect().bottomRight(), mid_point);
|
||||
|
||||
} else if (t->connected_out_block()) {
|
||||
|
||||
// Transition fades something out, we'll draw a line
|
||||
painter->drawLine(rect().topLeft(), rect().bottomRight());
|
||||
|
||||
} else if (t->connected_in_block()) {
|
||||
|
||||
// Transition fades something in, we'll draw a line
|
||||
painter->drawLine(rect().bottomLeft(), rect().topRight());
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEWCLIPITEM_H
|
||||
#define TIMELINEVIEWCLIPITEM_H
|
||||
|
||||
#include "timelineviewrect.h"
|
||||
#include "node/block/clip/clip.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A graphical representation of a ClipBlock
|
||||
*/
|
||||
class TimelineViewBlockItem : public TimelineViewRect
|
||||
{
|
||||
public:
|
||||
TimelineViewBlockItem(Block* block, QGraphicsItem* parent = nullptr);
|
||||
|
||||
Block* block() const;
|
||||
|
||||
virtual void UpdateRect() override;
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
|
||||
|
||||
private:
|
||||
Block* block_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEVIEWCLIPITEM_H
|
||||
@@ -1,194 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewghostitem.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewGhostItem::TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
invisible_(false)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineViewGhostItem *TimelineViewGhostItem::FromBlock(Block *block, const TrackReference& track)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
ghost->SetMediaIn(block->media_in());
|
||||
ghost->SetTrack(track);
|
||||
ghost->SetData(kAttachedBlock, Node::PtrToValue(block));
|
||||
|
||||
switch (block->type()) {
|
||||
case Block::kClip:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
break;
|
||||
case Block::kTransition:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
ghost->SetCanMoveTracks(false);
|
||||
break;
|
||||
case Block::kGap:
|
||||
break;
|
||||
}
|
||||
|
||||
return ghost;
|
||||
}
|
||||
|
||||
bool TimelineViewGhostItem::CanHaveZeroLength() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
|
||||
bool TimelineViewGhostItem::GetCanMoveTracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetCanMoveTracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetIn() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetOut() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetMediaIn() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetLength() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedLength() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetIn(const rational &in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetOut(const rational &out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMediaIn(const rational &media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetInAdjustment(const rational &in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetOutAdjustment(const rational &out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetTrackAdjustment(const int &track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMediaInAdjustment(const rational &media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetInAdjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetOutAdjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetMediaInAdjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
|
||||
const int &TimelineViewGhostItem::GetTrackAdjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedIn() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedOut() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedMediaIn() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
|
||||
TrackReference TimelineViewGhostItem::GetAdjustedTrack() const
|
||||
{
|
||||
return TrackReference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const Timeline::MovementMode &TimelineViewGhostItem::GetMode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMode(const Timeline::MovementMode &mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
bool TimelineViewGhostItem::HasBeenAdjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0
|
||||
|| GetOutAdjustment() != 0
|
||||
|| GetMediaInAdjustment() != 0
|
||||
|| GetTrackAdjustment() != 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "timelineviewblockitem.h"
|
||||
#include "timelineviewrect.h"
|
||||
#include "timeline/trackreference.h"
|
||||
|
||||
namespace olive {
|
||||
/**
|
||||
@@ -44,45 +43,172 @@ public:
|
||||
kTrimShouldBeIgnored
|
||||
};
|
||||
|
||||
TimelineViewGhostItem();
|
||||
TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
invisible_(false)
|
||||
{
|
||||
}
|
||||
|
||||
static TimelineViewGhostItem* FromBlock(Block *block, const TrackReference &track);
|
||||
static TimelineViewGhostItem* FromBlock(Block *block, const TrackReference &track)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
bool CanHaveZeroLength() const;
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
ghost->SetMediaIn(block->media_in());
|
||||
ghost->SetTrack(track);
|
||||
ghost->SetData(kAttachedBlock, Node::PtrToValue(block));
|
||||
|
||||
bool GetCanMoveTracks() const;
|
||||
void SetCanMoveTracks(bool e);
|
||||
switch (block->type()) {
|
||||
case Block::kClip:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
break;
|
||||
case Block::kTransition:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
ghost->SetCanMoveTracks(false);
|
||||
break;
|
||||
case Block::kGap:
|
||||
break;
|
||||
}
|
||||
|
||||
const rational& GetIn() const;
|
||||
const rational& GetOut() const;
|
||||
const rational& GetMediaIn() const;
|
||||
return ghost;
|
||||
}
|
||||
|
||||
rational GetLength() const;
|
||||
rational GetAdjustedLength() const;
|
||||
bool CanHaveZeroLength() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
|
||||
void SetIn(const rational& in);
|
||||
void SetOut(const rational& out);
|
||||
void SetMediaIn(const rational& media_in);
|
||||
bool GetCanMoveTracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
|
||||
void SetInAdjustment(const rational& in_adj);
|
||||
void SetOutAdjustment(const rational& out_adj);
|
||||
void SetTrackAdjustment(const int& track_adj);
|
||||
void SetMediaInAdjustment(const rational& media_in_adj);
|
||||
void SetCanMoveTracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
|
||||
const rational& GetInAdjustment() const;
|
||||
const rational& GetOutAdjustment() const;
|
||||
const rational& GetMediaInAdjustment() const;
|
||||
const int& GetTrackAdjustment() const;
|
||||
const rational& GetIn() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
|
||||
rational GetAdjustedIn() const;
|
||||
rational GetAdjustedOut() const;
|
||||
rational GetAdjustedMediaIn() const;
|
||||
TrackReference GetAdjustedTrack() const;
|
||||
const rational& GetOut() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
const Timeline::MovementMode& GetMode() const;
|
||||
void SetMode(const Timeline::MovementMode& GetMode);
|
||||
const rational& GetMediaIn() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
|
||||
bool HasBeenAdjusted() const;
|
||||
rational GetLength() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
|
||||
rational GetAdjustedLength() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
}
|
||||
|
||||
void SetIn(const rational& in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
|
||||
void SetOut(const rational& out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
void SetMediaIn(const rational& media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
|
||||
void SetInAdjustment(const rational& in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
|
||||
void SetOutAdjustment(const rational& out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
|
||||
void SetTrackAdjustment(const int& track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
|
||||
void SetMediaInAdjustment(const rational& media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
|
||||
const rational& GetInAdjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
|
||||
const rational& GetOutAdjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
|
||||
const rational& GetMediaInAdjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
|
||||
const int& GetTrackAdjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedIn() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedOut() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedMediaIn() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
|
||||
TrackReference GetAdjustedTrack() const
|
||||
{
|
||||
return TrackReference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const Timeline::MovementMode& GetMode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void SetMode(const Timeline::MovementMode& mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
bool HasBeenAdjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0
|
||||
|| GetOutAdjustment() != 0
|
||||
|| GetMediaInAdjustment() != 0
|
||||
|| GetTrackAdjustment() != 0;
|
||||
}
|
||||
|
||||
QVariant GetData(int key) const
|
||||
{
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewmouseevent.h"
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewMouseEvent::TimelineViewMouseEvent(const qreal &scene_x,
|
||||
const double &scale_x,
|
||||
const rational &timebase,
|
||||
const TrackReference &track,
|
||||
const Qt::MouseButton &button,
|
||||
const Qt::KeyboardModifiers &modifiers) :
|
||||
scene_x_(scene_x),
|
||||
scale_x_(scale_x),
|
||||
timebase_(timebase),
|
||||
track_(track),
|
||||
button_(button),
|
||||
modifiers_(modifiers),
|
||||
source_event_(nullptr),
|
||||
mime_data_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate TimelineViewMouseEvent::GetCoordinates(bool round_time) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers &TimelineViewMouseEvent::GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
rational TimelineViewMouseEvent::GetFrame(bool round) const
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
}
|
||||
|
||||
const TrackReference &TimelineViewMouseEvent::GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
const QMimeData* TimelineViewMouseEvent::GetMimeData()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::SetMimeData(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::SetEvent(QEvent *event)
|
||||
{
|
||||
source_event_ = event;
|
||||
}
|
||||
|
||||
const qreal &TimelineViewMouseEvent::GetSceneX() const
|
||||
{
|
||||
return scene_x_;
|
||||
}
|
||||
|
||||
const Qt::MouseButton &TimelineViewMouseEvent::GetButton() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::accept()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->accept();
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::ignore()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->ignore();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QPoint>
|
||||
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -37,10 +38,27 @@ public:
|
||||
const rational& timebase,
|
||||
const TrackReference &track,
|
||||
const Qt::MouseButton &button,
|
||||
const Qt::KeyboardModifiers& modifiers = Qt::NoModifier);
|
||||
const Qt::KeyboardModifiers& modifiers = Qt::NoModifier) :
|
||||
scene_x_(scene_x),
|
||||
scale_x_(scale_x),
|
||||
timebase_(timebase),
|
||||
track_(track),
|
||||
button_(button),
|
||||
modifiers_(modifiers),
|
||||
source_event_(nullptr),
|
||||
mime_data_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const;
|
||||
const Qt::KeyboardModifiers& GetModifiers() const;
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers& GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the time at this cursor point
|
||||
@@ -51,21 +69,52 @@ public:
|
||||
* always to the left of the cursor. The former behavior is better for clicking between frames (e.g. razor tool) and
|
||||
* the latter is better for clicking directly on frames (e.g. pointer tool).
|
||||
*/
|
||||
rational GetFrame(bool round = false) const;
|
||||
rational GetFrame(bool round = false) const
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
}
|
||||
|
||||
const TrackReference& GetTrack() const;
|
||||
const TrackReference& GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
const QMimeData *GetMimeData();
|
||||
void SetMimeData(const QMimeData *data);
|
||||
const QMimeData *GetMimeData()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
|
||||
void SetEvent(QEvent* event);
|
||||
void SetMimeData(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
|
||||
const qreal& GetSceneX() const;
|
||||
void SetEvent(QEvent* event)
|
||||
{
|
||||
source_event_ = event;
|
||||
}
|
||||
|
||||
const Qt::MouseButton& GetButton() const;
|
||||
const qreal& GetSceneX() const
|
||||
{
|
||||
return scene_x_;
|
||||
}
|
||||
|
||||
void accept();
|
||||
void ignore();
|
||||
const Qt::MouseButton& GetButton() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
|
||||
void accept()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->accept();
|
||||
}
|
||||
|
||||
void ignore()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->ignore();
|
||||
}
|
||||
|
||||
private:
|
||||
qreal scene_x_;
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewrect.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewRect::TimelineViewRect(QGraphicsItem* parent) :
|
||||
QGraphicsRectItem(parent),
|
||||
y_(0),
|
||||
height_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TimelineViewRect::SetYCoords(int y, int height)
|
||||
{
|
||||
y_ = y;
|
||||
height_ = height;
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
const TrackReference &TimelineViewRect::Track()
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
void TimelineViewRect::SetTrack(const TrackReference &track)
|
||||
{
|
||||
track_ = track;
|
||||
}
|
||||
|
||||
void TimelineViewRect::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimeScaledObject::ScaleChangedEvent(scale);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
void TimelineViewRect::TimebaseChangedEvent(const rational &tb)
|
||||
{
|
||||
TimeScaledObject::TimebaseChangedEvent(tb);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEWRECT_H
|
||||
#define TIMELINEVIEWRECT_H
|
||||
|
||||
#include <QGraphicsRectItem>
|
||||
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A base class for graphical representations of Block nodes
|
||||
*/
|
||||
class TimelineViewRect : public QGraphicsRectItem, public TimeScaledObject
|
||||
{
|
||||
public:
|
||||
TimelineViewRect(QGraphicsItem* parent = nullptr);
|
||||
|
||||
void SetYCoords(int y, int height);
|
||||
|
||||
const TrackReference& Track();
|
||||
void SetTrack(const TrackReference& track);
|
||||
|
||||
virtual void UpdateRect() = 0;
|
||||
|
||||
protected:
|
||||
virtual void ScaleChangedEvent(const double &) override;
|
||||
|
||||
virtual void TimebaseChangedEvent(const rational&) override;
|
||||
|
||||
int y_;
|
||||
|
||||
int height_;
|
||||
|
||||
TrackReference track_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEVIEWRECT_H
|
||||
Reference in New Issue
Block a user