Commit 66860410 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Adding an undo/redo command for resizing effect and triggering it.

parent f70851de
......@@ -25,6 +25,7 @@
#include "Clip.h"
#include "ClipHelper.h"
#include "EffectHelper.h"
#include "EffectInstance.h"
#include "Commands.h"
#include "MainWorkflow.h"
#include "TrackWorkflow.h"
......@@ -224,3 +225,25 @@ Commands::Effect::Move::undo()
else
m_new->moveEffect( m_helper, m_oldPos );
}
Commands::Effect::Resize::Resize( EffectHelper *helper, qint64 newBegin, qint64 newEnd ) :
m_helper( helper ),
m_newBegin( newBegin ),
m_newEnd( newEnd )
{
setText( QObject::tr( "Resizing effect %1" ).arg( m_helper->effectInstance()->effect()->name() ) );
m_oldBegin = helper->begin();
m_oldEnd = helper->end();
}
void
Commands::Effect::Resize::redo()
{
m_helper->setBoundaries( m_newBegin, m_newEnd );
}
void
Commands::Effect::Resize::undo()
{
m_helper->setBoundaries( m_oldBegin, m_oldEnd );
}
......@@ -160,6 +160,20 @@ namespace Commands
qint64 m_oldPos;
qint64 m_newPos;
};
NEW_COMMAND( Resize )
{
public:
Resize( EffectHelper *helper, qint64 newBegin, qint64 newEnd );
virtual void redo();
virtual void undo();
private:
EffectHelper *m_helper;
qint64 m_newBegin;
qint64 m_newEnd;
qint64 m_oldBegin;
qint64 m_oldEnd;
};
}
}
......
......@@ -220,8 +220,11 @@ GraphicsEffectItem::triggerMove( TrackWorkflow *oldTrack, TrackWorkflow *newTrac
}
void
GraphicsEffectItem::triggerResize( TrackWorkflow *tw, Workflow::Helper *helper,
qint64 newBegin, qint64 newEnd, qint64 pos )
GraphicsEffectItem::triggerResize( TrackWorkflow *, Workflow::Helper *helper,
qint64 newBegin, qint64 newEnd, qint64 )
{
//FIXME
EffectHelper *eh = qobject_cast<EffectHelper*>( helper );
if ( eh == NULL )
return ;
Commands::trigger( new Commands::Effect::Resize( eh, newBegin, newEnd ) );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment