LibreOffice Module sd (master) 1
|
Experimental class for simple eye candy animations. More...
#include <SlsAnimator.hxx>
Classes | |
class | Animation |
Handle one animation function by using a timer for frequent calls to the animations operator(). More... | |
Public Types | |
enum | AnimationMode { AM_Animated , AM_Immediate } |
In some circumstances we have to avoid animation and jump to the final animation state immediately. More... | |
typedef ::std::function< void(double)> | AnimationFunctor |
An animation object is called with values between 0 and 1 as single argument to its operator() method. More... | |
typedef ::std::function< void()> | FinishFunctor |
typedef sal_Int32 | AnimationId |
Public Member Functions | |
Animator (SlideSorter &rSlideSorter) | |
~Animator () | |
Animator (const Animator &)=delete | |
Animator & | operator= (const Animator &)=delete |
void | Dispose () |
When disposed the animator will stop its work immediately and not process any timer events anymore. More... | |
AnimationId | AddAnimation (const AnimationFunctor &rAnimation, const FinishFunctor &rFinishFunctor) |
Schedule a new animation for execution. More... | |
void | RemoveAnimation (const AnimationId nAnimationId) |
Abort and remove an animation. More... | |
void | RemoveAllAnimations () |
A typical use case for this method is the temporary shutdown of the slidesorter when the slide sorter bar is put into a cache due to a change of the edit mode. More... | |
Static Public Attributes | |
static const AnimationId | NotAnAnimationId = -1 |
Private Types | |
typedef ::std::vector< std::shared_ptr< Animation > > | AnimationList |
Private Member Functions | |
DECL_LINK (TimeoutHandler, Timer *, void) | |
bool | ProcessAnimations (const double nTime) |
Execute one step of every active animation. More... | |
void | CleanUpAnimationList () |
Remove animations that have expired. More... | |
void | RequestNextFrame () |
Private Attributes | |
SlideSorter & | mrSlideSorter |
Idle | maIdle |
bool | mbIsDisposed |
AnimationList | maAnimations |
::canvas::tools::ElapsedTime | maElapsedTime |
std::unique_ptr< view::SlideSorterView::DrawLock, o3tl::default_delete< view::SlideSorterView::DrawLock > > | mpDrawLock |
AnimationId | mnNextAnimationId |
Experimental class for simple eye candy animations.
Definition at line 38 of file SlsAnimator.hxx.
typedef ::std::function<void (double)> sd::slidesorter::controller::Animator::AnimationFunctor |
An animation object is called with values between 0 and 1 as single argument to its operator() method.
Definition at line 60 of file SlsAnimator.hxx.
typedef sal_Int32 sd::slidesorter::controller::Animator::AnimationId |
Definition at line 63 of file SlsAnimator.hxx.
|
private |
Definition at line 94 of file SlsAnimator.hxx.
typedef ::std::function<void ()> sd::slidesorter::controller::Animator::FinishFunctor |
Definition at line 61 of file SlsAnimator.hxx.
In some circumstances we have to avoid animation and jump to the final animation state immediately.
Use this enum instead of a bool to be more expressive.
Enumerator | |
---|---|
AM_Animated | |
AM_Immediate |
Definition at line 45 of file SlsAnimator.hxx.
|
explicit |
Definition at line 61 of file SlsAnimator.cxx.
References LINK, maIdle, Timer::SetInvokeHandler(), and Task::SetPriority().
sd::slidesorter::controller::Animator::~Animator | ( | ) |
Definition at line 71 of file SlsAnimator.cxx.
References Dispose(), and mbIsDisposed.
|
delete |
Animator::AnimationId sd::slidesorter::controller::Animator::AddAnimation | ( | const AnimationFunctor & | rAnimation, |
const FinishFunctor & | rFinishFunctor | ||
) |
Schedule a new animation for execution.
The () operator of that animation will be called with increasing values between 0 and 1 for the specified duration.
rAnimation | The animation operation. |
Definition at line 96 of file SlsAnimator.cxx.
References canvas::tools::ElapsedTime::getElapsedTime(), maAnimations, maElapsedTime, mbIsDisposed, mnNextAnimationId, and RequestNextFrame().
|
private |
Remove animations that have expired.
Definition at line 179 of file SlsAnimator.cxx.
References maAnimations, and mbIsDisposed.
|
private |
void sd::slidesorter::controller::Animator::Dispose | ( | ) |
When disposed the animator will stop its work immediately and not process any timer events anymore.
Definition at line 80 of file SlsAnimator.cxx.
References maAnimations, maIdle, mbIsDisposed, mpDrawLock, and Task::Stop().
Referenced by ~Animator().
|
private |
Execute one step of every active animation.
nTime | Time measured in milliseconds with some arbitrary reference point. |
Definition at line 162 of file SlsAnimator.cxx.
References maAnimations, and mbIsDisposed.
void sd::slidesorter::controller::Animator::RemoveAllAnimations | ( | ) |
A typical use case for this method is the temporary shutdown of the slidesorter when the slide sorter bar is put into a cache due to a change of the edit mode.
Definition at line 148 of file SlsAnimator.cxx.
References maAnimations, mnNextAnimationId, and mpDrawLock.
void sd::slidesorter::controller::Animator::RemoveAnimation | ( | const AnimationId | nAnimationId | ) |
Abort and remove an animation.
In order to reduce the bookkeeping on the caller side, it is OK to call this method with an animation function that is not currently being animated. Such a call is silently ignored.
Definition at line 121 of file SlsAnimator.cxx.
References maAnimations, mbIsDisposed, mnNextAnimationId, mpDrawLock, and nId.
|
private |
Definition at line 196 of file SlsAnimator.cxx.
References Task::IsActive(), maIdle, mpDrawLock, mrSlideSorter, and Idle::Start().
Referenced by AddAnimation().
|
private |
Definition at line 95 of file SlsAnimator.hxx.
Referenced by AddAnimation(), CleanUpAnimationList(), Dispose(), ProcessAnimations(), RemoveAllAnimations(), and RemoveAnimation().
|
private |
Definition at line 96 of file SlsAnimator.hxx.
Referenced by AddAnimation().
|
private |
Definition at line 91 of file SlsAnimator.hxx.
Referenced by Animator(), Dispose(), and RequestNextFrame().
|
private |
Definition at line 92 of file SlsAnimator.hxx.
Referenced by AddAnimation(), CleanUpAnimationList(), Dispose(), ProcessAnimations(), RemoveAnimation(), and ~Animator().
|
private |
Definition at line 100 of file SlsAnimator.hxx.
Referenced by AddAnimation(), RemoveAllAnimations(), and RemoveAnimation().
|
private |
Definition at line 98 of file SlsAnimator.hxx.
Referenced by Dispose(), RemoveAllAnimations(), RemoveAnimation(), and RequestNextFrame().
|
private |
Definition at line 90 of file SlsAnimator.hxx.
Referenced by RequestNextFrame().
|
static |
Definition at line 64 of file SlsAnimator.hxx.