diff options
author | Christian Dywan <christian.dywan@lanedo.com> | 2011-04-28 19:31:28 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-04-30 00:39:59 +0200 |
commit | 51940f50c936cec04c3891d8d80559a5bf1f022d (patch) | |
tree | d7a476cf25e4ea2a08c351d3d09934be764419b7 | |
parent | fe4b4f71bbd256bb76abfa3391df02c7190b0aa0 (diff) |
Unify light gray checked color special case
It's the same hack on all platforms using it.
-rw-r--r-- | vcl/inc/vcl/settings.hxx | 1 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 15 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 14 | ||||
-rw-r--r-- | vcl/unx/kde/salnativewidgets-kde.cxx | 12 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalFrame.cxx | 13 | ||||
-rw-r--r-- | vcl/unx/source/gdi/cdeint.cxx | 12 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 14 |
7 files changed, 21 insertions, 60 deletions
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 5799eb0b6ea3..0ade4c63f295 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -527,6 +527,7 @@ public: Color GetSeparatorColor() const; void SetCheckedColor( const Color& rColor ) { CopyData(); mpData->maCheckedColor = rColor; } + void SetCheckedColorSpecialCase( ); const Color& GetCheckedColor() const { return mpData->maCheckedColor; } void SetLightColor( const Color& rColor ) diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 1772b3418535..a84b8c52d89a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -749,6 +749,21 @@ void StyleSettings::SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ) } } +void StyleSettings::SetCheckedColorSpecialCase( ) +{ + CopyData(); + // Light gray checked color special case + if ( GetFaceColor() == COL_LIGHTGRAY ) + mpData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC ); + else + { + sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetRed() + (sal_uInt16)mpData->maLightColor.GetRed())/2); + sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetGreen() + (sal_uInt16)mpData->maLightColor.GetGreen())/2); + sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)mpData->maFaceColor.GetBlue() + (sal_uInt16)mpData->maLightColor.GetBlue())/2); + mpData->maCheckedColor = Color( nRed, nGreen, nBlue ); + } +} + // ----------------------------------------------------------------------- sal_uLong StyleSettings::GetCurrentSymbolsStyle() const diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 3060146d5958..a9a22aca25e2 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3306,19 +3306,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aStyleSet.SetWorkspaceColor( aBackColor ); aStyleSet.SetFieldColor( aBackFieldColor ); aStyleSet.SetWindowColor( aBackFieldColor ); -// aStyleSet.SetHelpColor( aBackColor ); - // ancient wisdom tells us a mystic algorithm how to set checked color - if( aBackColor == COL_LIGHTGRAY ) - aStyleSet.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = aStyleSet.GetLightColor(); - Color aCheck( (sal_uInt8)(((sal_uInt16)aBackColor.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBackColor.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBackColor.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ); - aStyleSet.SetCheckedColor( aCheck ); - } + aStyleSet.SetCheckedColorSpecialCase( ); // highlighting colors Color aHighlightColor = getColor( pStyle->base[GTK_STATE_SELECTED] ); diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 252cb0b77331..0142078382cc 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -1926,17 +1926,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetFaceColor( aBack ); aStyleSettings.SetInactiveTabColor( aBack ); aStyleSettings.SetDialogColor( aBack ); - if( aBack == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = aStyleSettings.GetLightColor(); - aStyleSettings. - SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); // Selection aStyleSettings.SetHighlightColor( toColor( qColorGroup.highlight() ) ); diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 220859bc7e01..a2f4b72b4edd 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -263,18 +263,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetFaceColor( aBack ); style.SetInactiveTabColor( aBack ); style.SetDialogColor( aBack ); - - if( aBack == COL_LIGHTGRAY ) - style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - Color aColor2 = style.GetLightColor(); - style. - SetCheckedColor( Color( (sal_uInt8)(((sal_uInt16)aBack.GetRed()+(sal_uInt16)aColor2.GetRed())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetGreen()+(sal_uInt16)aColor2.GetGreen())/2), - (sal_uInt8)(((sal_uInt16)aBack.GetBlue()+(sal_uInt16)aColor2.GetBlue())/2) - ) ); - } + style.SetCheckedColorSpecialCase( ); // Selection style.SetHighlightColor( aHigh ); diff --git a/vcl/unx/source/gdi/cdeint.cxx b/vcl/unx/source/gdi/cdeint.cxx index fd81e05c0644..a10568054477 100644 --- a/vcl/unx/source/gdi/cdeint.cxx +++ b/vcl/unx/source/gdi/cdeint.cxx @@ -226,17 +226,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) aStyleSettings.SetDialogColor( aColors[1] ); aStyleSettings.SetMenuColor( aColors[1] ); aStyleSettings.SetMenuBarColor( aColors[1] ); - if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - // calculate Checked color - Color aColor2 = aStyleSettings.GetLightColor(); - sal_uInt8 nRed = (sal_uInt8)(((sal_uInt16)aColors[1].GetRed() + (sal_uInt16)aColor2.GetRed())/2); - sal_uInt8 nGreen = (sal_uInt8)(((sal_uInt16)aColors[1].GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); - sal_uInt8 nBlue = (sal_uInt8)(((sal_uInt16)aColors[1].GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); } rSettings.SetStyleSettings( aStyleSettings ); } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index ea2f3268ca89..8a47929f53d0 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2941,19 +2941,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) pSVData->maNWFData.maMenuBarHighlightTextColor = aStyleSettings.GetMenuTextColor(); GetSalData()->mbThemeMenuSupport = TRUE; } - // Bei hellgrau geben wir die Farbe vor, damit es besser aussieht - if ( aStyleSettings.GetFaceColor() == COL_LIGHTGRAY ) - aStyleSettings.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) ); - else - { - // Checked-Color berechnen - Color aColor1 = aStyleSettings.GetFaceColor(); - Color aColor2 = aStyleSettings.GetLightColor(); - BYTE nRed = (BYTE)(((sal_uInt16)aColor1.GetRed() + (sal_uInt16)aColor2.GetRed())/2); - BYTE nGreen = (BYTE)(((sal_uInt16)aColor1.GetGreen() + (sal_uInt16)aColor2.GetGreen())/2); - BYTE nBlue = (BYTE)(((sal_uInt16)aColor1.GetBlue() + (sal_uInt16)aColor2.GetBlue())/2); - aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); - } + aStyleSettings.SetCheckedColorSpecialCase( ); // caret width DWORD nCaretWidth = 2; |