diff options
author | Oliver Bolte <obo@openoffice.org> | 2009-09-08 10:44:42 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2009-09-08 10:44:42 +0000 |
commit | 20e02da5b2d5328b0e31443e19d769ff2aa521f4 (patch) | |
tree | d0aec949b19c5ad35172a1ad85e3226a84265b05 /vcl | |
parent | f4967ff057d7b1534fd0bc71fb8cbb4c6f4f5f0f (diff) |
CWS-TOOLING: integrate CWS vcl104
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/inc/salframe.h | 86 | ||||
-rw-r--r-- | vcl/aqua/source/app/salinst.cxx | 14 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salbmp.cxx | 24 | ||||
-rw-r--r-- | vcl/aqua/source/window/salframe.cxx | 23 | ||||
-rw-r--r-- | vcl/inc/vcl/settings.hxx | 5 | ||||
-rw-r--r-- | vcl/os2/source/window/salframe.cxx | 1 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 3 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 12 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 90 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 11 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 14 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 73 | ||||
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 32 | ||||
-rw-r--r-- | vcl/unx/kde/salnativewidgets-kde.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde4/KDEData.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalFrame.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde4/KDESalGraphics.cxx | 129 | ||||
-rw-r--r-- | vcl/unx/source/app/sm.cxx | 40 | ||||
-rw-r--r-- | vcl/unx/source/gdi/cdeint.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/source/gdi/salgdi.cxx | 83 | ||||
-rw-r--r-- | vcl/unx/source/plugadapt/salplug.cxx | 4 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 1 |
22 files changed, 440 insertions, 210 deletions
diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index aeabdefc72a5..1d1eb3cb6bd3 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -44,6 +44,8 @@ #include <utility> #include <stdexcept> +#include <boost/shared_ptr.hpp> + class AquaSalGraphics; class AquaSalFrame; class AquaSalTimer; @@ -60,47 +62,49 @@ typedef struct SalFrame::SalPointerState SalPointerState; class AquaSalFrame : public SalFrame { public: - NSWindow* mpWindow; // Cocoa window - NSView* mpView; // Cocoa view (actually a custom view, see below - NSMenuItem* mpDockMenuEntry; // entry in the dynamic dock menu - NSRect maScreenRect; // for mirroring purposes - AquaSalGraphics* mpGraphics; // current frame graphics - AquaSalFrame* mpParent; // pointer to parent frame - SystemEnvData maSysData; // system data - int mnMinWidth; // min. client width in pixels - int mnMinHeight; // min. client height in pixels - int mnMaxWidth; // max. client width in pixels - int mnMaxHeight; // max. client height in pixels - NSRect maFullScreenRect; // old window size when in FullScreen - bool mbGraphics:1; // is Graphics used? - bool mbFullScreen:1; // is Window in FullScreen? - bool mbShown:1; - bool mbInitShow:1; - bool mbPositioned:1; - bool mbSized:1; - bool mbPresentation:1; - - ULONG mnStyle; - unsigned int mnStyleMask; // our style mask from NSWindow creation - - ULONG mnLastEventTime; - unsigned int mnLastModifierFlags; - AquaSalMenu* mpMenu; - - SalExtStyle mnExtStyle; // currently document frames are marked this way - - PointerStyle mePointerStyle; // currently active pointer style - - NSTrackingRectTag mnTrackingRectTag; // used to get enter/leave messages - - CGMutablePathRef mrClippingPath; // used for "shaping" - std::vector< CGRect > maClippingRects; - - std::list<AquaBlinker*> maBlinkers; - - Rectangle maInvalidRect; - - ULONG mnICOptions; + NSWindow* mpWindow; // Cocoa window + NSView* mpView; // Cocoa view (actually a custom view, see below + NSMenuItem* mpDockMenuEntry; // entry in the dynamic dock menu + NSRect maScreenRect; // for mirroring purposes + AquaSalGraphics* mpGraphics; // current frame graphics + AquaSalFrame* mpParent; // pointer to parent frame + SystemEnvData maSysData; // system data + int mnMinWidth; // min. client width in pixels + int mnMinHeight; // min. client height in pixels + int mnMaxWidth; // max. client width in pixels + int mnMaxHeight; // max. client height in pixels + NSRect maFullScreenRect; // old window size when in FullScreen + bool mbGraphics:1; // is Graphics used? + bool mbFullScreen:1; // is Window in FullScreen? + bool mbShown:1; + bool mbInitShow:1; + bool mbPositioned:1; + bool mbSized:1; + bool mbPresentation:1; + + ULONG mnStyle; + unsigned int mnStyleMask; // our style mask from NSWindow creation + + ULONG mnLastEventTime; + unsigned int mnLastModifierFlags; + AquaSalMenu* mpMenu; + + SalExtStyle mnExtStyle; // currently document frames are marked this way + + PointerStyle mePointerStyle; // currently active pointer style + + NSTrackingRectTag mnTrackingRectTag; // used to get enter/leave messages + + CGMutablePathRef mrClippingPath; // used for "shaping" + std::vector< CGRect > maClippingRects; + + std::list<AquaBlinker*> maBlinkers; + + Rectangle maInvalidRect; + + ULONG mnICOptions; + + boost::shared_ptr< Timer > mpActivityTimer; // Timer to prevent system sleep during presentation public: /** Constructor diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 71bfb7953187..56bf1a612b40 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -815,6 +815,18 @@ bool AquaSalInstance::AnyInput( USHORT nType ) return false; } + if( nType & INPUT_TIMER ) + { + if( AquaSalTimer::pRunningTimer ) + { + NSDate* pDt = [AquaSalTimer::pRunningTimer fireDate]; + if( pDt && [pDt timeIntervalSinceNow] < 0 ) + { + return true; + } + } + } + unsigned/*NSUInteger*/ nEventMask = 0; if( nType & INPUT_MOUSE) nEventMask |= @@ -828,7 +840,7 @@ bool AquaSalInstance::AnyInput( USHORT nType ) nEventMask |= NSKeyDownMask | NSKeyUpMask | NSFlagsChangedMask; if( nType & INPUT_OTHER) nEventMask |= NSTabletPoint; - // TODO: INPUT_PAINT / INPUT_TIMER / more INPUT_OTHER + // TODO: INPUT_PAINT / more INPUT_OTHER if( !nType) return false; diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index 42f29d677b52..8b7b23a681a0 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -214,16 +214,26 @@ bool AquaSalBitmap::CreateContext() { // convert user data to 32 bit nContextBytesPerRow = mnWidth << 2; - maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] ); + try + { + maContextBuffer.reset( new sal_uInt8[ mnHeight * nContextBytesPerRow ] ); - if( !bSkipConversion ) - ConvertBitmapData( mnWidth, mnHeight, - 32, nContextBytesPerRow, maPalette, maContextBuffer.get(), - mnBits, mnBytesPerRow, maPalette, maUserBuffer.get() ); + if( !bSkipConversion ) + ConvertBitmapData( mnWidth, mnHeight, + 32, nContextBytesPerRow, maPalette, maContextBuffer.get(), + mnBits, mnBytesPerRow, maPalette, maUserBuffer.get() ); + } + catch( std::bad_alloc ) + { + mxGraphicContext = 0; + } } - mxGraphicContext = ::CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight, - bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo ); + if( maContextBuffer.get() ) + { + mxGraphicContext = ::CGBitmapContextCreate( maContextBuffer.get(), mnWidth, mnHeight, + bitsPerComponent, nContextBytesPerRow, aCGColorSpace, aCGBmpInfo ); + } if( !mxGraphicContext ) maContextBuffer.reset(); diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 9c713ea26a52..b942c97cead1 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -43,6 +43,7 @@ #include "aqua11yfactory.h" #include "vcl/salwtype.hxx" #include "vcl/window.hxx" +#include "vcl/timer.hxx" #include "premac.h" // needed for theming @@ -749,16 +750,37 @@ void AquaSalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) // ----------------------------------------------------------------------- +class PreventSleepTimer : public AutoTimer +{ +public: + PreventSleepTimer() + { + SetTimeout( 30000 ); + Start(); + } + + virtual ~PreventSleepTimer() + { + } + + virtual void Timeout() + { + UpdateSystemActivity(OverallAct); + } +}; + void AquaSalFrame::StartPresentation( BOOL bStart ) { if( bStart ) { + mpActivityTimer.reset( new PreventSleepTimer() ); [mpWindow setLevel: NSScreenSaverWindowLevel]; if( mbShown ) [mpWindow makeMainWindow]; } else { + mpActivityTimer.reset(); [mpWindow setLevel: NSNormalWindowLevel]; } } @@ -1173,6 +1195,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) Color aMenuTextColor( getColor( [NSColor textColor], aStyleSettings.GetMenuTextColor(), mpWindow ) ); aStyleSettings.SetMenuTextColor( aMenuTextColor ); + aStyleSettings.SetMenuBarTextColor( aMenuTextColor ); aStyleSettings.SetCursorBlinkTime( 500 ); diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index a7cd61477519..decb7d01b2d4 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -379,6 +379,7 @@ private: Color maMenuHighlightColor; Color maMenuHighlightTextColor; Color maMenuTextColor; + Color maMenuBarTextColor; Color maMonoColor; Color maRadioCheckTextColor; Color maShadowColor; @@ -689,6 +690,10 @@ public: { CopyData(); mpData->maMenuTextColor = rColor; } const Color& GetMenuTextColor() const { return mpData->maMenuTextColor; } + void SetMenuBarTextColor( const Color& rColor ) + { CopyData(); mpData->maMenuBarTextColor = rColor; } + const Color& GetMenuBarTextColor() const + { return mpData->maMenuBarTextColor; } void SetMenuHighlightColor( const Color& rColor ) { CopyData(); mpData->maMenuHighlightColor = rColor; } const Color& GetMenuHighlightColor() const diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 8860d68d683e..345573b268c3 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -2172,6 +2172,7 @@ void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); } aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 444f1f58c8fb..6aa453563596 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -478,6 +478,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maMenuHighlightColor( rData.maMenuHighlightColor ), maMenuHighlightTextColor( rData.maMenuHighlightTextColor ), maMenuTextColor( rData.maMenuTextColor ), + maMenuBarTextColor( rData.maMenuBarTextColor ), maMonoColor( rData.maMonoColor ), maRadioCheckTextColor( rData.maRadioCheckTextColor ), maShadowColor( rData.maShadowColor ), @@ -597,6 +598,7 @@ void ImplStyleData::SetStandardStyles() maMenuBarColor = Color( COL_LIGHTGRAY ); maMenuBorderColor = Color( COL_LIGHTGRAY ); maMenuTextColor = Color( COL_BLACK ); + maMenuBarTextColor = Color( COL_BLACK ); maMenuHighlightColor = Color( COL_BLUE ); maMenuHighlightTextColor = Color( COL_WHITE ); maHighlightColor = Color( COL_BLUE ); @@ -1028,6 +1030,7 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->maMenuBarColor == rSet.mpData->maMenuBarColor) && (mpData->maMenuBorderColor == rSet.mpData->maMenuBorderColor) && (mpData->maMenuTextColor == rSet.mpData->maMenuTextColor) && + (mpData->maMenuBarTextColor == rSet.mpData->maMenuBarTextColor) && (mpData->maMenuHighlightColor == rSet.mpData->maMenuHighlightColor) && (mpData->maMenuHighlightTextColor == rSet.mpData->maMenuHighlightTextColor) && (mpData->maHighlightColor == rSet.mpData->maHighlightColor) && diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 49c7e5457da7..9f5160a2af11 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -800,14 +800,8 @@ void ComboBox::DataChanged( const DataChangedEvent& rDCEvt ) long ComboBox::PreNotify( NotifyEvent& rNEvt ) { - long nDone = 0; - - if( ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) ) - { - mpSubEdit->GrabFocus(); - } - return nDone ? nDone : Edit::PreNotify( rNEvt ); + return Edit::PreNotify( rNEvt ); } // ----------------------------------------------------------------------- @@ -886,6 +880,10 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) nDone = 0; // don't eat this event, let the default handling happen (i.e. scroll the context) } } + else if( ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) && ( rNEvt.GetWindow() == mpImplLB->GetMainWindow() ) ) + { + mpSubEdit->GrabFocus(); + } return nDone ? nDone : Edit::Notify( rNEvt ); } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 2aa062775be8..08870160b97b 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6,8 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: outdev3.cxx,v $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -4498,71 +4496,79 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, FontStrikeout eStrikeout, Color aColor ) { - BOOL bOldMap = IsMapModeEnabled(); - EnableMapMode( FALSE ); - - Color aOldColor = GetTextColor(); - SetTextColor( aColor ); - ImplInitTextColor(); + // PDF-export does its own strikeout drawing... why again? + if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) + return; - xub_Unicode pChars[5]; + // prepare string for strikeout measurement + static char cStrikeoutChar; if ( eStrikeout == STRIKEOUT_SLASH ) - pChars[0] = '/'; + cStrikeoutChar = '/'; else // ( eStrikeout == STRIKEOUT_X ) - pChars[0] = 'X'; - pChars[3]=pChars[2]=pChars[1]=pChars[0]; + cStrikeoutChar = 'X'; + static const int nTestStrLen = 4; + static const int nMaxStrikeStrLen = 2048; + xub_Unicode aChars[ nMaxStrikeStrLen +1]; // +1 for valgrind... + for( int i = 0; i < nTestStrLen; ++i) + aChars[i] = cStrikeoutChar; + const String aStrikeoutTest( aChars, nTestStrLen ); // calculate approximation of strikeout atom size long nStrikeoutWidth = nWidth; String aStrikeoutTest( pChars, 4 ); - SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, 4 ); - if ( pLayout ) + SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen ); + if( pLayout ) { - nStrikeoutWidth = (pLayout->GetTextWidth() + 2) / (4 * pLayout->GetUnitsPerPixel()); + nStrikeoutWidth = (pLayout->GetTextWidth() +nTestStrLen/2) / (nTestStrLen * pLayout->GetUnitsPerPixel()); pLayout->Release(); - if ( nStrikeoutWidth <= 0 ) // sanity check - nStrikeoutWidth = 1; } + if( nStrikeoutWidth <= 0 ) // sanity check + return; // calculate acceptable strikeout length // allow the strikeout to be one pixel larger than the text it strikes out - long nMaxWidth = nStrikeoutWidth/2; + long nMaxWidth = nStrikeoutWidth / 2; if ( nMaxWidth < 2 ) nMaxWidth = 2; nMaxWidth += nWidth + 1; - // build strikeout string - long nFullStrikeoutWidth = 0; - String aStrikeoutText( pChars, 0 ); - while ( (nFullStrikeoutWidth+=nStrikeoutWidth) < nMaxWidth+1 ) - aStrikeoutText += pChars[0]; - + int nStrikeStrLen = (nMaxWidth + nStrikeoutWidth - 1) / nStrikeoutWidth; // if the text width is smaller than the strikeout text, then do not // strike out at all. This case requires user interaction, e.g. adding // a space to the text - if ( (aStrikeoutText.Len() > 0) - && !(mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) ) - { - if ( mpFontEntry->mnOrientation ) - ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); + if( nStrikeStrLen <= 0 ) + return; + if( nStrikeStrLen > nMaxStrikeStrLen ) + nStrikeStrLen = nMaxStrikeStrLen; - // strikeout text has to be left aligned - ULONG nOrigTLM = mnTextLayoutMode; - mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; - SalLayout* pSalLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); - mnTextLayoutMode = nOrigTLM; + // build the strikeout string + for( int i = nTestStrLen; i < nStrikeStrLen; ++i) + aChars[i] = cStrikeoutChar; + const String aStrikeoutText( aChars, xub_StrLen(nStrikeStrLen) ); - if ( pSalLayout ) - { - pSalLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); - pSalLayout->DrawText( *mpGraphics ); - pSalLayout->Release(); - } - } + if( mpFontEntry->mnOrientation ) + ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); + + // strikeout text has to be left aligned + ULONG nOrigTLM = mnTextLayoutMode; + mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; + pLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); + mnTextLayoutMode = nOrigTLM; + + if( !pLayout ) + return; + + // draw the strikeout text + const Color aOldColor = GetTextColor(); + SetTextColor( aColor ); + ImplInitTextColor(); + + pLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); + pLayout->DrawText( *mpGraphics ); + pLayout->Release(); SetTextColor( aOldColor ); ImplInitTextColor(); - EnableMapMode( bOldMap ); } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 2cbebf6f23e2..e7ee18ec7705 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -805,7 +805,7 @@ class Matrix3 { double f[6]; - void set( double *pn ) { for( int i = 0 ; i < 5; i++ ) f[i] = pn[i]; } + void set( double *pn ) { for( int i = 0 ; i < 6; i++ ) f[i] = pn[i]; } public: Matrix3(); ~Matrix3() {} @@ -6787,14 +6787,15 @@ void PDFWriterImpl::drawHorizontalGlyphs( for( sal_uInt32 nPos = nBeginRun+1; nPos < aRunEnds[nRun]; nPos++ ) { appendHex( rGlyphs[nPos].m_nMappedGlyphId, aUnkernedLine ); - // check if glyph advance matches with the width of the previous glyph, else adjust + // check if default glyph positioning is sufficient const Point aThisPos = aMat.transform( rGlyphs[nPos].m_aPos ); const Point aPrevPos = aMat.transform( rGlyphs[nPos-1].m_aPos ); double fAdvance = aThisPos.X() - aPrevPos.X(); - fAdvance *= 1000.0 / (fXScale * nPixelFontHeight); - const sal_Int32 nAdjustment = rGlyphs[nPos-1].m_nNativeWidth - sal_Int32(fAdvance+0.5); + fAdvance *= 1000.0 / nPixelFontHeight; + const sal_Int32 nAdjustment = (sal_Int32)(rGlyphs[nPos-1].m_nNativeWidth - fAdvance + 0.5); if( nAdjustment != 0 ) { + // apply individual glyph positioning bNeedKern = true; aKernedLine.append( ">" ); aKernedLine.append( nAdjustment ); @@ -8643,6 +8644,8 @@ void PDFWriterImpl::drawPolyLine( const Polygon& rPoly, const PDFWriter::ExtLine for(sal_uInt32 a(0); a < nEdgeCount; a++) { + if( a > 0 ) + aLine.append( " " ); const sal_uInt32 nNextIndex((a + 1) % nPointCount); const basegfx::B2DPoint aNext(aPoly.getB2DPoint(nNextIndex)); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ccf75dbd59b3..9ce8030c4bb9 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2731,7 +2731,14 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* } if ( pThisItemOnly && bHighlighted ) - pWin->SetTextColor( rSettings.GetMenuTextColor() ); + { + // This restores the normal menu or menu bar text + // color for when it is no longer highlighted. + if ( bIsMenuBar ) + pWin->SetTextColor( rSettings.GetMenuBarTextColor() ); + else + pWin->SetTextColor( rSettings.GetMenuTextColor() ); + } } if( bLayout ) { @@ -3787,7 +3794,10 @@ static void ImplInitMenuWindow( Window* pWin, BOOL bFont, BOOL bMenuBar ) pWin->SetBackground( Wallpaper( rStyleSettings.GetMenuColor() ) ); } - pWin->SetTextColor( rStyleSettings.GetMenuTextColor() ); + if ( bMenuBar ) + pWin->SetTextColor( rStyleSettings.GetMenuBarTextColor() ); + else + pWin->SetTextColor( rStyleSettings.GetMenuTextColor() ); pWin->SetTextFillColor(); pWin->SetLineColor(); } diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index bb1f428c6626..68fa3b74ccf1 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1901,37 +1901,78 @@ BOOL ToolBox::ImplCalcItem() nDefWidth = GetDefaultImageSize().Width(); nDefHeight = GetDefaultImageSize().Height(); + mnWinHeight = 0; // determine minimum size necessary in NWF - if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) { Rectangle aRect( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); - Region aArrowReg = aRect; + Region aReg = aRect; ImplControlValue aVal; Region aNativeBounds, aNativeContent; - if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, - aArrowReg, + if( IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) ) + { + if( GetNativeControlRegion( CTRL_TOOLBAR, PART_BUTTON, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetWidth() > nMinWidth ) + nMinWidth = aRect.GetWidth(); + if( aRect.GetHeight() > nMinHeight ) + nMinHeight = aRect.GetHeight(); + if( nDropDownArrowWidth < nMinWidth ) + nDropDownArrowWidth = nMinWidth; + if( nMinWidth > mpData->mnMenuButtonWidth ) + mpData->mnMenuButtonWidth = nMinWidth; + else if( nMinWidth < TB_MENUBUTTON_SIZE ) + mpData->mnMenuButtonWidth = TB_MENUBUTTON_SIZE; + } + } + + // also calculate the area for comboboxes, drop down list boxes and spinfields + // as these are often inserted into toolboxes; set mnWinHeight to the + // greater of those values to prevent toolbar flickering (#i103385#) + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_COMBOBOX, PART_ENTIRE_CONTROL, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); + } + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, + aReg, CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, aVal, OUString(), aNativeBounds, aNativeContent ) ) { aRect = aNativeBounds.GetBoundRect(); - if( aRect.GetWidth() > nMinWidth ) - nMinWidth = aRect.GetWidth(); - if( aRect.GetHeight() > nMinHeight ) - nMinHeight = aRect.GetHeight(); - if( nDropDownArrowWidth < nMinWidth ) - nDropDownArrowWidth = nMinWidth; - if( nMinWidth > mpData->mnMenuButtonWidth ) - mpData->mnMenuButtonWidth = nMinWidth; - else if( nMinWidth < TB_MENUBUTTON_SIZE ) - mpData->mnMenuButtonWidth = TB_MENUBUTTON_SIZE; + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); + } + aRect = Rectangle( Point( 0, 0 ), Size( nMinWidth, nMinHeight ) ); + aReg = aRect; + if( GetNativeControlRegion( CTRL_SPINBOX, PART_ENTIRE_CONTROL, + aReg, + CTRL_STATE_ENABLED | CTRL_STATE_ROLLOVER, + aVal, OUString(), + aNativeBounds, aNativeContent ) ) + { + aRect = aNativeBounds.GetBoundRect(); + if( aRect.GetHeight() > mnWinHeight ) + mnWinHeight = aRect.GetHeight(); } } if ( ! mpData->m_aItems.empty() ) { - mnWinHeight = 0; - std::vector< ImplToolItem >::iterator it = mpData->m_aItems.begin(); while ( it != mpData->m_aItems.end() ) { diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index fdaa102c614b..6208d3b859c2 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3291,12 +3291,38 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) aBackColor = getColor( pMenubarStyle->bg[GTK_STATE_NORMAL] ); aStyleSet.SetMenuBarColor( aBackColor ); aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] ); - aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] ); - if( aBackColor == aTextColor ) - aTextColor = (aBackColor.GetLuminance() < 128) ? Color( COL_WHITE ) : Color( COL_BLACK ); + aTextColor = getColor( pMenuTextStyle->text[GTK_STATE_NORMAL] ); aStyleSet.SetMenuColor( aBackColor ); aStyleSet.SetMenuTextColor( aTextColor ); + aTextColor = getColor( pMenubarStyle->text[GTK_STATE_NORMAL] ); + aStyleSet.SetMenuBarTextColor( aTextColor ); + +#if OSL_DEBUG_LEVEL > 1 + std::fprintf( stderr, "==\n" ); + std::fprintf( stderr, "MenuColor = %x (%d)\n", (int)aStyleSet.GetMenuColor().GetColor(), aStyleSet.GetMenuColor().GetLuminance() ); + std::fprintf( stderr, "MenuTextColor = %x (%d)\n", (int)aStyleSet.GetMenuTextColor().GetColor(), aStyleSet.GetMenuTextColor().GetLuminance() ); + std::fprintf( stderr, "MenuBarColor = %x (%d)\n", (int)aStyleSet.GetMenuBarColor().GetColor(), aStyleSet.GetMenuBarColor().GetLuminance() ); + std::fprintf( stderr, "MenuBarTextColor = %x (%d)\n", (int)aStyleSet.GetMenuBarTextColor().GetColor(), aStyleSet.GetMenuBarTextColor().GetLuminance() ); + std::fprintf( stderr, "LightColor = %x (%d)\n", (int)aStyleSet.GetLightColor().GetColor(), aStyleSet.GetLightColor().GetLuminance() ); + std::fprintf( stderr, "ShadowColor = %x (%d)\n", (int)aStyleSet.GetShadowColor().GetColor(), aStyleSet.GetShadowColor().GetLuminance() ); +#endif + + // Awful hack for menu separators in the Sonar and similar themes. + // If the menu color is not too dark, and the menu text color is lighter, + // make the "light" color lighter than the menu color and the "shadow" + // color darker than it. + if ( aStyleSet.GetMenuColor().GetLuminance() >= 32 && + aStyleSet.GetMenuColor().GetLuminance() <= aStyleSet.GetMenuTextColor().GetLuminance() ) + { + Color temp = aStyleSet.GetMenuColor(); + temp.IncreaseLuminance( 8 ); + aStyleSet.SetLightColor( temp ); + temp = aStyleSet.GetMenuColor(); + temp.DecreaseLuminance( 16 ); + aStyleSet.SetShadowColor( temp ); + } + aHighlightColor = getColor( pMenuItemStyle->bg[ GTK_STATE_SELECTED ] ); aHighlightTextColor = getColor( pMenuTextStyle->fg[ GTK_STATE_PRELIGHT ] ); if( aHighlightColor == aHighlightTextColor ) diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 24358022d6a1..f5a2b57eb6a2 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -1996,6 +1996,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) } aStyleSettings.SetMenuTextColor( aMenuFore ); + aStyleSettings.SetMenuBarTextColor( aMenuFore ); aStyleSettings.SetMenuColor( aMenuBack ); aStyleSettings.SetMenuBarColor( aMenuBack ); diff --git a/vcl/unx/kde4/KDEData.cxx b/vcl/unx/kde4/KDEData.cxx index 07a10c60d933..91e3a758da3c 100644 --- a/vcl/unx/kde4/KDEData.cxx +++ b/vcl/unx/kde4/KDEData.cxx @@ -45,6 +45,8 @@ void KDEData::initNWF() // draw toolbars on separate lines pSVData->maNWFData.mbDockingAreaSeparateTB = true; + // no borders for menu, theming does that + pSVData->maNWFData.mbFlatMenu = true; } void KDEData::deInitNWF() diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index ad8f467ee960..796350a63d50 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -318,6 +318,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) aMenuBack = toColor( qMenuCG.color( QPalette::Button ) ); style.SetMenuTextColor( aMenuFore ); + style.SetMenuBarTextColor( aMenuFore ); style.SetMenuColor( aMenuBack ); style.SetMenuBarColor( aMenuBack ); diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index ae917f252b11..2e8f0dcad96b 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -35,6 +35,8 @@ #include <QStyle> #include <QStyleOption> #include <QPainter> +#include <QFrame> +#include <QLabel> #include <kapplication.h> @@ -42,10 +44,9 @@ #include "KDESalGraphics.hxx" -#include <vcl/settings.hxx> -#include <rtl/ustrbuf.hxx> - -#include <stdio.h> +#include "vcl/settings.hxx" +#include "vcl/decoview.hxx" +#include "rtl/ustrbuf.hxx" using namespace ::rtl; @@ -150,6 +151,30 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart, return FALSE; } +void lcl_drawFrame( QRect& i_rRect, QPainter& i_rPainter, QStyle::PrimitiveElement i_nElement, + ControlState i_nState, const ImplControlValue& i_rValue ) +{ + #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) + QStyleOptionFrameV3 styleOption; + styleOption.frameShape = QFrame::StyledPanel; + #else + QStyleOptionFrame styleOption; + QFrame aFrame( NULL ); + aFrame.setFrameRect( QRect(0, 0, i_rRect.width(), i_rRect.height()) ); + aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); + aFrame.ensurePolished(); + styleOption.initFrom( &aFrame ); + styleOption.lineWidth = aFrame.lineWidth(); + styleOption.midLineWidth = aFrame.midLineWidth(); + #endif + styleOption.rect = QRect(0, 0, i_rRect.width(), i_rRect.height()); + styleOption.state = vclStateValue2StateFlag( i_nState, i_rValue ); + #if ( QT_VERSION < QT_VERSION_CHECK( 4, 5, 0 ) ) + styleOption.state |= QStyle::State_Sunken; + #endif + kapp->style()->drawPrimitive(i_nElement, &styleOption, &i_rPainter); +} + BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, const Region& rControlRegion, ControlState nControlState, const ImplControlValue& value, SalControlHandle&, @@ -352,18 +377,25 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_LISTBOX) { - QStyleOptionComboBox styleOption; - - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - - if (part == PART_SUB_EDIT) + if( part == PART_WINDOW ) { - kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter); + lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else { - kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter); + QStyleOptionComboBox styleOption; + + styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); + styleOption.state = vclStateValue2StateFlag( nControlState, value ); + + if (part == PART_SUB_EDIT) + { + kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter); + } + else + { + kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter); + } } } else if (type == CTRL_LISTNODE) @@ -481,33 +513,11 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_FRAME) { - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; - #else - QStyleOptionFrameV2 styleOption; - #endif - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - styleOption.frameShape = QFrame::StyledPanel; - #endif - - kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter); + lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else if (type == CTRL_FIXEDBORDER) { - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - QStyleOptionFrameV3 styleOption; - #else - QStyleOptionFrameV2 styleOption; - #endif - styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height()); - styleOption.state = vclStateValue2StateFlag( nControlState, value ); - #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) ) - styleOption.frameShape = QFrame::StyledPanel; - #endif - - kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter); + lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value ); } else if (type == CTRL_WINDOW_BACKGROUND) { @@ -573,14 +583,21 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, break; case CTRL_EDITBOX: { - styleOption.rect = QRect(0, 0, contentRect.width(), contentRect.height()); - styleOption.state = vclStateValue2StateFlag(controlState, val); - - int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) - 1; - - contentRect.adjust( -size, -size, size, size); - boundingRect = contentRect; - + int nFontHeight = kapp->fontMetrics().height(); + //int nFrameSize = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); + int nLayoutTop = kapp->style()->pixelMetric(QStyle::PM_LayoutTopMargin); + int nLayoutBottom = kapp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin); + int nLayoutLeft = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + int nLayoutRight = kapp->style()->pixelMetric(QStyle::PM_LayoutRightMargin); + + int nMinHeight = (nFontHeight + nLayoutTop + nLayoutBottom); + if( boundingRect.height() < nMinHeight ) + { + int delta = nMinHeight - boundingRect.height(); + boundingRect.adjust( 0, 0, 0, delta ); + } + contentRect = boundingRect; + contentRect.adjust( -nLayoutLeft+1, -nLayoutTop+1, nLayoutRight-1, nLayoutBottom-1 ); retVal = true; break; @@ -621,7 +638,6 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, case PART_ENTIRE_CONTROL: { int size = kapp->style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2; - contentRect.adjust(-size,-size,size,size); // find out the minimum size that should be used // assume contents is a text ling @@ -632,6 +648,11 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, if( aMinSize.height() > contentRect.height() ) contentRect.adjust( 0, 0, 0, aMinSize.height() - contentRect.height() ); boundingRect = contentRect; + // FIXME: why this difference between comboboxes and listboxes ? + // because a combobox has a sub edit and that is positioned + // inside the outer bordered control ? + if( type == CTRL_COMBOBOX ) + contentRect.adjust(-size,-size,size,size); retVal = true; break; } @@ -647,6 +668,9 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, retVal = true; break; + case PART_WINDOW: + retVal = true; + break; } break; } @@ -703,14 +727,19 @@ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part, break; case CTRL_FRAME: { - if (part == PART_BORDER) + if( part == PART_BORDER ) { - int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - //contentRect.adjust(size, size, size, size); - boundingRect.adjust(-size, -size, size, size); + int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + USHORT nStyle = val.getNumericVal(); + if( nStyle & FRAME_DRAW_NODRAW ) + { + // in this case the question is: how thick would a frame be + // see brdwin.cxx, decoview.cxx + // most probably the behavior in decoview.cxx is wrong. + contentRect.adjust(size, size, -size, -size); + } retVal = true; } - break; } case CTRL_RADIOBUTTON: diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index 7e4e16579623..ff981b04259b 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -48,6 +48,7 @@ #include <saldisp.hxx> #include <salframe.h> #include <vcl/svapp.hxx> +#include <vcl/window.hxx> #include <salinst.h> #include <osl/conditn.h> @@ -187,6 +188,7 @@ bool SessionManagerClient::bDocSaveDone = false; static SmProp* pSmProps = NULL; static SmProp** ppSmProps = NULL; static int nSmProps = 0; +static unsigned char *pSmRestartHint = NULL; static void BuildSmPropertyList() @@ -195,7 +197,7 @@ static void BuildSmPropertyList() { ByteString aExec( SessionManagerClient::getExecName(), osl_getThreadTextEncoding() ); - nSmProps = 4; + nSmProps = 5; pSmProps = new SmProp[ nSmProps ]; pSmProps[ 0 ].name = const_cast<char*>(SmCloneCommand); @@ -243,6 +245,15 @@ static void BuildSmPropertyList() pSmProps[ 3 ].vals->value = strdup( aUser.getStr() ); pSmProps[ 3 ].vals->length = strlen( (char *)pSmProps[ 3 ].vals->value )+1; + pSmProps[ 4 ].name = const_cast<char*>(SmRestartStyleHint); + pSmProps[ 4 ].type = const_cast<char*>(SmCARD8); + pSmProps[ 4 ].num_vals = 1; + pSmProps[ 4 ].vals = new SmPropValue; + pSmProps[ 4 ].vals->value = malloc(1); + pSmRestartHint = (unsigned char *)pSmProps[ 4 ].vals->value; + *pSmRestartHint = SmRestartIfRunning; + pSmProps[ 4 ].vals->length = 1; + ppSmProps = new SmProp*[ nSmProps ]; for( int i = 0; i < nSmProps; i++ ) ppSmProps[ i ] = &pSmProps[i]; @@ -257,6 +268,31 @@ bool SessionManagerClient::checkDocumentsSaved() IMPL_STATIC_LINK( SessionManagerClient, SaveYourselfHdl, void*, EMPTYARG ) { SMprintf( "posting save documents event shutdown = %s\n", (pThis!=0) ? "true" : "false" ); + + static bool bFirstShutdown=true; + if (pThis != 0 && bFirstShutdown) //first shutdown request + { + bFirstShutdown = false; + /* + If we have no actual frames open, e.g. we launched a quickstarter, + and then shutdown all our frames leaving just a quickstarter running, + then we don't want to launch an empty toplevel frame on the next + start. (The job of scheduling the restart of the quick-starter is a + task of the quick-starter) + */ + *pSmRestartHint = SmRestartNever; + const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames(); + for( std::list< SalFrame* >::const_iterator it = rFrames.begin(); it != rFrames.end(); ++it ) + { + Window *pWindow = (*it)->GetWindow(); + if (pWindow && pWindow->IsVisible()) + { + *pSmRestartHint = SmRestartIfRunning; + break; + } + } + } + if( pOneInstance ) { SalSessionSaveRequestEvent aEvent( pThis != 0, false ); @@ -385,7 +421,7 @@ void SessionManagerClient::saveDone() ICEConnectionObserver::lock(); SmcSetProperties( aSmcConnection, nSmProps, ppSmProps ); SmcSaveYourselfDone( aSmcConnection, True ); - SMprintf( "sent SaveYourselfDone\n" ); + SMprintf( "sent SaveYourselfDone SmRestartHint of %d\n", *pSmRestartHint ); bDocSaveDone = true; ICEConnectionObserver::unlock(); } diff --git a/vcl/unx/source/gdi/cdeint.cxx b/vcl/unx/source/gdi/cdeint.cxx index 4d2a6dba78ca..3794737b293e 100644 --- a/vcl/unx/source/gdi/cdeint.cxx +++ b/vcl/unx/source/gdi/cdeint.cxx @@ -216,6 +216,7 @@ void CDEIntegrator::GetSystemLook( AllSettings& rSettings ) aStyleSettings.SetDialogTextColor( aDeactive ); aStyleSettings.SetMenuTextColor( aDeactive ); + aStyleSettings.SetMenuBarTextColor( aDeactive ); aStyleSettings.SetButtonTextColor( aDeactive ); aStyleSettings.SetRadioCheckTextColor( aDeactive ); aStyleSettings.SetGroupTextColor( aDeactive ); diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 4d3e40840a7b..34f2dfd4b935 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1176,11 +1176,11 @@ typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet; } // end of anonymous namespace // draw a poly-polygon -bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, double fTransparency) +bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPolyPoly, double fTransparency) { // nothing to do for empty polypolygons - const int nPolygonCount = rPolyPoly.count(); - if( nPolygonCount <= 0 ) + const int nOrigPolyCount = rOrigPolyPoly.count(); + if( nOrigPolyCount <= 0 ) return TRUE; // nothing to do if everything is transparent @@ -1209,28 +1209,22 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly // don't bother with polygons outside of visible area const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); - const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rPolyPoly ); + const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly ); const bool bNeedViewClip = !aPolyRange.isInside( aViewRange ); if( !aPolyRange.overlaps( aViewRange ) ) return true; // convert the polypolygon to trapezoids - // first convert the B2DPolyPolygon to HalfTrapezoids - // #i100922# try to prevent priority-queue reallocations by reservering enough + // prepare the polypolygon for the algorithm below: + // - clip it against the view range + // - make sure it contains no self-intersections + // while we are at it guess the number of involved polygon points int nHTQueueReserve = 0; - for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx ) - { - const ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx ); - const int nPointCount = aOuterPolygon.count(); - nHTQueueReserve += aOuterPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; - } - nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; - HTQueue aHTQueue; - aHTQueue.reserve( nHTQueueReserve ); - for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx ) + basegfx::B2DPolyPolygon aGoodPolyPoly; + for( int nOrigPolyIdx = 0; nOrigPolyIdx < nOrigPolyCount; ++nOrigPolyIdx ) { - const ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx ); + const ::basegfx::B2DPolygon aOuterPolygon = rOrigPolyPoly.getB2DPolygon( nOrigPolyIdx ); // render-trapezoids should be inside the view => clip polygon against view range basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon ); @@ -1238,33 +1232,55 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly { aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false ); DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" ); - if( !aClippedPolygon.count() ) - continue; } + const int nClippedPolyCount = aClippedPolygon.count(); + if( !nClippedPolyCount ) + continue; - // render-trapezoids have linear edges => get rid of bezier segments - if( aClippedPolygon.areControlPointsUsed() ) - aClippedPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aClippedPolygon, 0.125 ); - - // test and remove self intersections - // TODO: make code intersection save, then remove this test - basegfx::B2DPolyPolygon aInnerPolyPoly(basegfx::tools::solveCrossovers( aClippedPolygon)); - const int nInnerPolyCount = aInnerPolyPoly.count(); - for( int nInnerPolyIdx = 0; nInnerPolyIdx < nInnerPolyCount; ++nInnerPolyIdx ) + // #i103259# polypoly.solveCrossover() fails to remove self-intersections + // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon + // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections + for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) { - ::basegfx::B2DPolygon aInnerPolygon = aInnerPolyPoly.getB2DPolygon( nInnerPolyIdx ); - const int nPointCount = aInnerPolygon.count(); - if( !nPointCount ) - continue; + ::basegfx::B2DPolygon aUnsolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); + basegfx::B2DPolyPolygon aSolvedPolyPoly( basegfx::tools::solveCrossovers( aUnsolvedPolygon) ); + const int nSolvedPolyCount = aSolvedPolyPoly.count(); + for( int nSolvedPolyIdx = 0; nSolvedPolyIdx < nSolvedPolyCount; ++nSolvedPolyIdx ) + { + // build the intersection-free polypolygon one by one + const ::basegfx::B2DPolygon aSolvedPolygon = aSolvedPolyPoly.getB2DPolygon( nSolvedPolyIdx ); + aGoodPolyPoly.append( aSolvedPolygon ); + // and while we are at it use the conviently available point count to guess the number of needed half-traps + const int nPointCount = aSolvedPolygon.count(); + nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; + } + } + } + // #i100922# try to prevent priority-queue reallocations by reservering enough + nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; + HTQueue aHTQueue; + aHTQueue.reserve( nHTQueueReserve ); - aHTQueue.reserve( aHTQueue.size() + 8 * nPointCount ); + // first convert the B2DPolyPolygon to HalfTrapezoids + const int nGoodPolyCount = aGoodPolyPoly.count(); + for( int nGoodPolyIdx = 0; nGoodPolyIdx < nGoodPolyCount; ++nGoodPolyIdx ) + { + ::basegfx::B2DPolygon aInnerPolygon = aGoodPolyPoly.getB2DPolygon( nGoodPolyIdx ); + + // render-trapezoids have linear edges => get rid of bezier segments + if( aInnerPolygon.areControlPointsUsed() ) + aInnerPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aInnerPolygon, 0.125 ); + const int nPointCount = aInnerPolygon.count(); + if( nPointCount >= 3 ) + { // convert polygon point pairs to HalfTrapezoids // connect the polygon point with the first one if needed XPointFixed aOldXPF = { 0, 0 }; XPointFixed aNewXPF; for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF ) { + // auto-close the polygon if needed const int k = (nPointIdx < nPointCount) ? nPointIdx : 0; const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k ); @@ -1551,3 +1567,4 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 8a1ed05b8e25..48908ec498c5 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -382,10 +382,10 @@ static const char * get_desktop_environment() if ( is_kde4_desktop( pDisplay ) ) pRet = desktop_strings[DESKTOP_KDE4]; - else if ( is_kde_desktop( pDisplay ) ) - pRet = desktop_strings[DESKTOP_KDE]; else if ( is_gnome_desktop( pDisplay ) ) pRet = desktop_strings[DESKTOP_GNOME]; + else if ( is_kde_desktop( pDisplay ) ) + pRet = desktop_strings[DESKTOP_KDE]; else if ( is_cde_desktop( pDisplay ) ) pRet = desktop_strings[DESKTOP_CDE]; else diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 3ffc358bd76d..0794bfd6db22 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2930,6 +2930,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetUseFlatBorders( FALSE ); aStyleSettings.SetUseFlatMenues( FALSE ); aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); + aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) ); aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) ); aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) ); aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) ); |