[Libreoffice-commits] core.git: Branch 'feature/priorities' - editeng/source sc/inc sc/source slideshow/test svx/inc svx/source

Jennifer Liebel jliebel94 at gmail.com
Wed Nov 5 01:10:38 PST 2014


 editeng/source/editeng/impedit2.cxx |    2 -
 sc/inc/chartlis.hxx                 |    2 -
 sc/inc/scmod.hxx                    |    4 +-
 sc/source/core/tool/chartlis.cxx    |   14 ++++-----
 sc/source/ui/app/scmod.cxx          |   55 +++++++-----------------------------
 slideshow/test/demoshow.cxx         |    5 ---
 svx/inc/svdibrow.hxx                |    2 -
 svx/source/svdraw/svdibrow.cxx      |    8 ++---
 svx/source/svdraw/svdpntv.cxx       |    2 -
 9 files changed, 30 insertions(+), 64 deletions(-)

New commits:
commit 298b9992a74b76f0dae03c4f57d73807d107b034
Author: Jennifer Liebel <jliebel94 at gmail.com>
Date:   Wed Nov 5 09:08:02 2014 +0000

    changed timers to idles
    
    Change-Id: Iebde351b3bfca907a7730b7af379efb040cbeae2

diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 27c2ad9..c2bfdb2 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 f9a3641..a38ed80 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -144,7 +144,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 136f08f..1b31884 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 be56325..1043841 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -413,19 +413,19 @@ ScChartListenerCollection::RangeListenerItem::RangeListenerItem(const ScRange& r
 ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
     pDoc( pDocP )
 {
-    aTimer.SetTimeoutHdl( LINK( this, ScChartListenerCollection, TimerHdl ) );
+    aIdle.SetIdleHdl( LINK( this, ScChartListenerCollection, TimerHdl ) );
 }
 
 ScChartListenerCollection::ScChartListenerCollection(
         const ScChartListenerCollection& rColl ) :
     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
 
@@ -577,15 +577,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();
@@ -601,7 +601,7 @@ void ScChartListenerCollection::UpdateDirtyCharts()
         if (p->IsDirty())
             p->Update();
 
-        if (aTimer.IsActive() && !pDoc->IsImportingXML())
+        if (aIdle.IsActive() && !pDoc->IsImportingXML())
             break;                      // one interfered
     }
 }
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index abbcb21..23b592b 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -112,13 +112,6 @@
 #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, 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/slideshow/test/demoshow.cxx b/slideshow/test/demoshow.cxx
index e3409e5..dd4ee48 100644
--- a/slideshow/test/demoshow.cxx
+++ b/slideshow/test/demoshow.cxx
@@ -469,10 +469,7 @@ IMPL_LINK_NOARG(DemoWindow, updateHdl)
     init();
 
     if( mxShow.is() )
-    {
-        double nTimeout;
-        mxShow->update(nTimeout);
-    }
+        mxShow->update(0);
     return 0;
 }
 
diff --git a/svx/inc/svdibrow.hxx b/svx/inc/svdibrow.hxx
index f4c4a0f..c2a032c 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 2694111..028bb3a 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 3fdde7e..eee6831 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);


More information about the Libreoffice-commits mailing list