From 23a61a9969af9d099ce87d1169b7c2aeb5f6bb1e Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Wed, 27 Jan 2010 11:41:30 +0100 Subject: renaissance1: #i107215# First draft of the new slide sorter design. --- .../ui/slidesorter/controller/SlsAnimator.cxx | 165 +++++++++++++++++---- 1 file changed, 139 insertions(+), 26 deletions(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 9878d7b36a47..d7679d88328e 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -33,6 +33,7 @@ #include "controller/SlsAnimator.hxx" #include "view/SlideSorterView.hxx" #include "View.hxx" +#include namespace sd { namespace slidesorter { namespace controller { @@ -46,14 +47,23 @@ class Animator::Animation { public: Animation ( - const Animator::AnimationFunction& rAnimation, - const double nDelta); + const Animator::AnimationFunctor& rAnimation, + const double nDelta, + const double nEnd, + const Animator::AnimationId nAnimationId, + const Animator::FinishFunctor& rFinishFunctor); ~Animation (void); bool Run (void); + void Expire (void); bool IsExpired (void); - Animator::AnimationFunction maAnimation; + + Animator::AnimationFunctor maAnimation; + Animator::FinishFunctor maFinishFunctor; + const Animator::AnimationId mnAnimationId; double mnValue; - double mnDelta; + const double mnEnd; + const double mnDelta; + bool mbIsExpired; }; @@ -62,11 +72,11 @@ public: class Animator::DrawLock { public: - DrawLock (View& rView); + DrawLock (view::SlideSorterView& rView); ~DrawLock (void); private: - View& mrView; + view::SlideSorterView& mrView; }; @@ -75,8 +85,10 @@ private: Animator::Animator (SlideSorter& rSlideSorter) : mrSlideSorter(rSlideSorter), maTimer(), + mbIsDisposed(false), maAnimations(), - mpDrawLock() + mpDrawLock(), + mnNextAnimationId(0) { maTimer.SetTimeout(gnResolution); maTimer.SetTimeoutHdl(LINK(this,Animator,TimeoutHandler)); @@ -87,6 +99,19 @@ Animator::Animator (SlideSorter& rSlideSorter) Animator::~Animator (void) { + if ( ! mbIsDisposed) + { + OSL_ASSERT(mbIsDisposed); + Dispose(); + } +} + + + + +void Animator::Dispose (void) +{ + mbIsDisposed = true; maTimer.Stop(); mpDrawLock.reset(); } @@ -94,25 +119,82 @@ Animator::~Animator (void) -void Animator::AddAnimation ( - const AnimationFunction& rAnimation, - const sal_Int32 nDuration) +Animator::AnimationId Animator::AddAnimation ( + const AnimationFunctor& rAnimation, + const sal_Int32 nDuration, + const FinishFunctor& rFinishFunctor) { + OSL_ASSERT( ! mbIsDisposed); + const double nDelta = double(gnResolution) / double(nDuration); - maAnimations.push_back(boost::shared_ptr(new Animation(rAnimation, nDelta))); + boost::shared_ptr pAnimation ( + new Animation(rAnimation, nDelta, 1.0, ++mnNextAnimationId, rFinishFunctor)); + maAnimations.push_back(pAnimation); // Prevent redraws except for the ones in TimeoutHandler. // While the Animator is active it will schedule repaints regularly. // Repaints in between would only lead to visual artifacts. mpDrawLock.reset(new DrawLock(mrSlideSorter.GetView())); maTimer.Start(); + + return pAnimation->mnAnimationId; } -bool Animator::ServeAnimations (void) +Animator::AnimationId Animator::AddInfiniteAnimation ( + const AnimationFunctor& rAnimation, + const double nDelta) { + OSL_ASSERT( ! mbIsDisposed); + + boost::shared_ptr pAnimation ( + new Animation(rAnimation, nDelta, -1.0, mnNextAnimationId++, FinishFunctor())); + maAnimations.push_back(pAnimation); + + // Prevent redraws except for the ones in TimeoutHandler. + // While the Animator is active it will schedule repaints regularly. + // Repaints in between would only lead to visual artifacts. + mpDrawLock.reset(new DrawLock(mrSlideSorter.GetView())); + maTimer.Start(); + + return pAnimation->mnAnimationId; +} + + + + +void Animator::RemoveAnimation (const Animator::AnimationId nId) +{ + OSL_ASSERT( ! mbIsDisposed); + + const AnimationList::iterator iAnimation (::std::find_if( + maAnimations.begin(), + maAnimations.end(), + ::boost::bind( + ::std::equal_to(), + nId, + ::boost::bind(&Animation::mnAnimationId, _1)))); + if (iAnimation != maAnimations.end()) + { + OSL_ASSERT((*iAnimation)->mnAnimationId == nId); + (*iAnimation)->Expire(); + maAnimations.erase(iAnimation); + } + + // Reset the animation id when we can. + if (maAnimations.empty()) + mnNextAnimationId = 0; +} + + + + +bool Animator::ProcessAnimations (void) +{ + OSL_ASSERT( ! mbIsDisposed); + bool bExpired (false); AnimationList aCopy (maAnimations); @@ -130,6 +212,8 @@ bool Animator::ServeAnimations (void) void Animator::CleanUpAnimationList (void) { + OSL_ASSERT( ! mbIsDisposed); + AnimationList aActiveAnimations; AnimationList::const_iterator iAnimation; @@ -147,7 +231,10 @@ void Animator::CleanUpAnimationList (void) IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) { - if (ServeAnimations()) + if (mbIsDisposed) + return 0; + + if (ProcessAnimations()) CleanUpAnimationList(); // Unlock the draw lock. This should lead to a repaint. @@ -168,11 +255,18 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) //===== Animator::Animation =================================================== Animator::Animation::Animation ( - const Animator::AnimationFunction& rAnimation, - const double nDelta) + const Animator::AnimationFunctor& rAnimation, + const double nDelta, + const double nEnd, + const Animator::AnimationId nId, + const Animator::FinishFunctor& rFinishFunctor) : maAnimation(rAnimation), + maFinishFunctor(rFinishFunctor), mnValue(0), - mnDelta(nDelta) + mnEnd(nEnd), + mnDelta(nDelta), + mnAnimationId(nId), + mbIsExpired(false) { maAnimation(mnValue); @@ -192,16 +286,35 @@ Animator::Animation::~Animation (void) bool Animator::Animation::Run (void) { - if (mnValue < 1.0) + if ( ! mbIsExpired) { - maAnimation(mnValue); - mnValue += mnDelta; - return false; + if (mnEnd>=0 && mnValue>=mnEnd) + { + maAnimation(mnEnd); + Expire(); + return true; + } + else + { + maAnimation(mnValue); + mnValue += mnDelta; + return false; + } } else - { - maAnimation(1.0); return true; +} + + + + +void Animator::Animation::Expire (void) +{ + if ( ! mbIsExpired) + { + mbIsExpired = true; + if (maFinishFunctor) + maFinishFunctor(); } } @@ -210,7 +323,7 @@ bool Animator::Animation::Run (void) bool Animator::Animation::IsExpired (void) { - return mnValue >= 1.0; + return mbIsExpired; } @@ -218,10 +331,10 @@ bool Animator::Animation::IsExpired (void) //===== Animator::DrawLock ==================================================== -Animator::DrawLock::DrawLock (View& rView) +Animator::DrawLock::DrawLock (view::SlideSorterView& rView) : mrView(rView) { - mrView.LockRedraw(TRUE); + mrView.LockRedraw(true); } @@ -229,7 +342,7 @@ Animator::DrawLock::DrawLock (View& rView) Animator::DrawLock::~DrawLock (void) { - mrView.LockRedraw(FALSE); + mrView.LockRedraw(false); } -- cgit From df407bc1d622181187849b6b4c7c377242902757 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Wed, 27 Jan 2010 15:11:16 +0100 Subject: renaissance1: #i107215# Added SlideShowView::DrawLock class. --- .../ui/slidesorter/controller/SlsAnimator.cxx | 36 ++-------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index d7679d88328e..0bc3b0aeb7cd 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -69,19 +69,6 @@ public: -class Animator::DrawLock -{ -public: - DrawLock (view::SlideSorterView& rView); - ~DrawLock (void); - -private: - view::SlideSorterView& mrView; -}; - - - - Animator::Animator (SlideSorter& rSlideSorter) : mrSlideSorter(rSlideSorter), maTimer(), @@ -134,7 +121,7 @@ Animator::AnimationId Animator::AddAnimation ( // Prevent redraws except for the ones in TimeoutHandler. // While the Animator is active it will schedule repaints regularly. // Repaints in between would only lead to visual artifacts. - mpDrawLock.reset(new DrawLock(mrSlideSorter.GetView())); + mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); maTimer.Start(); return pAnimation->mnAnimationId; @@ -156,7 +143,7 @@ Animator::AnimationId Animator::AddInfiniteAnimation ( // Prevent redraws except for the ones in TimeoutHandler. // While the Animator is active it will schedule repaints regularly. // Repaints in between would only lead to visual artifacts. - mpDrawLock.reset(new DrawLock(mrSlideSorter.GetView())); + mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); maTimer.Start(); return pAnimation->mnAnimationId; @@ -242,7 +229,7 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) if (maAnimations.size() > 0) { - mpDrawLock.reset(new DrawLock(mrSlideSorter.GetView())); + mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); maTimer.Start(); } @@ -329,21 +316,4 @@ bool Animator::Animation::IsExpired (void) -//===== Animator::DrawLock ==================================================== - -Animator::DrawLock::DrawLock (view::SlideSorterView& rView) - : mrView(rView) -{ - mrView.LockRedraw(true); -} - - - - -Animator::DrawLock::~DrawLock (void) -{ - mrView.LockRedraw(false); -} - - } } } // end of namespace ::sd::slidesorter::controller -- cgit From 2336af0eb45bee98f98b0ac9a6988bfd0e6193e5 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 28 Jan 2010 13:00:30 +0100 Subject: renaissance1: #i107215# Fixed some minor compilation problems. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 0bc3b0aeb7cd..dff12bda7f3e 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -249,16 +249,14 @@ Animator::Animation::Animation ( const Animator::FinishFunctor& rFinishFunctor) : maAnimation(rAnimation), maFinishFunctor(rFinishFunctor), + mnAnimationId(nId), mnValue(0), mnEnd(nEnd), mnDelta(nDelta), - mnAnimationId(nId), mbIsExpired(false) { - maAnimation(mnValue); mnValue = mnDelta; - } -- cgit From ab518ae9111d251a4e6267ae9f40836b8a7a3913 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Fri, 12 Feb 2010 13:58:24 +0100 Subject: renaissance1: #i107215# Adaption to latest changes of the spec. --- .../ui/slidesorter/controller/SlsAnimator.cxx | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index dff12bda7f3e..69be776179d3 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -53,7 +53,14 @@ public: const Animator::AnimationId nAnimationId, const Animator::FinishFunctor& rFinishFunctor); ~Animation (void); + /** Run next animation step. If animation has reached its end it is + expired. + */ bool Run (void); + /** Typically called when an animation has finished, but also from + Animator::Disposed(). The finish functor is called and the + animation is marked as expired to prevent another run. + */ void Expire (void); bool IsExpired (void); @@ -99,6 +106,12 @@ Animator::~Animator (void) void Animator::Dispose (void) { mbIsDisposed = true; + + AnimationList aCopy (maAnimations); + AnimationList::const_iterator iAnimation; + for (iAnimation=aCopy.begin(); iAnimation!=aCopy.end(); ++iAnimation) + (*iAnimation)->Expire(); + maTimer.Stop(); mpDrawLock.reset(); } @@ -111,7 +124,11 @@ Animator::AnimationId Animator::AddAnimation ( const sal_Int32 nDuration, const FinishFunctor& rFinishFunctor) { + // When the animator is already disposed then ignore this call + // silently (well, we show an assertion, but do not throw an exception.) OSL_ASSERT( ! mbIsDisposed); + if (mbIsDisposed) + return -1; const double nDelta = double(gnResolution) / double(nDuration); boost::shared_ptr pAnimation ( @@ -134,7 +151,11 @@ Animator::AnimationId Animator::AddInfiniteAnimation ( const AnimationFunctor& rAnimation, const double nDelta) { + // When the animator is already disposed then ignore this call + // silently (well, we show an assertion, but do not throw an exception.) OSL_ASSERT( ! mbIsDisposed); + if (mbIsDisposed) + return -1; boost::shared_ptr pAnimation ( new Animation(rAnimation, nDelta, -1.0, mnNextAnimationId++, FinishFunctor())); @@ -180,9 +201,12 @@ void Animator::RemoveAnimation (const Animator::AnimationId nId) bool Animator::ProcessAnimations (void) { + bool bExpired (false); + OSL_ASSERT( ! mbIsDisposed); + if (mbIsDisposed) + return bExpired; - bool bExpired (false); AnimationList aCopy (maAnimations); AnimationList::const_iterator iAnimation; @@ -200,6 +224,8 @@ bool Animator::ProcessAnimations (void) void Animator::CleanUpAnimationList (void) { OSL_ASSERT( ! mbIsDisposed); + if (mbIsDisposed) + return; AnimationList aActiveAnimations; @@ -221,6 +247,8 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) if (mbIsDisposed) return 0; + OSL_TRACE("Animator timeout start"); + if (ProcessAnimations()) CleanUpAnimationList(); @@ -233,6 +261,8 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) maTimer.Start(); } + OSL_TRACE("Animator timeout end"); + return 0; } -- cgit From b5f80146f4f2d780b1d03249e6f5d7d2d27c6d37 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Wed, 17 Feb 2010 13:32:10 +0100 Subject: renaissance1: #i107215# Modified painting and layouting of page objects. --- .../ui/slidesorter/controller/SlsAnimator.cxx | 118 ++++++++++++--------- 1 file changed, 70 insertions(+), 48 deletions(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 69be776179d3..a067428d50ab 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -48,15 +48,16 @@ class Animator::Animation public: Animation ( const Animator::AnimationFunctor& rAnimation, - const double nDelta, - const double nEnd, + const double nDuration, + const double nGlobalTime, const Animator::AnimationId nAnimationId, const Animator::FinishFunctor& rFinishFunctor); ~Animation (void); /** Run next animation step. If animation has reached its end it is expired. */ - bool Run (void); + bool Run (const double nGlobalTime); + /** Typically called when an animation has finished, but also from Animator::Disposed(). The finish functor is called and the animation is marked as expired to prevent another run. @@ -67,9 +68,9 @@ public: Animator::AnimationFunctor maAnimation; Animator::FinishFunctor maFinishFunctor; const Animator::AnimationId mnAnimationId; - double mnValue; + const double mnDuration; const double mnEnd; - const double mnDelta; + const double mnGlobalTimeAtStart; bool mbIsExpired; }; @@ -82,7 +83,8 @@ Animator::Animator (SlideSorter& rSlideSorter) mbIsDisposed(false), maAnimations(), mpDrawLock(), - mnNextAnimationId(0) + mnNextAnimationId(0), + maElapsedTime() { maTimer.SetTimeout(gnResolution); maTimer.SetTimeoutHdl(LINK(this,Animator,TimeoutHandler)); @@ -130,16 +132,16 @@ Animator::AnimationId Animator::AddAnimation ( if (mbIsDisposed) return -1; - const double nDelta = double(gnResolution) / double(nDuration); boost::shared_ptr pAnimation ( - new Animation(rAnimation, nDelta, 1.0, ++mnNextAnimationId, rFinishFunctor)); + new Animation( + rAnimation, + nDuration / 1000.0, + maElapsedTime.getElapsedTime(), + ++mnNextAnimationId, + rFinishFunctor)); maAnimations.push_back(pAnimation); - // Prevent redraws except for the ones in TimeoutHandler. - // While the Animator is active it will schedule repaints regularly. - // Repaints in between would only lead to visual artifacts. - mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); - maTimer.Start(); + RequestNextFrame(); return pAnimation->mnAnimationId; } @@ -158,14 +160,15 @@ Animator::AnimationId Animator::AddInfiniteAnimation ( return -1; boost::shared_ptr pAnimation ( - new Animation(rAnimation, nDelta, -1.0, mnNextAnimationId++, FinishFunctor())); + new Animation( + rAnimation, + -1, + maElapsedTime.getElapsedTime(), + mnNextAnimationId++, + FinishFunctor())); maAnimations.push_back(pAnimation); - // Prevent redraws except for the ones in TimeoutHandler. - // While the Animator is active it will schedule repaints regularly. - // Repaints in between would only lead to visual artifacts. - mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); - maTimer.Start(); + RequestNextFrame(); return pAnimation->mnAnimationId; } @@ -199,7 +202,7 @@ void Animator::RemoveAnimation (const Animator::AnimationId nId) -bool Animator::ProcessAnimations (void) +bool Animator::ProcessAnimations (const double nTime) { bool bExpired (false); @@ -212,7 +215,7 @@ bool Animator::ProcessAnimations (void) AnimationList::const_iterator iAnimation; for (iAnimation=aCopy.begin(); iAnimation!=aCopy.end(); ++iAnimation) { - bExpired |= (*iAnimation)->Run(); + bExpired |= (*iAnimation)->Run(nTime); } return bExpired; @@ -242,26 +245,34 @@ void Animator::CleanUpAnimationList (void) +void Animator::RequestNextFrame (const double nFrameStart) +{ + if ( ! maTimer.IsActive()) + { + // Prevent redraws except for the ones in TimeoutHandler. While the + // Animator is active it will schedule repaints regularly. Repaints + // in between would only lead to visual artifacts. + mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); + maTimer.Start(); + } +} + + + + IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) { if (mbIsDisposed) return 0; - OSL_TRACE("Animator timeout start"); - - if (ProcessAnimations()) + if (ProcessAnimations(maElapsedTime.getElapsedTime())) CleanUpAnimationList(); // Unlock the draw lock. This should lead to a repaint. mpDrawLock.reset(); if (maAnimations.size() > 0) - { - mpDrawLock.reset(new view::SlideSorterView::DrawLock(mrSlideSorter)); - maTimer.Start(); - } - - OSL_TRACE("Animator timeout end"); + RequestNextFrame(); return 0; } @@ -273,20 +284,26 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) Animator::Animation::Animation ( const Animator::AnimationFunctor& rAnimation, - const double nDelta, - const double nEnd, + const double nDuration, + const double nGlobalTime, const Animator::AnimationId nId, const Animator::FinishFunctor& rFinishFunctor) : maAnimation(rAnimation), maFinishFunctor(rFinishFunctor), mnAnimationId(nId), - mnValue(0), - mnEnd(nEnd), - mnDelta(nDelta), + mnDuration(nDuration), + mnEnd(nGlobalTime + nDuration), + mnGlobalTimeAtStart(nGlobalTime), mbIsExpired(false) { - maAnimation(mnValue); - mnValue = mnDelta; + if (mnDuration > 0) + maAnimation(0.0); + else if (mnDuration < 0) + maAnimation(nGlobalTime); + else + { + OSL_ASSERT(mnDuration != 0); + } } @@ -299,25 +316,30 @@ Animator::Animation::~Animation (void) -bool Animator::Animation::Run (void) +bool Animator::Animation::Run (const double nGlobalTime) { if ( ! mbIsExpired) { - if (mnEnd>=0 && mnValue>=mnEnd) + if (mnDuration > 0) { - maAnimation(mnEnd); - Expire(); - return true; + if (nGlobalTime >= mnEnd) + { + maAnimation(1.0); + Expire(); + } + else + { + maAnimation((nGlobalTime - mnGlobalTimeAtStart) / mnDuration); + } } - else + else if (mnDuration < 0) { - maAnimation(mnValue); - mnValue += mnDelta; - return false; + // Animations without end have to be expired by their owner. + maAnimation(nGlobalTime); } } - else - return true; + + return mbIsExpired; } -- cgit From 3c7bf4b67dbe92880d3cb8b7fb24a882651a7ba1 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Tue, 23 Feb 2010 16:56:05 +0100 Subject: renaissance1: #i107215# Improved drag and drop. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index a067428d50ab..b703d192e894 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -194,9 +194,15 @@ void Animator::RemoveAnimation (const Animator::AnimationId nId) maAnimations.erase(iAnimation); } - // Reset the animation id when we can. if (maAnimations.empty()) + { + // Reset the animation id when we can. mnNextAnimationId = 0; + + // No more animations => we do not have to suppress painting + // anymore. + mpDrawLock.reset(); + } } -- cgit From efc8b0f870e318fd790c0258dbd0c92dc7cd83fa Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Tue, 2 Mar 2010 15:54:17 +0100 Subject: renaissance1: #i107215# Modified display of substitution and insertion indicator. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index b703d192e894..052c154aa8b3 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -48,6 +48,7 @@ class Animator::Animation public: Animation ( const Animator::AnimationFunctor& rAnimation, + const double nStartOffset, const double nDuration, const double nGlobalTime, const Animator::AnimationId nAnimationId, @@ -123,6 +124,7 @@ void Animator::Dispose (void) Animator::AnimationId Animator::AddAnimation ( const AnimationFunctor& rAnimation, + const sal_Int32 nStartOffset, const sal_Int32 nDuration, const FinishFunctor& rFinishFunctor) { @@ -135,6 +137,7 @@ Animator::AnimationId Animator::AddAnimation ( boost::shared_ptr pAnimation ( new Animation( rAnimation, + nStartOffset / 1000.0, nDuration / 1000.0, maElapsedTime.getElapsedTime(), ++mnNextAnimationId, @@ -162,6 +165,7 @@ Animator::AnimationId Animator::AddInfiniteAnimation ( boost::shared_ptr pAnimation ( new Animation( rAnimation, + 0, -1, maElapsedTime.getElapsedTime(), mnNextAnimationId++, @@ -290,6 +294,7 @@ IMPL_LINK(Animator, TimeoutHandler, Timer*, EMPTYARG) Animator::Animation::Animation ( const Animator::AnimationFunctor& rAnimation, + const double nStartOffset, const double nDuration, const double nGlobalTime, const Animator::AnimationId nId, @@ -298,18 +303,11 @@ Animator::Animation::Animation ( maFinishFunctor(rFinishFunctor), mnAnimationId(nId), mnDuration(nDuration), - mnEnd(nGlobalTime + nDuration), - mnGlobalTimeAtStart(nGlobalTime), + mnEnd(nGlobalTime + nDuration + nStartOffset), + mnGlobalTimeAtStart(nGlobalTime + nStartOffset), mbIsExpired(false) { - if (mnDuration > 0) - maAnimation(0.0); - else if (mnDuration < 0) - maAnimation(nGlobalTime); - else - { - OSL_ASSERT(mnDuration != 0); - } + Run(nGlobalTime); } @@ -333,7 +331,7 @@ bool Animator::Animation::Run (const double nGlobalTime) maAnimation(1.0); Expire(); } - else + else if (nGlobalTime >= mnGlobalTimeAtStart) { maAnimation((nGlobalTime - mnGlobalTimeAtStart) / mnDuration); } -- cgit From 4b83a7fe5714eb9a1d208502a18e33da35772ece Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Mon, 8 Mar 2010 11:34:08 +0100 Subject: renaissance1: #i107215# Improved handling of transferables. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 052c154aa8b3..91c64a046cb5 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -212,6 +212,25 @@ void Animator::RemoveAnimation (const Animator::AnimationId nId) +void Animator::RemoveAllAnimations (void) +{ + ::std::for_each( + maAnimations.begin(), + maAnimations.end(), + ::boost::bind( + &Animation::Expire, + _1)); + maAnimations.clear(); + mnNextAnimationId = 0; + + // No more animations => we do not have to suppress painting + // anymore. + mpDrawLock.reset(); +} + + + + bool Animator::ProcessAnimations (const double nTime) { bool bExpired (false); -- cgit From 74501923447c8f4497e46fba6db196901ed03632 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Mon, 8 Mar 2010 11:54:53 +0100 Subject: renaissance1: #i107215# Fixed some minor compilation problems. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 91c64a046cb5..1bb762c184c9 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -83,9 +83,9 @@ Animator::Animator (SlideSorter& rSlideSorter) maTimer(), mbIsDisposed(false), maAnimations(), + maElapsedTime(), mpDrawLock(), - mnNextAnimationId(0), - maElapsedTime() + mnNextAnimationId(0) { maTimer.SetTimeout(gnResolution); maTimer.SetTimeoutHdl(LINK(this,Animator,TimeoutHandler)); @@ -156,6 +156,8 @@ Animator::AnimationId Animator::AddInfiniteAnimation ( const AnimationFunctor& rAnimation, const double nDelta) { + (void)nDelta; + // When the animator is already disposed then ignore this call // silently (well, we show an assertion, but do not throw an exception.) OSL_ASSERT( ! mbIsDisposed); @@ -276,6 +278,7 @@ void Animator::CleanUpAnimationList (void) void Animator::RequestNextFrame (const double nFrameStart) { + (void)nFrameStart; if ( ! maTimer.IsActive()) { // Prevent redraws except for the ones in TimeoutHandler. While the -- cgit From 538a067d216e87d2f01b144eb7e711ce0dca93b4 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Wed, 10 Mar 2010 17:33:53 +0100 Subject: renaissance1: #i107215# Improved calculation of insertion indicator, excluded pages. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx index 1bb762c184c9..4e5a236ccde0 100644 --- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx +++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx @@ -116,7 +116,11 @@ void Animator::Dispose (void) (*iAnimation)->Expire(); maTimer.Stop(); - mpDrawLock.reset(); + if (mpDrawLock) + { + mpDrawLock->Dispose(); + mpDrawLock.reset(); + } } -- cgit From 436416a6320037855846fce127a0cfa77ac45270 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 8 Jul 2010 12:27:24 +0200 Subject: renaissance1: resolved merge conflicts, cleanup. --- sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 sd/source/ui/slidesorter/controller/SlsAnimator.cxx (limited to 'sd/source/ui/slidesorter/controller/SlsAnimator.cxx') diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx old mode 100644 new mode 100755 -- cgit