diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-05-13 13:26:58 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-05-13 13:26:58 +0000 |
commit | fc77169830f1deebe609c3ea42046f3ca6fb7e24 (patch) | |
tree | e48085e748e9574f8048d93372b6b21bc3c72229 /sdext/source/presenter/PresenterAnimator.cxx | |
parent | 125e504f8e9fec215013ec32a2687e55941e7f03 (diff) |
INTEGRATION: CWS presenterscreen (1.2.4); FILE MERGED
2008/04/22 08:26:51 af 1.2.4.3: RESYNC: (1.2-1.3); FILE MERGED
2008/04/18 14:51:11 af 1.2.4.2: #i18486# Changed implementation of PresenterTimer.
2008/04/16 15:23:30 af 1.2.4.1: #i18486# Code cleanup.
Diffstat (limited to 'sdext/source/presenter/PresenterAnimator.cxx')
-rw-r--r-- | sdext/source/presenter/PresenterAnimator.cxx | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/sdext/source/presenter/PresenterAnimator.cxx b/sdext/source/presenter/PresenterAnimator.cxx index 5acc2ec..fc0da1a 100644 --- a/sdext/source/presenter/PresenterAnimator.cxx +++ b/sdext/source/presenter/PresenterAnimator.cxx @@ -8,7 +8,7 @@ * * $RCSfile: PresenterAnimator.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -31,6 +31,7 @@ #include "PresenterAnimator.hxx" +#include "PresenterTimer.hxx" #include <osl/diagnose.h> #include <osl/time.h> #include <vos/timer.hxx> @@ -41,30 +42,12 @@ namespace sdext { namespace presenter { -//===== PresenterAnimator::Timer ============================================== - -class PresenterAnimator::Timer : public ::vos::OTimer -{ -public: - typedef ::boost::function0<void> Callback; - Timer (const Callback& rCallback) : maCallback(rCallback){ acquire(); }; - virtual ~Timer (void) { }; - void Dispose (void) { stop(); release(); }; -protected: - virtual void SAL_CALL onShot (void) { maCallback(); }; -private: - Callback maCallback; -}; - - - - //===== PresenterAnimator ===================================================== PresenterAnimator::PresenterAnimator (void) : maFutureAnimations(), maActiveAnimations(), - mpTimer(new Timer(::boost::bind(&PresenterAnimator::Process, this))), + mnCurrentTaskId(0), mnNextTime(0) { } @@ -74,7 +57,7 @@ PresenterAnimator::PresenterAnimator (void) PresenterAnimator::~PresenterAnimator (void) { - mpTimer->Dispose(); + PresenterTimer::CancelTask(mnCurrentTaskId); } @@ -97,7 +80,6 @@ void PresenterAnimator::Process (void) ::osl::MutexGuard aGuard (m_aMutex); mnNextTime = 0; - mpTimer->stop(); const sal_uInt64 nCurrentTime (GetCurrentTime()); @@ -120,7 +102,8 @@ void PresenterAnimator::Process (void) else if (nProgress >= 1) nProgress = 1; - OSL_TRACE("running animation step at %d (requested was %d)\n", nCurrentTime, nRequestedTime); + OSL_TRACE("running animation step at %f (requested was %f) %f\n", + nCurrentTime/1e6, nRequestedTime/1e6, nProgress); pAnimation->Run(nProgress, nCurrentTime); if (nCurrentTime < pAnimation->GetEndTime()) @@ -179,10 +162,10 @@ void PresenterAnimator::ScheduleNextRun (const sal_uInt64 nStartTime) if (mnNextTime==0 || nStartTime<mnNextTime) { mnNextTime = nStartTime; - mpTimer->stop(); ::vos::TTimeValue aTimeValue (GetSeconds(mnNextTime), GetNanoSeconds(mnNextTime)); - mpTimer->setAbsoluteTime(aTimeValue); - mpTimer->start(); + PresenterTimer::ScheduleSingleTaskAbsolute ( + ::boost::bind(&PresenterAnimator::Process, this), + aTimeValue); } } |