diff options
author | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-12-19 13:01:46 +0000 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2015-03-06 12:27:04 +0000 |
commit | 9e678c14e4fc8e58b1e0530744f648fa3958d338 (patch) | |
tree | 53ccb6244cff1b2ee39bc4d7605f103108fa45bc /sc/source/ui/app | |
parent | 1028643bc7d294e4c32b4ccea288d90088abae53 (diff) |
Timer: Reversed some Idles to Timer
Change-Id: I213722cc98490430378014290cb09cca9e469bbb
Diffstat (limited to 'sc/source/ui/app')
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index fd8d866353fa..5c63049fda2f 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -112,6 +112,13 @@ #include "formulagroup.hxx" #include <documentlinkmgr.hxx> +#define SC_IDLE_MIN 150 +#define SC_IDLE_MAX 3000 +#define SC_IDLE_STEP 75 +#define SC_IDLE_COUNT 50 + +static sal_uInt16 nIdleCount = 0; + SFX_IMPL_INTERFACE(ScModule, SfxShell) void ScModule::InitInterface_Impl() @@ -169,9 +176,9 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : aSpellIdle.SetPriority(VCL_IDLE_PRIORITY_REPAINT); aSpellIdle.SetIdleHdl( LINK( this, ScModule, SpellTimerHdl ) ); - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); - aIdle.SetIdleHdl( LINK( this, ScModule, IdleHandler ) ); - aIdle.Start(); + aIdleTimer.SetTimeout(SC_IDLE_MIN); + aIdleTimer.SetTimeoutHdl( LINK( this, ScModule, IdleHandler ) ); + aIdleTimer.Start(); pMessagePool = new ScMessagePool; pMessagePool->FreezeIdRanges(); @@ -1844,7 +1851,11 @@ void ScModule::EndReference() */ void ScModule::AnythingChanged() { - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); + sal_uLong nOldTime = aIdleTimer.GetTimeout(); + if ( nOldTime != SC_IDLE_MIN ) + aIdleTimer.SetTimeout( SC_IDLE_MIN ); + + nIdleCount = 0; } static void lcl_CheckNeedsRepaint( ScDocShell* pDocShell ) @@ -1864,7 +1875,7 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) { if ( Application::AnyInput( VCL_INPUT_MOUSEANDKEYBOARD ) ) { - aIdle.Start(); // Timeout unchanged + aIdleTimer.Start(); // Timeout unchanged return 0; } @@ -1905,12 +1916,30 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) } } - if (bMore) - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOW); + sal_uLong nOldTime = aIdleTimer.GetTimeout(); + sal_uLong nNewTime = nOldTime; + if ( bMore ) + { + nNewTime = SC_IDLE_MIN; + nIdleCount = 0; + } else - aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWEST); + { + // Set SC_IDLE_COUNT to initial Timeout - increase afterwards + if ( nIdleCount < SC_IDLE_COUNT ) + ++nIdleCount; + else + { + nNewTime += SC_IDLE_STEP; + if ( nNewTime > SC_IDLE_MAX ) + nNewTime = SC_IDLE_MAX; + } + } + if ( nNewTime != nOldTime ) + aIdleTimer.SetTimeout( nNewTime ); + - aIdle.Start(); + aIdleTimer.Start(); return 0; } |