[Libreoffice-commits] .: vcl/inc vcl/source vcl/unx vcl/win
Jan Holesovsky
kendy at kemper.freedesktop.org
Fri Apr 29 15:41:23 PDT 2011
vcl/inc/vcl/settings.hxx | 1 +
vcl/source/app/settings.cxx | 15 +++++++++++++++
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 14 +-------------
vcl/unx/kde/salnativewidgets-kde.cxx | 12 +-----------
vcl/unx/kde4/KDESalFrame.cxx | 13 +------------
vcl/unx/source/gdi/cdeint.cxx | 12 +-----------
vcl/win/source/window/salframe.cxx | 14 +-------------
7 files changed, 21 insertions(+), 60 deletions(-)
New commits:
commit a2d04068023d75e13fc4d701aca1a0185e8e75c0
Author: Christian Dywan <christian.dywan at lanedo.com>
Date: Thu Apr 28 19:31:28 2011 +0200
Unify light gray checked color special case
It's the same hack on all platforms using it.
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
index 4f16997..c9c0b3a 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 388a043..2250cf2 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 6a31d2d..786fa72 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 d0fa4a0..eaa6087 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 8ed5078..feeb9dc 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 b222b84..8cf93af 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 db9a5a2..474f953 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;
More information about the Libreoffice-commits
mailing list