timeline: implemented in/out points
This commit is contained in:
@@ -335,7 +335,7 @@ void TimelineWidget::SplitAtPlayhead()
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::DeleteSelectedInternal(QList<Block *> blocks,
|
||||
void TimelineWidget::DeleteSelectedInternal(const QList<Block *> &blocks,
|
||||
bool transition_aware,
|
||||
bool remove_from_graph,
|
||||
QUndoCommand *command)
|
||||
@@ -426,7 +426,7 @@ void TimelineWidget::DeleteSelected(bool ripple)
|
||||
range_list.InsertTimeRange(TimeRange(b->in(), b->out()));
|
||||
}
|
||||
|
||||
new TimelineRippleDeleteGapsAtRegions(GetConnectedNode(), range_list, command);
|
||||
new TimelineRippleDeleteGapsAtRegionsCommand(GetConnectedNode(), range_list, command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
@@ -349,7 +349,7 @@ private:
|
||||
bool dual_transition_;
|
||||
};
|
||||
|
||||
void DeleteSelectedInternal(QList<Block *> blocks, bool transition_aware, bool remove_from_graph, QUndoCommand* command);
|
||||
void DeleteSelectedInternal(const QList<Block *>& blocks, bool transition_aware, bool remove_from_graph, QUndoCommand* command);
|
||||
|
||||
void SetBlockLinksSelected(Block *block, bool selected);
|
||||
|
||||
|
||||
@@ -623,14 +623,14 @@ void BlockSetSpeedCommand::undo_internal()
|
||||
block_->set_speed(old_speed_);
|
||||
}
|
||||
|
||||
TimelineRippleDeleteGapsAtRegions::TimelineRippleDeleteGapsAtRegions(ViewerOutput *vo, const TimeRangeList ®ions, QUndoCommand *parent) :
|
||||
TimelineRippleDeleteGapsAtRegionsCommand::TimelineRippleDeleteGapsAtRegionsCommand(ViewerOutput *vo, const TimeRangeList ®ions, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
timeline_(vo),
|
||||
regions_(regions)
|
||||
{
|
||||
}
|
||||
|
||||
void TimelineRippleDeleteGapsAtRegions::redo_internal()
|
||||
void TimelineRippleDeleteGapsAtRegionsCommand::redo_internal()
|
||||
{
|
||||
foreach (const TimeRange& range, regions_) {
|
||||
rational max_ripple_length = range.length();
|
||||
@@ -671,7 +671,7 @@ void TimelineRippleDeleteGapsAtRegions::redo_internal()
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineRippleDeleteGapsAtRegions::undo_internal()
|
||||
void TimelineRippleDeleteGapsAtRegionsCommand::undo_internal()
|
||||
{
|
||||
for (int i=commands_.size()-1;i>=0;i--) {
|
||||
commands_.at(i)->undo();
|
||||
@@ -679,3 +679,39 @@ void TimelineRippleDeleteGapsAtRegions::undo_internal()
|
||||
}
|
||||
commands_.empty();
|
||||
}
|
||||
|
||||
WorkareaSetEnabledCommand::WorkareaSetEnabledCommand(TimelinePoints *points, bool enabled, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
points_(points),
|
||||
old_enabled_(points_->workarea()->enabled()),
|
||||
new_enabled_(enabled)
|
||||
{
|
||||
}
|
||||
|
||||
void WorkareaSetEnabledCommand::redo_internal()
|
||||
{
|
||||
points_->workarea()->set_enabled(new_enabled_);
|
||||
}
|
||||
|
||||
void WorkareaSetEnabledCommand::undo_internal()
|
||||
{
|
||||
points_->workarea()->set_enabled(old_enabled_);
|
||||
}
|
||||
|
||||
WorkareaSetRangeCommand::WorkareaSetRangeCommand(TimelinePoints *points, const TimeRange &range, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
points_(points),
|
||||
old_range_(points_->workarea()->range()),
|
||||
new_range_(range)
|
||||
{
|
||||
}
|
||||
|
||||
void WorkareaSetRangeCommand::redo_internal()
|
||||
{
|
||||
points_->workarea()->set_range(new_range_);
|
||||
}
|
||||
|
||||
void WorkareaSetRangeCommand::undo_internal()
|
||||
{
|
||||
points_->workarea()->set_range(old_range_);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "node/output/track/track.h"
|
||||
#include "node/output/track/tracklist.h"
|
||||
#include "timeline/timelinepoints.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
class BlockResizeCommand : public UndoCommand {
|
||||
@@ -280,9 +281,9 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class TimelineRippleDeleteGapsAtRegions : public UndoCommand {
|
||||
class TimelineRippleDeleteGapsAtRegionsCommand : public UndoCommand {
|
||||
public:
|
||||
TimelineRippleDeleteGapsAtRegions(ViewerOutput* vo, const TimeRangeList& regions, QUndoCommand* parent = nullptr);
|
||||
TimelineRippleDeleteGapsAtRegionsCommand(ViewerOutput* vo, const TimeRangeList& regions, QUndoCommand* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void redo_internal() override;
|
||||
@@ -296,4 +297,38 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class WorkareaSetEnabledCommand : public UndoCommand {
|
||||
public:
|
||||
WorkareaSetEnabledCommand(TimelinePoints* points, bool enabled, QUndoCommand* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void redo_internal() override;
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TimelinePoints* points_;
|
||||
|
||||
bool old_enabled_;
|
||||
|
||||
bool new_enabled_;
|
||||
|
||||
};
|
||||
|
||||
class WorkareaSetRangeCommand : public UndoCommand {
|
||||
public:
|
||||
WorkareaSetRangeCommand(TimelinePoints* points, const TimeRange& range, QUndoCommand* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void redo_internal() override;
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TimelinePoints* points_;
|
||||
|
||||
TimeRange old_range_;
|
||||
|
||||
TimeRange new_range_;
|
||||
|
||||
};
|
||||
|
||||
#endif // TIMELINEUNDOABLE_H
|
||||
|
||||
Reference in New Issue
Block a user