Kaydet (Commit) aa3bfbe7 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Header/Footer, Page Breaks: Delay appearing by 500ms.

The delay was a good idea, just the 1s was too long.
üst 6abeafcd
...@@ -153,6 +153,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag ...@@ -153,6 +153,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
m_pLine( NULL ), m_pLine( NULL ),
m_bIsAppearing( false ), m_bIsAppearing( false ),
m_nFadeRate( 100 ), m_nFadeRate( 100 ),
m_nDelayAppearing( 0 ),
m_aFadeTimer( ) m_aFadeTimer( )
{ {
// Get the font and configure it // Get the font and configure it
...@@ -243,6 +244,9 @@ void SwHeaderFooterWin::ShowAll( bool bShow ) ...@@ -243,6 +244,9 @@ void SwHeaderFooterWin::ShowAll( bool bShow )
if ( !PopupMenu::IsInExecute() ) if ( !PopupMenu::IsInExecute() )
{ {
m_bIsAppearing = bShow; m_bIsAppearing = bShow;
if ( bShow )
m_nDelayAppearing = 0;
if ( m_aFadeTimer.IsActive( ) ) if ( m_aFadeTimer.IsActive( ) )
m_aFadeTimer.Stop(); m_aFadeTimer.Stop();
m_aFadeTimer.Start( ); m_aFadeTimer.Start( );
...@@ -516,6 +520,14 @@ void SwHeaderFooterWin::Select( ) ...@@ -516,6 +520,14 @@ void SwHeaderFooterWin::Select( )
IMPL_LINK( SwHeaderFooterWin, FadeHandler, Timer *, EMPTYARG ) IMPL_LINK( SwHeaderFooterWin, FadeHandler, Timer *, EMPTYARG )
{ {
const int TICKS_BEFORE_WE_APPEAR = 10;
if ( m_bIsAppearing && m_nDelayAppearing < TICKS_BEFORE_WE_APPEAR )
{
++m_nDelayAppearing;
m_aFadeTimer.Start();
return 0;
}
if ( m_bIsAppearing && m_nFadeRate > 0 ) if ( m_bIsAppearing && m_nFadeRate > 0 )
m_nFadeRate -= 25; m_nFadeRate -= 25;
else if ( !m_bIsAppearing && m_nFadeRate < 100 ) else if ( !m_bIsAppearing && m_nFadeRate < 100 )
...@@ -535,7 +547,7 @@ IMPL_LINK( SwHeaderFooterWin, FadeHandler, Timer *, EMPTYARG ) ...@@ -535,7 +547,7 @@ IMPL_LINK( SwHeaderFooterWin, FadeHandler, Timer *, EMPTYARG )
Invalidate(); Invalidate();
if ( IsVisible( ) && m_nFadeRate > 0 && m_nFadeRate < 100 ) if ( IsVisible( ) && m_nFadeRate > 0 && m_nFadeRate < 100 )
m_aFadeTimer.Start(); m_aFadeTimer.Start();
return 0; return 0;
} }
......
...@@ -110,6 +110,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm ) ...@@ -110,6 +110,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
m_pLine( NULL ), m_pLine( NULL ),
m_bIsAppearing( false ), m_bIsAppearing( false ),
m_nFadeRate( 100 ), m_nFadeRate( 100 ),
m_nDelayAppearing( 0 ),
m_bDestroyed( false ), m_bDestroyed( false ),
m_pMousePt( NULL ) m_pMousePt( NULL )
{ {
...@@ -424,6 +425,9 @@ void SwPageBreakWin::SetReadonly( bool bReadonly ) ...@@ -424,6 +425,9 @@ void SwPageBreakWin::SetReadonly( bool bReadonly )
void SwPageBreakWin::Fade( bool bFadeIn ) void SwPageBreakWin::Fade( bool bFadeIn )
{ {
m_bIsAppearing = bFadeIn; m_bIsAppearing = bFadeIn;
if ( bFadeIn )
m_nDelayAppearing = 0;
if ( !m_bDestroyed && m_aFadeTimer.IsActive( ) ) if ( !m_bDestroyed && m_aFadeTimer.IsActive( ) )
m_aFadeTimer.Stop(); m_aFadeTimer.Stop();
if ( !m_bDestroyed ) if ( !m_bDestroyed )
...@@ -439,6 +443,14 @@ IMPL_LINK( SwPageBreakWin, HideHandler, void *, EMPTYARG ) ...@@ -439,6 +443,14 @@ IMPL_LINK( SwPageBreakWin, HideHandler, void *, EMPTYARG )
IMPL_LINK( SwPageBreakWin, FadeHandler, Timer *, EMPTYARG ) IMPL_LINK( SwPageBreakWin, FadeHandler, Timer *, EMPTYARG )
{ {
const int TICKS_BEFORE_WE_APPEAR = 10;
if ( m_bIsAppearing && m_nDelayAppearing < TICKS_BEFORE_WE_APPEAR )
{
++m_nDelayAppearing;
m_aFadeTimer.Start();
return 0;
}
if ( m_bIsAppearing && m_nFadeRate > 0 ) if ( m_bIsAppearing && m_nFadeRate > 0 )
m_nFadeRate -= 25; m_nFadeRate -= 25;
else if ( !m_bIsAppearing && m_nFadeRate < 100 ) else if ( !m_bIsAppearing && m_nFadeRate < 100 )
......
...@@ -46,6 +46,7 @@ class SwHeaderFooterWin : public MenuButton, public SwFrameControl ...@@ -46,6 +46,7 @@ class SwHeaderFooterWin : public MenuButton, public SwFrameControl
Window* m_pLine; Window* m_pLine;
bool m_bIsAppearing; bool m_bIsAppearing;
int m_nFadeRate; int m_nFadeRate;
int m_nDelayAppearing; //< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over.
Timer m_aFadeTimer; Timer m_aFadeTimer;
public: public:
......
...@@ -45,6 +45,7 @@ class SwPageBreakWin : public MenuButton, public SwFrameControl ...@@ -45,6 +45,7 @@ class SwPageBreakWin : public MenuButton, public SwFrameControl
Window* m_pLine; Window* m_pLine;
bool m_bIsAppearing; bool m_bIsAppearing;
int m_nFadeRate; int m_nFadeRate;
int m_nDelayAppearing; //< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over.
Timer m_aFadeTimer; Timer m_aFadeTimer;
bool m_bDestroyed; bool m_bDestroyed;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment