diff options
author | Jennifer Liebel <jliebel94@gmail.com> | 2014-11-05 09:08:02 +0000 |
---|---|---|
committer | Tobias Madl <tobias.madl.dev@gmail.com> | 2014-12-09 12:34:50 +0000 |
commit | 19b7dc3b1ef8b77d509f46dca96fb0f797abe38c (patch) | |
tree | bf1d9210efc35eeda733e2cb964852778bd30c6d | |
parent | 379f61127e9851e91197007c706c24f479da2b38 (diff) |
changed timers to idles
Change-Id: Iebde351b3bfca907a7730b7af379efb040cbeae2
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 2 | ||||
-rw-r--r-- | sc/inc/chartlis.hxx | 2 | ||||
-rw-r--r-- | sc/inc/scmod.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/chartlis.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 57 | ||||
-rw-r--r-- | svx/inc/svdibrow.hxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdibrow.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdpntv.cxx | 2 |
8 files changed, 30 insertions, 64 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 4233b3ea9422..fcc9c24cfcf8 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -146,7 +146,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : aStatusTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, StatusTimerHdl ) ); aIdleFormatter.SetPriority( VCL_IDLE_PRIORITY_REPAINT ); - aIdleFormatter.SetTimeoutHdl( LINK( this, ImpEditEngine, IdleFormatHdl ) ); + aIdleFormatter.SetIdleHdl( LINK( this, ImpEditEngine, IdleFormatHdl ) ); aOnlineSpellTimer.SetTimeout( 100 ); aOnlineSpellTimer.SetTimeoutHdl( LINK( this, ImpEditEngine, OnlineSpellHdl ) ); diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx index 9952d4bc6a03..060546081f26 100644 --- a/sc/inc/chartlis.hxx +++ b/sc/inc/chartlis.hxx @@ -150,7 +150,7 @@ private: ::std::list<RangeListenerItem> maHiddenListeners; StringSetType maNonOleObjectNames; - Timer aTimer; + Idle aIdle; ScDocument* pDoc; DECL_LINK(TimerHdl, void *); diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 59b1ab010468..7d23cc7657bd 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -81,8 +81,8 @@ class ScAnyRefModalDlg; class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener { - Timer aIdleTimer; - Timer aSpellTimer; + Idle aIdle; + Idle aSpellIdle; ScDragData* mpDragData; ScClipData* mpClipData; ScSelectionTransferObj* pSelTransfer; diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx index d68b3538a08c..a565d961e528 100644 --- a/sc/source/core/tool/chartlis.cxx +++ b/sc/source/core/tool/chartlis.cxx @@ -414,7 +414,7 @@ ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) : meModifiedDuringUpdate( SC_CLCUPDATE_NONE ), pDoc( pDocP ) { - aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); + aIdle.SetIdleHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); } ScChartListenerCollection::ScChartListenerCollection( @@ -422,12 +422,12 @@ ScChartListenerCollection::ScChartListenerCollection( meModifiedDuringUpdate( SC_CLCUPDATE_NONE ), pDoc( rColl.pDoc ) { - aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); + aIdle.SetIdleHdl( LINK( this, ScChartListenerCollection, TimerHdl ) ); } ScChartListenerCollection::~ScChartListenerCollection() { - // remove ChartListener objects before aTimer dtor is called, because + // remove ChartListener objects before aIdle dtor is called, because // ScChartListener::EndListeningTo may cause ScChartListenerCollection::StartTimer // to be called if an empty ScNoteCell is deleted @@ -589,15 +589,15 @@ void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartData void ScChartListenerCollection::StartTimer() { - aTimer.SetTimeout( SC_CHARTTIMEOUT ); - aTimer.Start(); + aIdle.SetPriority( VCL_IDLE_PRIORITY_REPAINT ); + aIdle.Start(); } IMPL_LINK_NOARG(ScChartListenerCollection, TimerHdl) { if ( Application::AnyInput( VCL_INPUT_KEYBOARD ) ) { - aTimer.Start(); + aIdle.Start(); return 0; } UpdateDirtyCharts(); @@ -618,10 +618,7 @@ void ScChartListenerCollection::UpdateDirtyCharts() if (p->IsDirty()) p->Update(); - if (meModifiedDuringUpdate == SC_CLCUPDATE_MODIFIED) - break; // iterator is invalid - - if (aTimer.IsActive() && !pDoc->IsImportingXML()) + if (aIdle.IsActive() && !pDoc->IsImportingXML()) break; // one interfered } meModifiedDuringUpdate = SC_CLCUPDATE_NONE; diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 947264423957..80a7de377eab 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -112,14 +112,7 @@ #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) +SFX_IMPL_INTERFACE(ScModule, SfxShell, ScResId(RID_APPTITLE)) void ScModule::InitInterface_Impl() { @@ -174,11 +167,11 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : ERRCODE_AREA_APP2-1, GetResMgr() ); - aSpellTimer.SetTimeout(10); - aSpellTimer.SetTimeoutHdl( LINK( this, ScModule, SpellTimerHdl ) ); - aIdleTimer.SetTimeout(SC_IDLE_MIN); - aIdleTimer.SetTimeoutHdl( LINK( this, ScModule, IdleHandler ) ); - aIdleTimer.Start(); + 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(); pMessagePool = new ScMessagePool; pMessagePool->FreezeIdRanges(); @@ -1851,11 +1844,7 @@ void ScModule::EndReference() */ void ScModule::AnythingChanged() { - sal_uLong nOldTime = aIdleTimer.GetTimeout(); - if ( nOldTime != SC_IDLE_MIN ) - aIdleTimer.SetTimeout( SC_IDLE_MIN ); - - nIdleCount = 0; + aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER); } static void lcl_CheckNeedsRepaint( ScDocShell* pDocShell ) @@ -1875,7 +1864,7 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) { if ( Application::AnyInput( VCL_INPUT_MOUSEANDKEYBOARD ) ) { - aIdleTimer.Start(); // Timeout unchanged + aIdle.Start(); // Timeout unchanged return 0; } @@ -1910,35 +1899,15 @@ IMPL_LINK_NOARG(ScModule, IdleHandler) bool bSpell = pViewSh->ContinueOnlineSpelling(); if (bSpell) { - aSpellTimer.Start(); + aSpellIdle.Start(); bMore = true; } } } - sal_uLong nOldTime = aIdleTimer.GetTimeout(); - sal_uLong nNewTime = nOldTime; - if ( bMore ) - { - nNewTime = SC_IDLE_MIN; - nIdleCount = 0; - } - else - { - // 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.SetPriority(VCL_IDLE_PRIORITY_LOWEST); - aIdleTimer.Start(); + aIdle.Start(); return 0; } @@ -1946,7 +1915,7 @@ IMPL_LINK_NOARG(ScModule, SpellTimerHdl) { if ( Application::AnyInput( VCL_INPUT_KEYBOARD ) ) { - aSpellTimer.Start(); + aSpellIdle.Start(); return 0; // Later again ... } @@ -1954,7 +1923,7 @@ IMPL_LINK_NOARG(ScModule, SpellTimerHdl) if (pViewSh) { if (pViewSh->ContinueOnlineSpelling()) - aSpellTimer.Start(); + aSpellIdle.Start(); } return 0; } diff --git a/svx/inc/svdibrow.hxx b/svx/inc/svdibrow.hxx index f4c4a0f85bf7..c2a032c9d5ab 100644 --- a/svx/inc/svdibrow.hxx +++ b/svx/inc/svdibrow.hxx @@ -114,7 +114,7 @@ public: class SdrView; class SdrItemBrowser: public _SdrItemBrowserWindow { - Idle aIdleTimer; + Idle aIdle; SdrView* pView; bool bDirty; private: diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index 18195215abd7..22f1733aaa4e 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -1074,7 +1074,7 @@ SdrItemBrowser::SdrItemBrowser(SdrView& rView): pView(&rView), bDirty(false) { - aIdleTimer.SetTimeoutHdl(LINK(this,SdrItemBrowser,IdleHdl)); + aIdle.SetIdleHdl(LINK(this,SdrItemBrowser,IdleHdl)); GetBrowserControl().SetEntryChangedHdl(LINK(this,SdrItemBrowser,ChangedHdl)); GetBrowserControl().SetSetDirtyHdl(LINK(this,SdrItemBrowser,SetDirtyHdl)); SetDirty(); @@ -1107,14 +1107,14 @@ void SdrItemBrowser::SetDirty() { if (!bDirty) { bDirty = true; - aIdleTimer.SetPriority(VCL_IDLE_PRIORITY_HIGH); - aIdleTimer.Start(); + aIdle.SetPriority(VCL_IDLE_PRIORITY_HIGH); + aIdle.Start(); } } void SdrItemBrowser::Undirty() { - aIdleTimer.Stop(); + aIdle.Stop(); bDirty = false; SfxItemSet aSet(pView->GetModel()->GetItemPool()); diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index f48611f961ae..5e69118fe440 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -191,7 +191,7 @@ void SdrPaintView::ImpClearVars() bSomeObjChgdFlag=false; nGraphicManagerDrawMode = GRFMGR_DRAW_STANDARD; aComeBackIdle.SetPriority(VCL_IDLE_PRIORITY_HIGH); - aComeBackIdle.SetTimeoutHdl(LINK(this,SdrPaintView,ImpComeBackHdl)); + aComeBackIdle.SetIdleHdl(LINK(this,SdrPaintView,ImpComeBackHdl)); if (pMod) SetDefaultStyleSheet(pMod->GetDefaultStyleSheet(), true); |