From b77af2396adbab0ec4fea4160e0c711b080fff67 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 10 Nov 2017 17:57:19 +0000 Subject: 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/44624 Tested-by: Jenkins Reviewed-by: Michael Meeks --- vcl/headless/svpframe.cxx | 8 +++++++- vcl/osx/salframe.cxx | 7 +++---- vcl/source/app/settings.cxx | 13 +++++++++++++ vcl/unx/gtk/salnativewidgets-gtk.cxx | 7 ++----- vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 6 +----- vcl/unx/kde4/KDESalFrame.cxx | 11 ++++------- vcl/unx/kde5/KDE5SalFrame.cxx | 11 ++++------- vcl/win/window/salframe.cxx | 2 ++ 8 files changed, 36 insertions(+), 29 deletions(-) (limited to 'vcl') diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index 9ab4d8889c6b..b08c96f06cc7 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -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() diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 476ef9ab3bad..2d47dd5e8670 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -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 ); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 215d8eaca122..9d739341176f 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -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: */ diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx index 5126034ed5e5..2973feaa2a54 100644 --- a/vcl/unx/gtk/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx @@ -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] ); diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 678bf4efdf90..9229b4e178dc 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -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())); diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 97f0fabf4c62..ea46d6e5c247 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -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 ); diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx index 5a15b6fb2592..1222260702ef 100644 --- a/vcl/unx/kde5/KDE5SalFrame.cxx +++ b/vcl/unx/kde5/KDE5SalFrame.cxx @@ -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 ); diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index dcbfda8163a8..725b02e0f232 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -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() ); -- cgit v1.2.3