[Libreoffice-commits] core.git: Branch 'feature/priorities' - formula/source include/formula svtools/source svx/source vcl/source

Tobias Madl tobias.madl.dev at gmail.com
Thu Nov 20 08:22:20 PST 2014


 formula/source/ui/dlg/formula.cxx  |   18 +++++++++---------
 formula/source/ui/dlg/funcutl.cxx  |   26 ++++++++++++--------------
 include/formula/funcutl.hxx        |    2 +-
 svtools/source/contnr/imivctl.hxx  |    8 ++++----
 svtools/source/contnr/imivctl1.cxx |   12 ++++++------
 svx/source/dialog/imapdlg.cxx      |    8 ++++----
 svx/source/dialog/imapimp.hxx      |    2 +-
 vcl/source/window/dockmgr.cxx      |   26 +++++++++++++-------------
 vcl/source/window/dockwin.cxx      |   14 +++++++-------
 9 files changed, 57 insertions(+), 59 deletions(-)

New commits:
commit 918cb026bf0d3d7feb7f299ad4a4c83cda8ea504
Author: Tobias Madl <tobias.madl.dev at gmail.com>
Date:   Thu Nov 20 16:21:17 2014 +0000

    changed timers to idles
    
    Change-Id: Iaceef008e7df91f3a9ad54fdaec25f2170100ee0

diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 5573f72..16d96fe 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -183,7 +183,7 @@ namespace formula
         bool        bStructUpdate;
         MultiLineEdit*  pMEdit;
         bool        bUserMatrixFlag;
-        Timer           aTimer;
+        Idle            aIdle;
 
         const OUString  aTitle1;
         const OUString  aTitle2;
@@ -353,11 +353,11 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
 
 FormulaDlg_Impl::~FormulaDlg_Impl()
 {
-    if(aTimer.IsActive())
+    if(aIdle.IsActive())
     {
-        aTimer.SetTimeoutHdl(Link());
-        aTimer.Stop();
-    }// if(aTimer.IsActive())
+        aIdle.SetIdleHdl(Link());
+        aIdle.Stop();
+    }// if(aIdle.IsActive())
     bIsShutDown=true;// Set it in order to PreNotify not to save GetFocus.
 
     m_pTabCtrl->RemovePage(TP_FUNCTION);
@@ -412,7 +412,7 @@ void FormulaDlg_Impl::PreNotify( NotifyEvent& rNEvt )
 
                 FormEditData* pData = m_pHelper->getFormEditData();
 
-                if (pData && !aTimer.IsActive()) // won't be destroyed via Close
+                if (pData && !aIdle.IsActive()) // won't be destroyed via Close
                 {
                     pData->SetUniqueId(aActivWinId);
                 }
@@ -1773,9 +1773,9 @@ OUString FormulaDlg::GetMeText() const
 void FormulaDlg::Update()
 {
     m_pImpl->Update();
-    m_pImpl->aTimer.SetTimeout(200);
-    m_pImpl->aTimer.SetTimeoutHdl(LINK( this, FormulaDlg, UpdateFocusHdl));
-    m_pImpl->aTimer.Start();
+    m_pImpl->aIdle.SetPriority(VCL_IDLE_PRIORITY_LOWER);
+    m_pImpl->aIdle.SetIdleHdl(LINK( this, FormulaDlg, UpdateFocusHdl));
+    m_pImpl->aIdle.Start();
 }
 
 void FormulaDlg::DoEnter(bool _bOk)
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index c02ed91..b089718 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -455,15 +455,13 @@ void EditBox::UpdateOldSel()
 
 // class RefEdit
 
-#define SC_ENABLE_TIME 100
-
 RefEdit::RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits nStyle )
     : Edit( _pParent, nStyle )
     , pAnyRefDlg( NULL )
     , pLabelWidget(pShrinkModeLabel)
 {
-    aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
-    aTimer.SetTimeout( SC_ENABLE_TIME );
+    aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) );
+    aIdle.SetPriority( VCL_IDLE_PRIORITY_LOW );
 }
 
 RefEdit::RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent,
