@@ -447,7 +447,8 @@ void TimelineWidget::SplitAtPlayhead()
|
|||||||
|
|
||||||
void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
|
void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
|
||||||
bool remove_from_graph,
|
bool remove_from_graph,
|
||||||
MultiUndoCommand *command)
|
MultiUndoCommand *command,
|
||||||
|
bool handle_transitions)
|
||||||
{
|
{
|
||||||
foreach (Block* b, blocks) {
|
foreach (Block* b, blocks) {
|
||||||
if (dynamic_cast<GapBlock*>(b)) {
|
if (dynamic_cast<GapBlock*>(b)) {
|
||||||
@@ -458,7 +459,7 @@ void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
|
|||||||
|
|
||||||
Track* original_track = b->track();
|
Track* original_track = b->track();
|
||||||
|
|
||||||
command->add_child(new TrackReplaceBlockWithGapCommand(original_track, b));
|
command->add_child(new TrackReplaceBlockWithGapCommand(original_track, b, handle_transitions));
|
||||||
|
|
||||||
if (remove_from_graph) {
|
if (remove_from_graph) {
|
||||||
command->add_child(new NodeRemoveWithExclusiveDependenciesAndDisconnect(b));
|
command->add_child(new NodeRemoveWithExclusiveDependenciesAndDisconnect(b));
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
void RestoreSplitterState(const QByteArray& state);
|
void RestoreSplitterState(const QByteArray& state);
|
||||||
|
|
||||||
static void ReplaceBlocksWithGaps(const QVector<Block *> &blocks, bool remove_from_graph, MultiUndoCommand *command);
|
static void ReplaceBlocksWithGaps(const QVector<Block *> &blocks, bool remove_from_graph, MultiUndoCommand *command, bool handle_transitions = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Retrieve the QGraphicsItem at a particular scene position
|
* @brief Retrieve the QGraphicsItem at a particular scene position
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
|||||||
blocks_to_delete[i] = blocks_moving.at(i).block;
|
blocks_to_delete[i] = blocks_moving.at(i).block;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent()->ReplaceBlocksWithGaps(blocks_to_delete, false, command);
|
parent()->ReplaceBlocksWithGaps(blocks_to_delete, false, command, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inserting) {
|
if (inserting) {
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ void TrackListInsertGaps::undo()
|
|||||||
void TrackReplaceBlockWithGapCommand::redo()
|
void TrackReplaceBlockWithGapCommand::redo()
|
||||||
{
|
{
|
||||||
// Determine if this block is connected to any transitions that should also be removed by this operation
|
// Determine if this block is connected to any transitions that should also be removed by this operation
|
||||||
if (transition_remove_commands_.isEmpty()) {
|
if (handle_transitions_ && transition_remove_commands_.isEmpty()) {
|
||||||
CreateRemoveTransitionCommandIfNecessary(false);
|
CreateRemoveTransitionCommandIfNecessary(false);
|
||||||
CreateRemoveTransitionCommandIfNecessary(true);
|
CreateRemoveTransitionCommandIfNecessary(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,12 +196,13 @@ private:
|
|||||||
|
|
||||||
class TrackReplaceBlockWithGapCommand : public UndoCommand {
|
class TrackReplaceBlockWithGapCommand : public UndoCommand {
|
||||||
public:
|
public:
|
||||||
TrackReplaceBlockWithGapCommand(Track* track, Block* block) :
|
TrackReplaceBlockWithGapCommand(Track* track, Block* block, bool handle_transitions = true) :
|
||||||
track_(track),
|
track_(track),
|
||||||
block_(block),
|
block_(block),
|
||||||
existing_gap_(nullptr),
|
existing_gap_(nullptr),
|
||||||
existing_merged_gap_(nullptr),
|
existing_merged_gap_(nullptr),
|
||||||
our_gap_(nullptr),
|
our_gap_(nullptr),
|
||||||
|
handle_transitions_(handle_transitions),
|
||||||
position_command_(nullptr)
|
position_command_(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -232,6 +233,8 @@ private:
|
|||||||
bool existing_gap_precedes_;
|
bool existing_gap_precedes_;
|
||||||
GapBlock* our_gap_;
|
GapBlock* our_gap_;
|
||||||
|
|
||||||
|
bool handle_transitions_;
|
||||||
|
|
||||||
NodeSetPositionAsChildCommand* position_command_;
|
NodeSetPositionAsChildCommand* position_command_;
|
||||||
|
|
||||||
QObject memory_manager_;
|
QObject memory_manager_;
|
||||||
|
|||||||
Reference in New Issue
Block a user