Kaydet (Commit) 758916a8 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

fix status bar flickering (zoom slider fo example)

Change-Id: I3fb71868a9f8f56c76353f3a2d84fdb078c8f8fb
üst 8ae25bbc
...@@ -96,7 +96,7 @@ private: ...@@ -96,7 +96,7 @@ private:
using Window::ImplInit; using Window::ImplInit;
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); SAL_DLLPRIVATE void ImplInitSettings();
SAL_DLLPRIVATE void ImplFormat(); SAL_DLLPRIVATE void ImplFormat();
SAL_DLLPRIVATE bool ImplIsItemUpdate(); SAL_DLLPRIVATE bool ImplIsItemUpdate();
......
...@@ -123,7 +123,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -123,7 +123,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
// remember WinBits // remember WinBits
mpItemList = new ImplStatusItemList; mpItemList = new ImplStatusItemList;
mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this ); mpImplData->mpVirDev = VclPtr<VirtualDevice>::Create( *this );
mnCurItemId = 0; mnCurItemId = 0;
mbFormat = true; mbFormat = true;
mbVisibleItems = true; mbVisibleItems = true;
...@@ -137,8 +137,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -137,8 +137,7 @@ void StatusBar::ImplInit( vcl::Window* pParent, WinBits nStyle )
mnItemY = STATUSBAR_OFFSET_Y; mnItemY = STATUSBAR_OFFSET_Y;
mnTextY = STATUSBAR_OFFSET_TEXTY; mnTextY = STATUSBAR_OFFSET_TEXTY;
ImplInitSettings( true, true, true ); ImplInitSettings();
SetLineColor();
SetOutputSizePixel( CalcWindowSizePixel() ); SetOutputSizePixel( CalcWindowSizePixel() );
} }
...@@ -175,6 +174,8 @@ void StatusBar::AdjustItemWidthsForHiDPI(bool bAdjustHiDPI) ...@@ -175,6 +174,8 @@ void StatusBar::AdjustItemWidthsForHiDPI(bool bAdjustHiDPI)
void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext) void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext)
{ {
rRenderContext.SetLineColor();
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
vcl::Font aFont = rStyleSettings.GetToolFont(); vcl::Font aFont = rStyleSettings.GetToolFont();
if (IsControlFont()) if (IsControlFont())
...@@ -209,56 +210,15 @@ void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext) ...@@ -209,56 +210,15 @@ void StatusBar::ApplySettings(vcl::RenderContext& rRenderContext)
} }
} }
void StatusBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) void StatusBar::ImplInitSettings()
{ {
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); ApplySettings(*this);
if (bFont)
{
vcl::Font aFont = rStyleSettings.GetToolFont();
if (IsControlFont())
aFont.Merge(GetControlFont());
SetZoomedPointFont(*this, aFont);
}
if (bForeground || bFont)
{
Color aColor;
if (IsControlForeground())
aColor = GetControlForeground();
else if ( GetStyle() & WB_3DLOOK )
aColor = rStyleSettings.GetButtonTextColor();
else
aColor = rStyleSettings.GetWindowTextColor();
SetTextColor(aColor);
SetTextFillColor();
mpImplData->mpVirDev->SetFont( GetFont() );
mpImplData->mpVirDev->SetTextColor( GetTextColor() );
mpImplData->mpVirDev->SetTextAlign( GetTextAlign() );
mpImplData->mpVirDev->SetTextFillColor();
}
if ( bBackground ) mpImplData->mpVirDev->SetFont(GetFont());
{ mpImplData->mpVirDev->SetTextColor(GetTextColor());
Color aColor; mpImplData->mpVirDev->SetTextAlign(GetTextAlign());
if ( IsControlBackground() ) mpImplData->mpVirDev->SetTextFillColor();
aColor = GetControlBackground(); mpImplData->mpVirDev->SetBackground(GetBackground());
else if ( GetStyle() & WB_3DLOOK )
aColor = rStyleSettings.GetFaceColor();
else
aColor = rStyleSettings.GetWindowColor();
SetBackground( aColor );
mpImplData->mpVirDev->SetBackground( GetBackground() );
// NWF background
if( ! IsControlBackground() &&
IsNativeControlSupported( CTRL_WINDOW_BACKGROUND, PART_BACKGROUND_WINDOW ) )
{
ImplGetWindowImpl()->mnNativeBackground = PART_BACKGROUND_WINDOW;
EnableChildTransparentMode( true );
}
}
} }
void StatusBar::ImplFormat() void StatusBar::ImplFormat()
...@@ -745,7 +705,20 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) ...@@ -745,7 +705,20 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() ); sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() );
if (mbProgressMode) if (mbProgressMode)
{
rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
Color aProgressColor = rStyleSettings.GetHighlightColor();
if (aProgressColor == rStyleSettings.GetFaceColor())
aProgressColor = rStyleSettings.GetDarkShadowColor();
rRenderContext.SetLineColor();
rRenderContext.SetFillColor(aProgressColor);
ImplDrawProgress(rRenderContext, true, 0, mnPercent); ImplDrawProgress(rRenderContext, true, 0, mnPercent);
rRenderContext.Pop();
}
else else
{ {
// draw text // draw text
...@@ -756,7 +729,7 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) ...@@ -756,7 +729,7 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
if (mbVisibleItems) if (mbVisibleItems)
{ {
for (sal_uInt16 i = 0; i < nItemCount; i++) for (sal_uInt16 i = 0; i < nItemCount; i++)
ImplDrawItem(rRenderContext, false, i, true, true); ImplDrawItem(rRenderContext, true, i, true, true);
} }
} }
...@@ -869,17 +842,17 @@ void StatusBar::StateChanged( StateChangedType nType ) ...@@ -869,17 +842,17 @@ void StatusBar::StateChanged( StateChangedType nType )
(nType == StateChangedType::ControlFont) ) (nType == StateChangedType::ControlFont) )
{ {
mbFormat = true; mbFormat = true;
ImplInitSettings( true, false, false ); ImplInitSettings();
Invalidate(); Invalidate();
} }
else if ( nType == StateChangedType::ControlForeground ) else if ( nType == StateChangedType::ControlForeground )
{ {
ImplInitSettings( false, true, false ); ImplInitSettings();
Invalidate(); Invalidate();
} }
else if ( nType == StateChangedType::ControlBackground ) else if ( nType == StateChangedType::ControlBackground )
{ {
ImplInitSettings( false, false, true ); ImplInitSettings();
Invalidate(); Invalidate();
} }
} }
...@@ -897,7 +870,7 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -897,7 +870,7 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
) )
{ {
mbFormat = true; mbFormat = true;
ImplInitSettings( true, true, true ); ImplInitSettings();
long nFudge = GetTextHeight() / 4; long nFudge = GetTextHeight() / 4;
for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
{ {
...@@ -1258,7 +1231,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData ) ...@@ -1258,7 +1231,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
{ {
Update(); Update();
Rectangle aRect = ImplGetItemRectPos(nPos); Rectangle aRect = ImplGetItemRectPos(nPos);
Invalidate(aRect); Invalidate(aRect, InvalidateFlags::NoErase);
Flush(); Flush();
} }
} }
...@@ -1379,12 +1352,6 @@ void StatusBar::StartProgressMode( const OUString& rText ) ...@@ -1379,12 +1352,6 @@ void StatusBar::StartProgressMode( const OUString& rText )
ImplCalcProgressRect(); ImplCalcProgressRect();
// trigger Paint, which draws text and frame // trigger Paint, which draws text and frame
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Color aPrgsColor = rStyleSettings.GetHighlightColor();
if ( aPrgsColor == rStyleSettings.GetFaceColor() )
aPrgsColor = rStyleSettings.GetDarkShadowColor();
SetLineColor();
SetFillColor( aPrgsColor );
if ( IsReallyVisible() ) if ( IsReallyVisible() )
{ {
Invalidate(); Invalidate();
...@@ -1403,7 +1370,6 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent ) ...@@ -1403,7 +1370,6 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
&& (!mnPercent || (mnPercent != nNewPercent)) ) && (!mnPercent || (mnPercent != nNewPercent)) )
{ {
Update(); Update();
SetLineColor();
Invalidate(); Invalidate();
Flush(); Flush();
} }
...@@ -1417,8 +1383,6 @@ void StatusBar::EndProgressMode() ...@@ -1417,8 +1383,6 @@ void StatusBar::EndProgressMode()
mbProgressMode = false; mbProgressMode = false;
maPrgsTxt.clear(); maPrgsTxt.clear();
// re-trigger Paint to recreate StatusBar
SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
if ( IsReallyVisible() ) if ( IsReallyVisible() )
{ {
Invalidate(); Invalidate();
......
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