@@ -472,8 +470,8 @@ RefEdit::RefEdit( vcl::Window* _pParent,IControlReferenceHandler* pParent,
     , pAnyRefDlg( pParent )
     , pLabelWidget(pShrinkModeLabel)
 {
-    aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
-    aTimer.SetTimeout( SC_ENABLE_TIME );
+    aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) );
+    aIdle.SetPriority( VCL_IDLE_PRIORITY_LOW );
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefEdit(vcl::Window *pParent, VclBuilder::stringmap &)
@@ -483,8 +481,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefEdit(vcl::Window *p
 
 RefEdit::~RefEdit()
 {
-    aTimer.SetTimeoutHdl( Link() );
-    aTimer.Stop();
+    aIdle.SetIdleHdl( Link() );
+    aIdle.Stop();
 }
 
 void RefEdit::SetRefString( const OUString& rStr )
@@ -509,12 +507,12 @@ void RefEdit::SetRefValid(bool bValid)
 void RefEdit::SetText(const OUString& rStr)
 {
     Edit::SetText( rStr );
-    UpdateHdl( &aTimer );
+    UpdateHdl( &aIdle );
 }
 
 void RefEdit::StartUpdateData()
 {
-    aTimer.Start();
+    aIdle.Start();
 }
 
 void RefEdit::SetReferences( IControlReferenceHandler* pDlg, vcl::Window* pLabel )
@@ -524,13 +522,13 @@ void RefEdit::SetReferences( IControlReferenceHandler* pDlg, vcl::Window* pLabel
 
     if( pDlg )
     {
-        aTimer.SetTimeoutHdl( LINK( this, RefEdit, UpdateHdl ) );
-        aTimer.SetTimeout( SC_ENABLE_TIME );
+        aIdle.SetIdleHdl( LINK( this, RefEdit, UpdateHdl ) );
+        aIdle.SetPriority( VCL_IDLE_PRIORITY_LOW );
     }
     else
     {
-        aTimer.SetTimeoutHdl( Link() );
-        aTimer.Stop();
+        aIdle.SetIdleHdl( Link() );
+        aIdle.Stop();
     }
 }
 
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
index 097d737..bc40705 100644
--- a/include/formula/funcutl.hxx
+++ b/include/formula/funcutl.hxx
@@ -32,7 +32,7 @@ class IControlReferenceHandler;
 class FORMULA_DLLPUBLIC RefEdit : public Edit
 {
 private:
-    Timer                     aTimer;
+    Idle                      aIdle;
     IControlReferenceHandler* pAnyRefDlg; // parent dialog
     vcl::Window*                   pLabelWidget;
 
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index 688516a..c599a39 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -166,8 +166,8 @@ class SvxIconChoiceCtrl_Impl
     std::vector<Rectangle*> aSelectedRectList;
     Idle                    aEditIdle;                 // for editing in place
     Idle                    aAutoArrangeIdle;
-    Timer                   aDocRectChangedTimer;
-    Timer                   aVisRectChangedTimer;
+    Idle                    aDocRectChangedIdle;
+    Idle                    aVisRectChangedIdle;
     Idle                    aCallSelectHdlIdle;
     Size                    aVirtOutputSize;
     Size                    aImageSize;
@@ -308,8 +308,8 @@ class SvxIconChoiceCtrl_Impl
                         {
                             return (ePositionMode == IcnViewPositionModeAutoAdjust);
                         }
-    void                DocRectChanged() { aDocRectChangedTimer.Start(); }
-    void                VisRectChanged() { aVisRectChangedTimer.Start(); }
+    void                DocRectChanged() { aDocRectChangedIdle.Start(); }
+    void                VisRectChanged() { aVisRectChangedIdle.Start(); }
     void                SetOrigin( const Point&, bool bDoNotUpdateWallpaper = false );
 
                         DECL_LINK(TextEditEndedHdl, void *);
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index d61f6a4..564f2eb 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -142,10 +142,10 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aCallSelectHdlIdle.SetPriority( VCL_IDLE_PRIORITY_LOWEST );
     aCallSelectHdlIdle.SetIdleHdl( LINK(this,SvxIconChoiceCtrl_Impl,CallSelectHdlHdl));
 
-    aDocRectChangedTimer.SetTimeout( 50 );
-    aDocRectChangedTimer.SetTimeoutHdl(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl));
-    aVisRectChangedTimer.SetTimeout( 50 );
-    aVisRectChangedTimer.SetTimeoutHdl(LINK(this,SvxIconChoiceCtrl_Impl,VisRectChangedHdl));
+    aDocRectChangedIdle.SetPriority( VCL_IDLE_PRIORITY_MEDIUM );
+    aDocRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,DocRectChangedHdl));
+    aVisRectChangedIdle.SetPriority( VCL_IDLE_PRIORITY_MEDIUM );
+    aVisRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,VisRectChangedHdl));
 
     Clear( true );
 
@@ -2895,14 +2895,14 @@ IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, AutoArrangeHdl)
 
 IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, VisRectChangedHdl)
 {
-    aVisRectChangedTimer.Stop();
+    aVisRectChangedIdle.Stop();
     pView->VisibleRectChanged();
     return 0;
 }
 
 IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, DocRectChangedHdl)
 {
-    aDocRectChangedTimer.Stop();
+    aDocRectChangedIdle.Stop();
     pView->DocumentRectChanged();
     return 0;
 }
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index abcc768..99a8529 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -210,8 +210,8 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window
     m_pCbbTarget->Disable();
     pOwnData->bExecState = false;
 
-    pOwnData->aTimer.SetTimeout( 100 );
-    pOwnData->aTimer.SetTimeoutHdl( LINK( this, SvxIMapDlg, UpdateHdl ) );
+    pOwnData->aIdle.SetPriority( VCL_IDLE_PRIORITY_LOW );
+    pOwnData->aIdle.SetIdleHdl( LINK( this, SvxIMapDlg, UpdateHdl ) );
 
     m_pTbxIMapDlg1->EnableItem( mnActiveId, false );
     m_pTbxIMapDlg1->EnableItem( mnMacroId, false );
@@ -318,7 +318,7 @@ void SvxIMapDlg::UpdateLink( const Graphic& rGraphic, const ImageMap* pImageMap,
             pOwnData->aUpdateTargetList.push_back( aTargetList[ i ] );
     }
 
-    pOwnData->aTimer.Start();
+    pOwnData->aIdle.Start();
 }
 
 
@@ -687,7 +687,7 @@ IMPL_LINK_NOARG(SvxIMapDlg, URLLoseFocusHdl)
 
 IMPL_LINK_NOARG(SvxIMapDlg, UpdateHdl)
 {
-    pOwnData->aTimer.Stop();
+    pOwnData->aIdle.Stop();
 
     if ( pOwnData->pUpdateEditingObject != pCheckObj )
     {
diff --git a/svx/source/dialog/imapimp.hxx b/svx/source/dialog/imapimp.hxx
index dfc9a64..281be4d 100644
--- a/svx/source/dialog/imapimp.hxx
+++ b/svx/source/dialog/imapimp.hxx
@@ -29,7 +29,7 @@ class IMapOwnData
 {
 public:
 
-    Timer           aTimer;
+    Idle            aIdle;
     Timer           aTbxTimer;
     Graphic         aUpdateGraphic;
     ImageMap        aUpdateImageMap;
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index d57ea8a..62ee8e2 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -42,8 +42,8 @@ class ImplDockFloatWin2 : public FloatingWindow
 private:
     ImplDockingWindowWrapper*  mpDockWin;
     sal_uLong           mnLastTicks;
-    Timer           maDockTimer;
-    Timer           maEndDockTimer;
+    Idle            maDockIdle;
+    Idle            maEndDockIdle;
     Point           maDockPos;
     Rectangle       maDockRect;
     bool            mbInMove;
@@ -91,10 +91,10 @@ ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
 
     SetBackground( GetSettings().GetStyleSettings().GetFaceColor() );
 
-    maDockTimer.SetTimeoutHdl( LINK( this, ImplDockFloatWin2, DockTimerHdl ) );
-    maDockTimer.SetTimeout( 50 );
-    maEndDockTimer.SetTimeoutHdl( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) );
-    maEndDockTimer.SetTimeout( 50 );
+    maDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin2, DockTimerHdl ) );
+    maDockIdle.SetPriority( VCL_IDLE_PRIORITY_MEDIUM );
+    maEndDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) );
+    maEndDockIdle.SetPriority( VCL_IDLE_PRIORITY_MEDIUM );
 }
 
 ImplDockFloatWin2::~ImplDockFloatWin2()
@@ -107,7 +107,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, DockTimerHdl)
 {
     DBG_ASSERT( mpDockWin->IsFloatingMode(), "docktimer called but not floating" );
 
-    maDockTimer.Stop();
+    maDockIdle.Stop();
     PointerState aState = GetPointerState();
 
     if( aState.mnState & KEY_MOD1 )
@@ -115,7 +115,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, DockTimerHdl)
         // i43499 CTRL disables docking now
         mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
         if( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) )
-            maDockTimer.Start();
+            maDockIdle.Start();
     }
     else if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) )
     {
@@ -125,7 +125,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, DockTimerHdl)
     else
     {
         mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, SHOWTRACK_BIG | SHOWTRACK_WINDOW );
-        maDockTimer.Start();
+        maDockIdle.Start();
     }
 
     return 0;
@@ -135,7 +135,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, EndDockTimerHdl)
 {
     DBG_ASSERT( mpDockWin->IsFloatingMode(), "enddocktimer called but not floating" );
 
-    maEndDockTimer.Stop();
+    maEndDockIdle.Stop();
     PointerState aState = GetPointerState();
     if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) )
     {
@@ -144,7 +144,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, EndDockTimerHdl)
     }
     else
     {
-        maEndDockTimer.Start();
+        maEndDockIdle.Start();
     }
 
     return 0;
@@ -209,13 +209,13 @@ IMPL_LINK_NOARG(ImplDockFloatWin2, DockingHdl)
             maDockRect.SetPos( mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ScreenToOutputPixel(
                  maDockRect.TopLeft() ) );
             mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, SHOWTRACK_BIG | SHOWTRACK_WINDOW );
-            maEndDockTimer.Stop();
+            maEndDockIdle.Stop();
             DockTimerHdl( this );
         }
         else
         {
             mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
-            maDockTimer.Stop();
+            maDockIdle.Stop();
             EndDockTimerHdl( this );
         }
     }
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index c487bfe..1f25e66 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -59,7 +59,7 @@ class ImplDockFloatWin : public FloatingWindow
 private:
     DockingWindow*  mpDockWin;
     sal_uLong           mnLastTicks;
-    Timer           maDockTimer;
+    Idle            maDockIdle;
     Point           maDockPos;
     Rectangle       maDockRect;
     bool            mbInMove;
@@ -103,8 +103,8 @@ ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits,
 
     SetBackground();
 
-    maDockTimer.SetTimeoutHdl( LINK( this, ImplDockFloatWin, DockTimerHdl ) );
-    maDockTimer.SetTimeout( 50 );
+    maDockIdle.SetIdleHdl( LINK( this, ImplDockFloatWin, DockTimerHdl ) );
+    maDockIdle.SetPriority( VCL_IDLE_PRIORITY_MEDIUM );
 }
 
 ImplDockFloatWin::~ImplDockFloatWin()
@@ -117,7 +117,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin, DockTimerHdl)
 {
     DBG_ASSERT( mpDockWin->IsFloatingMode(), "docktimer called but not floating" );
 
-    maDockTimer.Stop();
+    maDockIdle.Stop();
     PointerState aState = GetPointerState();
 
     if( aState.mnState & KEY_MOD1 )
@@ -126,7 +126,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin, DockTimerHdl)
         mpDockWin->GetParent()->ImplGetFrameWindow()->HideTracking();
         mpDockWin->EndDocking( maDockRect, true );
         if( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) )
-            maDockTimer.Start();
+            maDockIdle.Start();
     }
     else if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) )
     {
@@ -136,7 +136,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin, DockTimerHdl)
     else
     {
         mpDockWin->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, SHOWTRACK_BIG | SHOWTRACK_WINDOW );
-        maDockTimer.Start();
+        maDockIdle.Start();
     }
 
     return 0;
@@ -171,7 +171,7 @@ IMPL_LINK_NOARG(ImplDockFloatWin, DockingHdl)
         else
         {
             mpDockWin->GetParent()->ImplGetFrameWindow()->HideTracking();
-            maDockTimer.Stop();
+            maDockIdle.Stop();
             mpDockWin->EndDocking( maDockRect, true );
         }
     }


More information about the Libreoffice-commits mailing list