Commit a9104000 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Fixed resize and undo/redo mode

parent b951d8b1
...@@ -110,7 +110,6 @@ void AbstractGraphicsMediaItem::resize( qint64 size, From from ) ...@@ -110,7 +110,6 @@ void AbstractGraphicsMediaItem::resize( qint64 size, From from )
if ( from == BEGINNING ) if ( from == BEGINNING )
{ {
// clip()->setEnd( clip()->getBegin() + size );
tracksView()->getRenderer()->resizeClip( clip(), clip()->getBegin(), clip()->getBegin() + size, boundingRect().x(), tracksView()->getRenderer()->resizeClip( clip(), clip()->getBegin(), clip()->getBegin() + size, boundingRect().x(),
trackNumber(), MainWorkflow::VideoTrack ); trackNumber(), MainWorkflow::VideoTrack );
} }
...@@ -122,7 +121,6 @@ void AbstractGraphicsMediaItem::resize( qint64 size, From from ) ...@@ -122,7 +121,6 @@ void AbstractGraphicsMediaItem::resize( qint64 size, From from )
qWarning( "Warning: resizing a region with a size below 0" ); qWarning( "Warning: resizing a region with a size below 0" );
size += clip()->getEnd() - size; size += clip()->getEnd() - size;
} }
// clip()->setBegin( qMax( clip()->getEnd() - size, (qint64)0 ) );
tracksView()->getRenderer()->resizeClip( clip(), qMax( clip()->getEnd() - size, (qint64)0 ), clip()->getEnd(), tracksView()->getRenderer()->resizeClip( clip(), qMax( clip()->getEnd() - size, (qint64)0 ), clip()->getEnd(),
startPos() + ( oldLength - size ), trackNumber(), MainWorkflow::VideoTrack ); startPos() + ( oldLength - size ), trackNumber(), MainWorkflow::VideoTrack );
setStartPos( startPos() + ( oldLength - size ) ); setStartPos( startPos() + ( oldLength - size ) );
......
...@@ -315,22 +315,27 @@ void WorkflowRenderer::unsplit( Clip* origin, Clip* splitted, uint32_t trackI ...@@ -315,22 +315,27 @@ void WorkflowRenderer::unsplit( Clip* origin, Clip* splitted, uint32_t trackI
void WorkflowRenderer::resizeClip( Clip* clip, qint64 newBegin, qint64 newEnd, void WorkflowRenderer::resizeClip( Clip* clip, qint64 newBegin, qint64 newEnd,
qint64 newPos, uint32_t trackId, MainWorkflow::TrackType trackType, bool undoRedoAction /*= false*/ ) qint64 newPos, uint32_t trackId, MainWorkflow::TrackType trackType, bool undoRedoAction /*= false*/ )
{ {
if ( m_isRendering == true ) // if ( m_isRendering == true )
{ // {
Action::Generic* act = new Action::ResizeClip( clip, newBegin, newEnd ); // Action::Generic* act = new Action::ResizeClip( clip, newBegin, newEnd );
Action::Generic* act2 = new Action::MoveClip( m_mainWorkflow, clip->getUuid(), trackId, trackId, newPos, trackType, undoRedoAction ); // Action::Generic* act2 = new Action::MoveClip( m_mainWorkflow, clip->getUuid(), trackId, trackId, newPos, trackType, undoRedoAction );
QMutexLocker lock( m_actionsMutex ); // QMutexLocker lock( m_actionsMutex );
m_actions.addAction( act ); // if ( newBegin != clip->getBegin() )
m_actions.addAction( act2 ); // {
} // qDebug() << "Resizing to pos:" << newPos;
else // m_actions.addAction( act2 );
{ // }
// qDebug() << "setting boundaries: newEnd:" << newBegin << "newEnd:" << newEnd;
// m_actions.addAction( act );
// }
// else
// {
if ( newBegin != clip->getBegin() ) if ( newBegin != clip->getBegin() )
{ {
m_mainWorkflow->moveClip( clip->getUuid(), trackId, trackId, newPos, trackType, undoRedoAction ); m_mainWorkflow->moveClip( clip->getUuid(), trackId, trackId, newPos, trackType, undoRedoAction );
} }
clip->setBoundaries( newBegin, newEnd ); clip->setBoundaries( 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