Kaydet (Commit) b77af239 authored tarafından Michael Meeks's avatar Michael Meeks

vcl: StyleSettings - start to unwind code duplication.

This should be a pure re-factor, plus headless tweak.

Change-Id: Iad7f524ea76625601b3f85cc13a50311ed1de171
Reviewed-on: https://gerrit.libreoffice.org/44624Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 5bd7cc78
......@@ -607,6 +607,10 @@ public:
bool operator ==( const StyleSettings& rSet ) const;
bool operator !=( const StyleSettings& rSet ) const;
// Batch setters used by various backends
void BatchSetBackgrounds( const Color &aBackColor,
bool bCheckedColorSpecialCase = true);
};
......
......@@ -404,8 +404,14 @@ LanguageType SvpSalFrame::GetInputLanguage()
return LANGUAGE_DONTKNOW;
}
void SvpSalFrame::UpdateSettings( AllSettings& )
void SvpSalFrame::UpdateSettings( AllSettings& rSettings )
{
StyleSettings aStyleSettings = rSettings.GetStyleSettings();
Color aBackgroundColor( 0xec, 0xec, 0xec );
aStyleSettings.BatchSetBackgrounds( aBackgroundColor, false );
rSettings.SetStyleSettings( aStyleSettings );
}
void SvpSalFrame::Beep()
......
......@@ -1148,14 +1148,13 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
// Background Color
Color aBackgroundColor( 0xEC, 0xEC, 0xEC );
aStyleSettings.Set3DColors( aBackgroundColor );
aStyleSettings.SetFaceColor( aBackgroundColor );
aStyleSettings.BatchSetBackgrounds( aBackgroundColor, false );
aStyleSettings.SetLightBorderColor( aBackgroundColor );
Color aInactiveTabColor( aBackgroundColor );
aInactiveTabColor.DecreaseLuminance( 32 );
aStyleSettings.SetInactiveTabColor( aInactiveTabColor );
aStyleSettings.SetDialogColor( aBackgroundColor );
aStyleSettings.SetLightBorderColor( aBackgroundColor );
Color aShadowColor( aStyleSettings.GetShadowColor() );
aShadowColor.IncreaseLuminance( 32 );
aStyleSettings.SetShadowColor( aShadowColor );
......
......@@ -3117,4 +3117,17 @@ AllSettings::GetSysLocale()
return mxData->maSysLocale;
}
void StyleSettings::BatchSetBackgrounds( const Color &aBackColor,
bool bCheckedColorSpecialCase )
{
Set3DColors( aBackColor );
SetFaceColor( aBackColor );
SetDialogColor( aBackColor );
SetWorkspaceColor( aBackColor );
if (bCheckedColorSpecialCase)
SetCheckedColorSpecialCase();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -3826,13 +3826,10 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// background colors
Color aBackColor = getColor( pStyle->bg[GTK_STATE_NORMAL] );
Color aBackFieldColor = getColor( pStyle->base[GTK_STATE_NORMAL] );
aStyleSet.Set3DColors( aBackColor );
aStyleSet.SetFaceColor( aBackColor );
aStyleSet.SetDialogColor( aBackColor );
aStyleSet.SetWorkspaceColor( aBackColor );
aStyleSet.BatchSetBackgrounds( aBackColor );
aStyleSet.SetFieldColor( aBackFieldColor );
aStyleSet.SetWindowColor( aBackFieldColor );
aStyleSet.SetCheckedColorSpecialCase( );
// Dark shadow color
Color aDarkShadowColor = getColor( pStyle->fg[GTK_STATE_INSENSITIVE] );
......
......@@ -2878,11 +2878,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
gtk_style_context_get_background_color(pStyle, gtk_style_context_get_state(pStyle), &background_color);
::Color aBackColor = getColor( background_color );
aStyleSet.Set3DColors( aBackColor );
aStyleSet.SetFaceColor( aBackColor );
aStyleSet.SetDialogColor( aBackColor );
aStyleSet.SetWorkspaceColor( aBackColor );
aStyleSet.SetCheckedColorSpecialCase( );
aStyleSet.BatchSetBackgrounds( aBackColor );
// UI font
vcl::Font aFont(getFont(pStyle, rSettings.GetUILanguageTag().getLocale()));
......
......@@ -254,15 +254,12 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Disable color
style.SetDisableColor( toColor( pal.color( QPalette::Disabled, QPalette::WindowText ) ) );
// Workspace
style.SetWorkspaceColor( aMid );
// Background
style.Set3DColors( aBack );
style.SetFaceColor( aBack );
style.BatchSetBackgrounds( aBack );
style.SetInactiveTabColor( aBack );
style.SetDialogColor( aBack );
style.SetCheckedColorSpecialCase( );
// Workspace
style.SetWorkspaceColor( aMid );
// Selection
style.SetHighlightColor( aHigh );
......
......@@ -240,15 +240,12 @@ void KDE5SalFrame::UpdateSettings( AllSettings& rSettings )
// Disable color
style.SetDisableColor( toColor( pal.color( QPalette::Disabled, QPalette::WindowText ) ) );
// Workspace
style.SetWorkspaceColor( aMid );
// Background
style.Set3DColors( aBack );
style.SetFaceColor( aBack );
style.BatchSetBackgrounds( aBack );
style.SetInactiveTabColor( aBack );
style.SetDialogColor( aBack );
style.SetCheckedColorSpecialCase( );
// Workspace
style.SetWorkspaceColor( aMid );
// Selection
style.SetHighlightColor( aHigh );
......
......@@ -2636,7 +2636,9 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
aStyleSettings.SetDarkShadowColor( ImplWinColorToSal( GetSysColor( COLOR_3DDKSHADOW ) ) );
aStyleSettings.SetHelpColor( ImplWinColorToSal( GetSysColor( COLOR_INFOBK ) ) );
aStyleSettings.SetHelpTextColor( ImplWinColorToSal( GetSysColor( COLOR_INFOTEXT ) ) );
aStyleSettings.SetDialogColor( aStyleSettings.GetFaceColor() );
aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() );
aStyleSettings.SetButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) );
aStyleSettings.SetButtonRolloverTextColor( aStyleSettings.GetButtonTextColor() );
......
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