diff options
author | Kurt Zenker <kz@openoffice.org> | 2009-09-11 11:10:31 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2009-09-11 11:10:31 +0000 |
commit | 9d918720a252b81b0f7253d15775e5c173882eba (patch) | |
tree | 6335369ebf47bf468f5d17ce43d8665d77848903 /vcl/source | |
parent | 6cdd12a0723ba61b948714cf7617712805c2d8cd (diff) |
CWS-TOOLING: integrate CWS changehc
2009-08-31 19:38:50 +0200 pl r275633 : remove dbug printf
2009-08-31 17:41:50 +0200 pl r275623 : CWS-TOOLING: rebase CWS changehc to trunk@275331 (milestone: DEV300:m56)
2009-07-15 19:45:46 +0200 pl r274028 : #i35482# use HC flag to decide high contrast mode
2009-07-15 17:40:52 +0200 pl r274020 : #i35482# use HC flag to decide high contrast mode
2009-07-15 17:39:50 +0200 pl r274019 : #i35482# update autohc correctly in MergeSystemSettings
2009-07-15 17:38:57 +0200 pl r274018 : #i35482# update autohc correctly in MergeSystemSettings
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/svapp.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 13 | ||||
-rw-r--r-- | vcl/source/control/fixed.cxx | 14 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 17 | ||||
-rw-r--r-- | vcl/source/control/imgctrl.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 45 | ||||
-rw-r--r-- | vcl/source/gdi/wall.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 14 | ||||
-rw-r--r-- | vcl/source/window/msgbox.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 12 |
12 files changed, 63 insertions, 78 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 262910d18c82..b53ceceeb757 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -674,11 +674,11 @@ void Application::MergeSystemSettings( AllSettings& rSettings ) ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mbSettingsInit ) { - pWindow->ImplGetFrame()->UpdateSettings( *pSVData->maAppData.mpSettings ); + // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings pWindow->ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); pSVData->maAppData.mbSettingsInit = TRUE; } - pWindow->ImplGetFrame()->UpdateSettings( rSettings ); + // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings pWindow->ImplUpdateGlobalSettings( rSettings, FALSE ); } } diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 2e2342fc6fc8..e7a4aadb8694 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -420,10 +420,9 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Image *pImage = &(mpButtonData->maImage); BitmapEx *pBitmapEx = mpButtonData->mpBitmapEx; - Color aBackCol; - if( !!(mpButtonData->maImageHC) && ImplGetCurrentBackgroundColor( aBackCol ) ) + if( !!(mpButtonData->maImageHC) ) { - if( aBackCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) { pImage = &(mpButtonData->maImageHC); pBitmapEx = mpButtonData->mpBitmapExHC; @@ -2375,14 +2374,10 @@ if ( bNativeOK == FALSE ) // check for HC mode Image *pImage = &maImage; - Color aBackCol; - if( !!maImageHC && ImplGetCurrentBackgroundColor( aBackCol ) ) + if( !!maImageHC ) { - if( aBackCol.IsDark() ) + if( rStyleSettings.GetHighContrastMode() ) pImage = &maImageHC; - // #99902 no col transform required - //if( aBackCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } Point aImagePos( aImageRect.TopLeft() ); diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 530e928532e1..ecb066d107ce 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -804,13 +804,10 @@ void FixedBitmap::ImplDraw( OutputDevice* pDev, ULONG /* nDrawFlags */, USHORT nStyle = 0; Bitmap* pBitmap = &maBitmap; Color aCol; - if( !!maBitmapHC && ImplGetCurrentBackgroundColor( aCol ) ) + if( !!maBitmapHC ) { - if( aCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pBitmap = &maBitmapHC; - // #99902 no col transform required - //if( aCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } if( nStyle & IMAGE_DRAW_COLORTRANSFORM ) @@ -1058,13 +1055,10 @@ void FixedImage::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, Image *pImage = &maImage; Color aCol; - if( !!maImageHC && ImplGetCurrentBackgroundColor( aCol ) ) + if( !!maImageHC ) { - if( aCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pImage = &maImageHC; - // #99902 no col transform required - //if( aCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } // Haben wir ueberhaupt ein Image diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index a25ddbb68e8b..c0a28c8b03fd 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2899,23 +2899,8 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP if( !!maImageHC ) { - // determine backgroundcolor as done in Paint() - Color aBackCol; - if( IsEnabled() ) - { - if( HasFocus() ) - aBackCol = GetSettings().GetStyleSettings().GetHighlightColor(); - else - aBackCol = GetBackground().GetColor(); - } - else // Disabled - aBackCol = GetBackground().GetColor(); - - if( aBackCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pImage = &maImageHC; - // #99902 no col transform required - //if( aBackCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } if ( !IsZoom() ) diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 6d4777013a73..73b5154d32ac 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -93,14 +93,10 @@ void ImageControl::UserDraw( const UserDrawEvent& rUDEvt ) { USHORT nStyle = 0; BitmapEx* pBitmap = &maBmp; - Color aCol; - if( !!maBmpHC && ImplGetCurrentBackgroundColor( aCol ) ) + if( !!maBmpHC ) { - if( aCol.IsDark() ) + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) pBitmap = &maBmpHC; - // #99902 no col transform required - //if( aCol.IsBright() ) - // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } if ( !*pBitmap ) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a6b778681e1..0a7a8b765b6b 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6782,17 +6782,21 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, { BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; - Color aCol; - if( IsBackground() ) - aCol = GetBackground().GetColor(); - else - // best guess is the face color here - // but it may be totally wrong. the background color - // was typically already reset - aCol = GetSettings().GetStyleSettings().GetFaceColor(); + const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + if( rStyleSettings.GetHighContrastMode() ) + { + Color aCol; + if( IsBackground() ) + aCol = GetBackground().GetColor(); + else + // best guess is the face color here + // but it may be totally wrong. the background color + // was typically already reset + aCol = rStyleSettings.GetFaceColor(); - bHighContrastBlack = aCol.IsDark(); - bHighContrastWhite = aCol.IsBright() && GetSettings().GetStyleSettings().GetHighContrastMode(); + bHighContrastBlack = aCol.IsDark(); + bHighContrastWhite = aCol.IsBright(); + } aOldTextColor = GetTextColor(); if ( IsTextFillColor() ) @@ -6800,8 +6804,6 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, bRestoreFillColor = TRUE; aOldTextFillColor = GetTextFillColor(); } - else - bRestoreFillColor = FALSE; if( bHighContrastBlack ) SetTextColor( COL_GREEN ); else if( bHighContrastWhite ) @@ -6816,7 +6818,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aRect.Move( 1, 1 ); DrawText( aRect, rOrigStr, nStyle & ~TEXT_DRAW_DISABLE ); */ - SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() ); + SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() ); } } @@ -7450,13 +7452,18 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, BOOL bRestoreFillColor; BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; - if( IsBackground() ) + const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + if( rStyleSettings.GetHighContrastMode() ) { - Wallpaper aWall = GetBackground(); - Color aCol = aWall.GetColor(); - bHighContrastBlack = aCol.IsDark(); - bHighContrastWhite = aCol.IsBright() && GetSettings().GetStyleSettings().GetHighContrastMode(); + if( IsBackground() ) + { + Wallpaper aWall = GetBackground(); + Color aCol = aWall.GetColor(); + bHighContrastBlack = aCol.IsDark(); + bHighContrastWhite = aCol.IsBright(); + } } + aOldTextColor = GetTextColor(); if ( IsTextFillColor() ) { @@ -7471,7 +7478,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const XubString& rStr, else if( bHighContrastWhite ) SetTextColor( COL_LIGHTGREEN ); else - SetTextColor( GetSettings().GetStyleSettings().GetShadowColor() ); + SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() ); DrawText( rPos, aStr, nIndex, nLen, pVector, pDisplayText ); if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index e0c69ce582f4..587395fa783f 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -469,7 +469,7 @@ Gradient Wallpaper::ImplGetApplicationGradient() const g.SetStyle( GRADIENT_LINEAR ); g.SetStartColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); // no 'extreme' gradient when high contrast - if( Application::GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) + if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) g.SetEndColor( Application::GetSettings().GetStyleSettings().GetFaceColor() ); else g.SetEndColor( Application::GetSettings().GetStyleSettings().GetFaceGradientColor() ); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 9ce8030c4bb9..ebd4475a80fc 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -557,7 +557,7 @@ public: void DataChanged( const DataChangedEvent& rDCEvt ); - void SetImages( long nMaxHeight = 0 ); + void SetImages( long nMaxHeight = 0, bool bForce = false ); void calcMinSize(); Size getMinSize(); @@ -591,7 +591,7 @@ void DecoToolBox::DataChanged( const DataChangedEvent& rDCEvt ) { calcMinSize(); SetBackground(); - SetImages(); + SetImages( 0, true); } } @@ -625,7 +625,7 @@ Size DecoToolBox::getMinSize() return maMinSize; } -void DecoToolBox::SetImages( long nMaxHeight ) +void DecoToolBox::SetImages( long nMaxHeight, bool bForce ) { long border = getMinSize().Height() - maImage.GetSizePixel().Height(); @@ -635,13 +635,13 @@ void DecoToolBox::SetImages( long nMaxHeight ) if( nMaxHeight < getMinSize().Height() ) nMaxHeight = getMinSize().Height(); - if( lastSize != nMaxHeight - border ) + if( (lastSize != nMaxHeight - border) || bForce ) { lastSize = nMaxHeight - border; Color aEraseColor( 255, 255, 255, 255 ); BitmapEx aBmpExDst( maImage.GetBitmapEx() ); - BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetMenuBarColor().IsDark() ? + BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetHighContrastMode() ? maImageHC.GetBitmapEx() : aBmpExDst ); aEraseColor.SetTransparency( 255 ); @@ -5066,7 +5066,7 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) : aCloser.SetParentClipMode( PARENTCLIPMODE_NOCLIP ); aCloser.InsertItem( IID_DOCUMENTCLOSE, - GetSettings().GetStyleSettings().GetMenuBarColor().IsDark() ? aCloser.maImageHC : aCloser.maImage, 0 ); + GetSettings().GetStyleSettings().GetHighContrastMode() ? aCloser.maImageHC : aCloser.maImage, 0 ); aCloser.SetSelectHdl( LINK( this, MenuBarWindow, CloserHdl ) ); aCloser.AddEventListener( LINK( this, MenuBarWindow, ToolboxEventHdl ) ); aCloser.SetQuickHelpText( IID_DOCUMENTCLOSE, XubString( ResId( SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr ) ) ); @@ -5707,7 +5707,7 @@ void MenuBarWindow::Paint( const Rectangle& ) // in high contrast mode draw a separating line on the lower edge if( ! IsNativeControlSupported( CTRL_MENUBAR, PART_ENTIRE_CONTROL) && - GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) + GetSettings().GetStyleSettings().GetHighContrastMode() ) { Push( PUSH_LINECOLOR | PUSH_MAPMODE ); SetLineColor( Color( COL_WHITE ) ); diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index bd727092a836..3d3245af831f 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -500,7 +500,7 @@ void InfoBox::ImplInitInfoBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_INFO)+1; } @@ -591,7 +591,7 @@ void ErrorBox::ImplInitErrorBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_ERROR)+1; } @@ -637,7 +637,7 @@ void QueryBox::ImplInitQueryBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_QUERY)+1; } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 68fa3b74ccf1..8aa4926f5e1a 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -397,7 +397,7 @@ void ToolBox::ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapp Color startCol, endCol; startCol = pThis->GetSettings().GetStyleSettings().GetFaceGradientColor(); endCol = pThis->GetSettings().GetStyleSettings().GetFaceColor(); - if( endCol.IsDark() ) + if( pThis->GetSettings().GetStyleSettings().GetHighContrastMode() ) // no 'extreme' gradient when high contrast startCol = endCol; diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 7fa8f76e1586..9ec86fab20de 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -2413,10 +2413,10 @@ void ToolBox::ImplUpdateImageList() { if (mpData->mpImageListProvider != NULL) { - BOOL bIsDark = GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); try { - ImageListType eType = bIsDark ? vcl::HIGHCONTRAST_YES : vcl::HIGHCONTRAST_NO; + ImageListType eType = bHC ? vcl::HIGHCONTRAST_YES : vcl::HIGHCONTRAST_NO; if (eType != mpData->meImageListType) { diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 5333d20d4306..aa06e0154f0b 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -292,6 +292,13 @@ bool Window::ImplCheckUIFont( const Font& rFont ) void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) { + // reset high contrast to false, so the system can either update it + // or AutoDetectSystemHC can kick in (see below) + StyleSettings aTmpSt( rSettings.GetStyleSettings() ); + aTmpSt.SetHighContrastMode( FALSE ); + rSettings.SetStyleSettings( aTmpSt ); + ImplGetFrame()->UpdateSettings( rSettings ); + // Verify availability of the configured UI font, otherwise choose "Andale Sans UI" String aUserInterfaceFont; bool bUseSystemFont = rSettings.GetStyleSettings().GetUseSystemUIFonts(); @@ -472,7 +479,8 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) rSettings.SetStyleSettings( aStyleSettings ); - // #104427# auto detect HC mode ? + // auto detect HC mode; if the system already set it to "yes" + // (see above) then accept that if( !rSettings.GetStyleSettings().GetHighContrastMode() ) { sal_Bool bTmp = sal_False, bAutoHCMode = sal_True; @@ -923,7 +931,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) ) { - mpWindowImpl->mpFrame->UpdateSettings( *pSVData->maAppData.mpSettings ); + // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings ); OutputDevice::SetSettings( *pSVData->maAppData.mpSettings ); pSVData->maAppData.mbSettingsInit = TRUE; |