summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-11-10 17:57:19 +0000
committerMichael Meeks <michael.meeks@collabora.com>2017-11-11 16:56:33 +0100
commitb77af2396adbab0ec4fea4160e0c711b080fff67 (patch)
tree92278cb7d916dce44b658888be7f43a8b0c33658
parent5bd7cc788d0b0f4a2595f32f4897abe6e39ce6c8 (diff)
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 <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--include/vcl/settings.hxx4
-rw-r--r--vcl/headless/svpframe.cxx8
-rw-r--r--vcl/osx/salframe.cxx7
-rw-r--r--vcl/source/app/settings.cxx13
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx7
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx6
-rw-r--r--vcl/unx/kde4/KDESalFrame.cxx11
-rw-r--r--vcl/unx/kde5/KDE5SalFrame.cxx11
-rw-r--r--vcl/win/window/salframe.cxx2
9 files changed, 40 insertions, 29 deletions
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 097605e7c251..97d5d8265b99 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -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);
};
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() );