[vlmc-devel] commit: GraphicsEffectItem: Reworked length behaviour ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Tue Sep 21 18:48:21 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Sep 21 18:24:05 2010 +0200| [f57ebe134555479aaa142afe0b18e1ae5d9e2e9d] | committer: Hugo Beauzée-Luyssen
GraphicsEffectItem: Reworked length behaviour
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=f57ebe134555479aaa142afe0b18e1ae5d9e2e9d
---
src/EffectsEngine/EffectHelper.cpp | 12 +++++++++---
src/Gui/timeline/GraphicsEffectItem.cpp | 5 ++---
src/Gui/timeline/TracksView.cpp | 2 +-
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/EffectsEngine/EffectHelper.cpp b/src/EffectsEngine/EffectHelper.cpp
index 2a805c4..90950ec 100644
--- a/src/EffectsEngine/EffectHelper.cpp
+++ b/src/EffectsEngine/EffectHelper.cpp
@@ -22,6 +22,7 @@
#include "EffectHelper.h"
#include "EffectUser.h"
+#include "MainWorkflow.h"
EffectHelper::EffectHelper( EffectInstance *effectInstance, qint64 begin, qint64 end,
const QString &uuid ) :
@@ -29,6 +30,10 @@ EffectHelper::EffectHelper( EffectInstance *effectInstance, qint64 begin, qint64
m_effectInstance( effectInstance ),
m_target( NULL )
{
+ if ( MainWorkflow::getInstance()->getLengthFrame() > 0 )
+ m_end = MainWorkflow::getInstance()->getLengthFrame();
+ else
+ m_end = Effect::TrackEffectDefaultLength;
}
EffectInstance*
@@ -54,7 +59,8 @@ EffectHelper::setTarget( EffectUser *target )
{
m_target = target;
if ( target != NULL )
- m_end = target->length();
- if ( m_end <= 0 ) //Clip can't be 0lengthed, so this case would be a track.
- m_end = Effect::TrackEffectDefaultLength; //Have a reasonable default length.
+ {
+ if ( target->length() > 0 && target->length() < m_end )
+ m_end = target->length();
+ }
}
diff --git a/src/Gui/timeline/GraphicsEffectItem.cpp b/src/Gui/timeline/GraphicsEffectItem.cpp
index 8d3b7f9..0c5fcdd 100644
--- a/src/Gui/timeline/GraphicsEffectItem.cpp
+++ b/src/Gui/timeline/GraphicsEffectItem.cpp
@@ -89,7 +89,7 @@ GraphicsEffectItem::moveable() const
bool
GraphicsEffectItem::hasResizeBoundaries() const
{
- return ( m_effectHelper->end() != -1 );
+ return ( m_container != NULL );
}
Workflow::TrackType
@@ -247,8 +247,7 @@ GraphicsEffectItem::maxBegin() const
qint64
GraphicsEffectItem::maxEnd() const
{
- if ( m_effectHelper->target()->length() <= 0 )
- return Effect::TrackEffectDefaultLength;
+ Q_ASSERT( m_effectHelper->target() );
return m_effectHelper->target()->length();
}
diff --git a/src/Gui/timeline/TracksView.cpp b/src/Gui/timeline/TracksView.cpp
index e8ccf5c..388d7bf 100644
--- a/src/Gui/timeline/TracksView.cpp
+++ b/src/Gui/timeline/TracksView.cpp
@@ -425,7 +425,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
GraphicsTrack *track = qgraphicsitem_cast<GraphicsTrack*>( item );
if ( track != NULL && track->mediaType() == Workflow::VideoTrack )
{
- m_dragEffectItem->setWidth( track->maximumWidth() );
+ m_dragEffectItem->setWidth( m_dragEffectItem->helper()->length() );
m_dragEffectItem->setStartPos( 0 );
m_dragEffectItem->setTrack( track );
break ;
More information about the Vlmc-devel
mailing list