From 7a729e8a855090a1aaaa875bbf954bc6d2c5aa95 Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 23 Jan 2020 14:44:59 +0100 Subject: [PATCH 001/329] Add handler for ICNS files (wxBITMAP_TYPE_ICON) After some recent changes bitmaps and icons with the type wxBITMAP_TYPE_ICON could no longer be loaded. This implements a handler for this (macOS only) bitmap type like the handler for wxBITMAP_TYPE_ICON_RESOURCE. --- src/osx/core/bitmap.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 550fc9c6d1..fd6ac4bc6f 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -1709,6 +1709,44 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxJPEGResourceHandler, wxBundleResourceHandler); #if wxOSX_USE_COCOA +class WXDLLEXPORT wxICNSHandler: public wxBitmapHandler +{ + wxDECLARE_DYNAMIC_CLASS(wxICNSHandler); + +public: + inline wxICNSHandler() + { + SetName(wxT("icns file")); + SetExtension("icns"); + SetType(wxBITMAP_TYPE_ICON); + } + + bool LoadFile(wxBitmap *bitmap, + const wxString& name, + wxBitmapType type, + int desiredWidth, + int desiredHeight) wxOVERRIDE + { + wxCFRef iconURL; + wxCFStringRef filePath(name); + + iconURL.reset(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, filePath, kCFURLPOSIXPathStyle, false)); + + WXImage img = wxOSXGetNSImageFromCFURL(iconURL); + + if ( img ) + { + bitmap->Create(img); + return true; + } + + return wxBitmapHandler::LoadFile( bitmap, name, type, desiredWidth, desiredHeight); + } + +}; + +wxIMPLEMENT_DYNAMIC_CLASS(wxICNSHandler, wxBitmapHandler); + class WXDLLEXPORT wxICNSResourceHandler: public wxBundleResourceHandler { wxDECLARE_DYNAMIC_CLASS(wxICNSResourceHandler); @@ -1915,6 +1953,7 @@ void wxBitmap::InitStandardHandlers() { #if wxOSX_USE_COCOA_OR_CARBON // no icns on iOS + AddHandler( new wxICNSHandler ); AddHandler( new wxICNSResourceHandler ) ; #endif AddHandler( new wxPNGResourceHandler ); From c9c2d1fba45e6fa3f3ae38f01be520f64fb57cec Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Thu, 23 Jan 2020 21:06:40 +0100 Subject: [PATCH 002/329] Remove unused carbon files These files where no longer referenced by any build system and where probably left overs from before carbon was removed. --- include/wx/osx/carbon/private/overlay.h | 57 - src/osx/carbon/colordlg.cpp | 79 -- src/osx/carbon/icon.cpp | 604 ---------- src/osx/carbon/main.cpp | 11 - src/osx/carbon/overlay.cpp | 182 --- src/osx/carbon/thread.cpp | 1347 ----------------------- 6 files changed, 2280 deletions(-) delete mode 100644 include/wx/osx/carbon/private/overlay.h delete mode 100644 src/osx/carbon/colordlg.cpp delete mode 100644 src/osx/carbon/icon.cpp delete mode 100644 src/osx/carbon/main.cpp delete mode 100644 src/osx/carbon/overlay.cpp delete mode 100644 src/osx/carbon/thread.cpp diff --git a/include/wx/osx/carbon/private/overlay.h b/include/wx/osx/carbon/private/overlay.h deleted file mode 100644 index f5ebe1d83e..0000000000 --- a/include/wx/osx/carbon/private/overlay.h +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wx/osx/carbon/private/overlay.h -// Purpose: wxOverlayImpl declaration -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_MAC_CARBON_PRIVATE_OVERLAY_H_ -#define _WX_MAC_CARBON_PRIVATE_OVERLAY_H_ - -#include "wx/osx/private.h" -#include "wx/toplevel.h" -#include "wx/graphics.h" - -class wxOverlayImpl -{ -public: - wxOverlayImpl() ; - ~wxOverlayImpl() ; - - - // clears the overlay without restoring the former state - // to be done eg when the window content has been changed and repainted - void Reset(); - - // returns true if it has been setup - bool IsOk(); - - void Init( wxDC* dc, int x , int y , int width , int height ); - - void BeginDrawing( wxDC* dc); - - void EndDrawing( wxDC* dc); - - void Clear( wxDC* dc); - -private: - OSStatus CreateOverlayWindow(); - - void MacGetBounds( Rect *bounds ); - - WindowRef m_overlayWindow; - WindowRef m_overlayParentWindow; - CGContextRef m_overlayContext ; - // we store the window in case we would have to issue a Refresh() - wxWindow* m_window ; - - int m_x ; - int m_y ; - int m_width ; - int m_height ; -} ; - -#endif // _WX_MAC_CARBON_PRIVATE_OVERLAY_H_ diff --git a/src/osx/carbon/colordlg.cpp b/src/osx/carbon/colordlg.cpp deleted file mode 100644 index a5f5fd3a7a..0000000000 --- a/src/osx/carbon/colordlg.cpp +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/colordlg.cpp -// Purpose: wxColourDialog class. NOTE: you can use the generic class -// if you wish, instead of implementing this. -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#include "wx/colordlg.h" -#include "wx/fontdlg.h" -#include "wx/modalhook.h" - - -#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX && wxUSE_COLOURDLG - -wxIMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog); - -#include "wx/osx/private.h" - -/* - * wxColourDialog - */ - -wxColourDialog::wxColourDialog() -{ - m_dialogParent = NULL; -} - -wxColourDialog::wxColourDialog(wxWindow *parent, const wxColourData *data) -{ - Create(parent, data); -} - -bool wxColourDialog::Create(wxWindow *parent, const wxColourData *data) -{ - m_dialogParent = parent; - - if (data) - m_colourData = *data; - return true; -} - -int wxColourDialog::ShowModal() -{ - WX_HOOK_MODAL_DIALOG(); - - RGBColor currentColor ; - - m_colourData.m_dataColour.GetRGBColor( ¤tColor ); - NColorPickerInfo info; - OSStatus err ; - memset(&info, 0, sizeof(info)) ; - // TODO : use parent to determine better position and then kAtSpecifiedOrigin - info.placeWhere = kCenterOnMainScreen ; - info.flags = kColorPickerDialogIsMoveable | kColorPickerDialogIsModal ; - info.theColor.color.rgb.red = currentColor.red ; - info.theColor.color.rgb.green = currentColor.green ; - info.theColor.color.rgb.blue = currentColor.blue ; - wxDialog::OSXBeginModalDialog(); - err = NPickColor(&info); - wxDialog::OSXEndModalDialog(); - if ((err == noErr) && info.newColorChosen) - { - currentColor.red = info.theColor.color.rgb.red ; - currentColor.green = info.theColor.color.rgb.green ; - currentColor.blue = info.theColor.color.rgb.blue ; - m_colourData.m_dataColour = currentColor; - - return wxID_OK; - } - return wxID_CANCEL; -} - -#endif diff --git a/src/osx/carbon/icon.cpp b/src/osx/carbon/icon.cpp deleted file mode 100644 index f1ad130e40..0000000000 --- a/src/osx/carbon/icon.cpp +++ /dev/null @@ -1,604 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/icon.cpp -// Purpose: wxIcon class -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if wxOSX_USE_COCOA_OR_CARBON - -#include "wx/icon.h" - -#ifndef WX_PRECOMP - #include "wx/image.h" -#endif - -#include "wx/osx/private.h" - -wxIMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject); - -#define M_ICONDATA ((wxIconRefData *)m_refData) - -#define wxOSX_ICON_USE_NSIMAGE wxOSX_BITMAP_NATIVE_ACCESS - -#if wxOSX_ICON_USE_NSIMAGE - -// implementation based on NSImage - -class WXDLLEXPORT wxIconRefData : public wxGDIRefData -{ -public: - wxIconRefData() { Init(); } - wxIconRefData( WX_NSImage image, int desiredWidth, int desiredHeight ); - wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight ); - - virtual ~wxIconRefData() { Free(); } - - virtual bool IsOk() const wxOVERRIDE { return m_nsImage != NULL; } - virtual void Free(); - - int GetWidth() const { return (int) wxOSXGetImageSize(m_nsImage).width; } - int GetHeight() const { return (int) wxOSXGetImageSize(m_nsImage).height; } - - WX_NSImage GetImage() const; - -private: - void Init(); - void Create( NSImage* icon, int desiredWidth, int desiredHeight ); - NSImage* m_nsImage; - - // We can (easily) copy m_iconRef so we don't implement the copy ctor. - wxDECLARE_NO_COPY_CLASS(wxIconRefData); -}; - - -wxIconRefData::wxIconRefData( NSImage* icon, int desiredWidth, int desiredHeight ) -{ - Init(); - - Create(icon, desiredWidth, desiredHeight); -} - -wxIconRefData::wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight ) -{ - Init(); - - Create(wxOSXGetNSImageFromIconRef(iconref), desiredWidth, desiredHeight); - ReleaseIconRef(iconref); -} - -void wxIconRefData::Create( NSImage* icon, int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) ) -{ - if ( icon ) - { - m_nsImage = icon; - wxMacCocoaRetain(icon); - } -} - -void wxIconRefData::Init() -{ - m_nsImage = NULL; -} - -void wxIconRefData::Free() -{ - if ( m_nsImage ) - { - wxMacCocoaRelease(m_nsImage); - } -} - -WX_NSImage wxIconRefData::GetImage() const -{ - wxASSERT( IsOk() ); - - return m_nsImage; -} - -#else // !wxOSX_ICON_USE_NSIMAGE - -// implementation based on IconRef - -class WXDLLEXPORT wxIconRefData : public wxGDIRefData -{ -public: - wxIconRefData() { Init(); } - wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight ); - virtual ~wxIconRefData() { Free(); } - - virtual bool IsOk() const wxOVERRIDE { return m_iconRef != NULL; } - virtual void Free(); - - void SetWidth( int width ) { m_width = width; } - void SetHeight( int height ) { m_height = height; } - - int GetWidth() const { return m_width; } - int GetHeight() const { return m_height; } - - WXHICON GetHICON() const { return (WXHICON) m_iconRef; } - - WX_NSImage GetImage() const; - -private: - void Init(); - - IconRef m_iconRef; - - mutable NSImage* m_nsImage; - - int m_width; - int m_height; - - // We can (easily) copy m_iconRef so we don't implement the copy ctor. - wxDECLARE_NO_COPY_CLASS(wxIconRefData); -}; - -wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight ) -{ - Init(); - m_iconRef = (IconRef)( icon ) ; - - // Standard sizes - SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ; - SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ; -} - -void wxIconRefData::Init() -{ - m_iconRef = NULL ; - m_nsImage = NULL; - - m_width = - m_height = 0; -} - -void wxIconRefData::Free() -{ - if ( m_iconRef ) - { - ReleaseIconRef( m_iconRef ) ; - m_iconRef = NULL ; - } - - if ( m_nsImage ) - { - wxMacCocoaRelease(m_nsImage); - } -} - -WX_NSImage wxIconRefData::GetImage() const -{ - wxASSERT( IsOk() ); - - if ( m_nsImage == 0 ) - { - m_nsImage = wxOSXGetNSImageFromIconRef(m_iconRef); - CFRetain(m_nsImage); - } - - return m_nsImage; -} - -#endif - -// -// -// - -wxIcon::wxIcon() -{ -} - -wxIcon::wxIcon( const char bits[], int width, int height ) -{ - wxBitmap bmp( bits, width, height ) ; - CopyFromBitmap( bmp ) ; -} - -wxIcon::wxIcon(const char* const* bits) -{ - wxBitmap bmp( bits ) ; - CopyFromBitmap( bmp ) ; -} - -wxIcon::wxIcon( - const wxString& icon_file, wxBitmapType flags, - int desiredWidth, int desiredHeight ) -{ - LoadFile( icon_file, flags, desiredWidth, desiredHeight ); -} - -#if wxOSX_USE_ICONREF -wxIcon::wxIcon(WXHICON icon, const wxSize& size) - : wxGDIObject() -{ - // as the icon owns that ref, we have to acquire it as well - if (icon) - AcquireIconRef( (IconRef) icon ) ; - - m_refData = new wxIconRefData( icon, size.x, size.y ) ; -} - -WXHICON wxIcon::GetHICON() const -{ - wxASSERT( IsOk() ) ; - - return (WXHICON) ((wxIconRefData*)m_refData)->GetHICON() ; -} -#endif - -wxIcon::~wxIcon() -{ -} - -wxGDIRefData *wxIcon::CreateGDIRefData() const -{ - return new wxIconRefData; -} - -wxGDIRefData * -wxIcon::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const -{ - wxFAIL_MSG( wxS("Cloning icons is not implemented in wxCarbon.") ); - - return new wxIconRefData; -} - -int wxIcon::GetWidth() const -{ - wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") ); - - return M_ICONDATA->GetWidth(); -} - -int wxIcon::GetHeight() const -{ - wxCHECK_MSG( IsOk(), -1, wxT("invalid icon") ); - - return M_ICONDATA->GetHeight(); -} - -int wxIcon::GetDepth() const -{ - return 32; -} - -WX_NSImage wxIcon::GetImage() const -{ - wxCHECK_MSG( IsOk(), NULL, wxT("invalid icon") ); - - return M_ICONDATA->GetImage() ; -} - -#if WXWIN_COMPATIBILITY_3_0 -void wxIcon::SetDepth( int WXUNUSED(depth) ) -{ -} - -void wxIcon::SetWidth( int WXUNUSED(width) ) -{ -} - -void wxIcon::SetHeight( int WXUNUSED(height) ) -{ -} -#endif - -// Load an icon based on resource name or filel name -// Return true on success, false otherwise -bool wxIcon::LoadFile( - const wxString& filename, wxBitmapType type, - int desiredWidth, int desiredHeight ) -{ - if( type == wxBITMAP_TYPE_ICON_RESOURCE ) - { - if( LoadIconFromSystemResource( filename, desiredWidth, desiredHeight ) ) - return true; - else - return LoadIconFromBundleResource( filename, desiredWidth, desiredHeight ); - } - else if( type == wxBITMAP_TYPE_ICON ) - { - return LoadIconFromFile( filename, desiredWidth, desiredHeight ); - } - else - { - return LoadIconAsBitmap( filename, type, desiredWidth, desiredHeight ); - } -} - -// Load a well known system icon by its wxWidgets identifier -// Returns true on success, false otherwise -bool wxIcon::LoadIconFromSystemResource(const wxString& resourceName, int desiredWidth, int desiredHeight) -{ - UnRef(); - - OSType theId = 0 ; - - if ( resourceName == wxT("wxICON_INFORMATION") ) - { - theId = kAlertNoteIcon ; - } - else if ( resourceName == wxT("wxICON_QUESTION") ) - { - theId = kAlertCautionIcon ; - } - else if ( resourceName == wxT("wxICON_WARNING") ) - { - theId = kAlertCautionIcon ; - } - else if ( resourceName == wxT("wxICON_ERROR") ) - { - theId = kAlertStopIcon ; - } - else if ( resourceName == wxT("wxICON_FOLDER") ) - { - theId = kGenericFolderIcon ; - } - else if ( resourceName == wxT("wxICON_FOLDER_OPEN") ) - { - theId = kOpenFolderIcon ; - } - else if ( resourceName == wxT("wxICON_NORMAL_FILE") ) - { - theId = kGenericDocumentIcon ; - } - else if ( resourceName == wxT("wxICON_EXECUTABLE_FILE") ) - { - theId = kGenericApplicationIcon ; - } - else if ( resourceName == wxT("wxICON_CDROM") ) - { - theId = kGenericCDROMIcon ; - } - else if ( resourceName == wxT("wxICON_FLOPPY") ) - { - theId = kGenericFloppyIcon ; - } - else if ( resourceName == wxT("wxICON_HARDDISK") ) - { - theId = kGenericHardDiskIcon ; - } - else if ( resourceName == wxT("wxICON_REMOVABLE") ) - { - theId = kGenericRemovableMediaIcon ; - } - else if ( resourceName == wxT("wxICON_DELETE") ) - { - theId = kToolbarDeleteIcon ; - } - else if ( resourceName == wxT("wxICON_GO_BACK") ) - { - theId = kBackwardArrowIcon ; - } - else if ( resourceName == wxT("wxICON_GO_FORWARD") ) - { - theId = kForwardArrowIcon ; - } - else if ( resourceName == wxT("wxICON_GO_HOME") ) - { - theId = kToolbarHomeIcon ; - } - else if ( resourceName == wxT("wxICON_HELP_SETTINGS") ) - { - theId = kGenericFontIcon ; - } - else if ( resourceName == wxT("wxICON_HELP_PAGE") ) - { - theId = kGenericDocumentIcon ; - } - else if ( resourceName == wxT( "wxICON_PRINT" ) ) - { - theId = kPrintMonitorFolderIcon; - } - else if ( resourceName == wxT( "wxICON_HELP_FOLDER" ) ) - { - theId = kHelpFolderIcon; - } - - if ( theId != 0 ) - { - IconRef iconRef = NULL ; - __Verify_noErr(GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef )) ; - if ( iconRef ) - m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ; - } - - return IsOk(); -} - -// Load an icon of type 'icns' by resource by name -// The resource must exist in one of the currently accessible bundles -// (usually this means the application bundle for the current application) -// Return true on success, false otherwise -bool wxIcon::LoadIconFromBundleResource(const wxString& resourceName, int desiredWidth, int desiredHeight) -{ - UnRef(); - -#if wxOSX_USE_ICONREF - IconRef iconRef = NULL ; - - // first look in the resource fork - if ( iconRef == NULL ) - { - Str255 theName ; - - wxMacStringToPascal( resourceName , theName ) ; - Handle resHandle = GetNamedResource( 'icns' , theName ) ; - if ( resHandle != 0L ) - { - IconFamilyHandle iconFamily = (IconFamilyHandle) resHandle ; - OSStatus err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef ); - - if ( err != noErr ) - { - wxFAIL_MSG("Error when constructing icon ref"); - } - - ReleaseResource( resHandle ) ; - } - } - if ( iconRef == NULL ) - { - wxCFStringRef name(resourceName); - FSRef iconFSRef; - - wxCFRef iconURL(CFBundleCopyResourceURL(CFBundleGetMainBundle(), name, CFSTR("icns"), NULL)); - - if (CFURLGetFSRef(iconURL, &iconFSRef)) - { - // Get a handle on the icon family - IconFamilyHandle iconFamily; - OSStatus err = ReadIconFromFSRef( &iconFSRef, &iconFamily ); - - if ( err == noErr ) - { - err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef ); - } - ReleaseResource( (Handle) iconFamily ); - } - } - - if ( iconRef ) - { - m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ); - return true; - } -#endif - return false; -} - -// Load an icon from an icon file using the underlying OS X API -// The icon file must be in a format understood by the OS -// Return true for success, false otherwise -bool wxIcon::LoadIconFromFile(const wxString& filename, int desiredWidth, int desiredHeight) -{ - UnRef(); - - bool result = false; - -#if wxOSX_USE_ICONREF - OSStatus err; - // Get a file system reference - FSRef fsRef; - err = FSPathMakeRef( (const wxUint8*)filename.utf8_str().data(), &fsRef, NULL ); - - if( err != noErr ) - return false; - - // Get a handle on the icon family - IconFamilyHandle iconFamily; - err = ReadIconFromFSRef( &fsRef, &iconFamily ); - - if( err != noErr ) - return false; - - // Get the icon reference itself - IconRef iconRef; - err = GetIconRefFromIconFamilyPtr( *iconFamily, GetHandleSize((Handle) iconFamily), &iconRef ); - - if( err == noErr ) - { - // If everything is OK, assign m_refData - m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ); - result = true; - } - - // Release the iconFamily before returning - ReleaseResource( (Handle) iconFamily ); -#endif - return result; -} - -// Load an icon from a file using functionality from wxWidgets -// A suitable bitmap handler (or image handler) must be available -// Return true on success, false otherwise -bool wxIcon::LoadIconAsBitmap(const wxString& filename, wxBitmapType type, int desiredWidth, int desiredHeight) -{ - UnRef(); - - wxBitmapHandler *handler = wxBitmap::FindHandler( type ); - - if ( handler ) - { - wxBitmap bmp ; - if ( handler->LoadFile( &bmp , filename, type, desiredWidth, desiredHeight )) - { - CopyFromBitmap( bmp ) ; - return true ; - } - } - -#if wxUSE_IMAGE - else - { - wxImage loadimage( filename, type ); - if (loadimage.IsOk()) - { - if ( desiredWidth == -1 ) - desiredWidth = loadimage.GetWidth() ; - if ( desiredHeight == -1 ) - desiredHeight = loadimage.GetHeight() ; - if ( desiredWidth != loadimage.GetWidth() || desiredHeight != loadimage.GetHeight() ) - loadimage.Rescale( desiredWidth , desiredHeight ) ; - - wxBitmap bmp( loadimage ); - CopyFromBitmap( bmp ) ; - - return true; - } - } -#endif - - return false; -} - - -void wxIcon::CopyFromBitmap( const wxBitmap& bmp ) -{ - UnRef() ; - -#if wxOSX_ICON_USE_NSIMAGE - m_refData = new wxIconRefData( bmp.GetImage() , bmp.GetWidth(), bmp.GetHeight() ) ; -#else - // as the bitmap owns that ref, we have to acquire it as well - - int w = bmp.GetWidth() ; - int h = bmp.GetHeight() ; - int sz = wxMax( w , h ) ; - - if ( sz == 24 || sz == 64 ) - { - wxBitmap scaleBmp( bmp.ConvertToImage().Scale( w * 2 , h * 2 ) ) ; - m_refData = new wxIconRefData( (WXHICON) scaleBmp.CreateIconRef(), bmp.GetWidth(), bmp.GetHeight() ) ; - } - else - { - m_refData = new wxIconRefData( (WXHICON) bmp.CreateIconRef() , bmp.GetWidth(), bmp.GetHeight() ) ; - } -#endif -} - -wxIMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler); - -bool wxICONResourceHandler::LoadFile( - wxBitmap *bitmap, const wxString& name, wxBitmapType WXUNUSED(flags), - int desiredWidth, int desiredHeight ) -{ - wxIcon icon ; - if ( icon.LoadFile( name , wxBITMAP_TYPE_ICON_RESOURCE , desiredWidth , desiredHeight ) ) - { - bitmap->CopyFromIcon( icon ) ; - return bitmap->IsOk() ; - } - return false; -} - -#endif - diff --git a/src/osx/carbon/main.cpp b/src/osx/carbon/main.cpp deleted file mode 100644 index 9615657900..0000000000 --- a/src/osx/carbon/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/main.cpp -// Purpose: Entry point -// Author: Stefan Csomor -// Modified by: -// Created: 1998-01-01 -// Copyright: (c) Stefan Csomor -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// We don't put main() in the library any more. GD. diff --git a/src/osx/carbon/overlay.cpp b/src/osx/carbon/overlay.cpp deleted file mode 100644 index 9273fa81dc..0000000000 --- a/src/osx/carbon/overlay.cpp +++ /dev/null @@ -1,182 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/overlay.cpp -// Purpose: common wxOverlay code -// Author: Stefan Csomor -// Modified by: -// Created: 2006-10-20 -// Copyright: (c) wxWidgets team -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#include "wx/overlay.h" - -#ifndef WX_PRECOMP - #include "wx/dcclient.h" -#endif - -#include "wx/private/overlay.h" - -#ifdef wxHAS_NATIVE_OVERLAY - -// ============================================================================ -// implementation -// ============================================================================ - -wxOverlayImpl::wxOverlayImpl() -{ - m_window = NULL ; - m_overlayContext = NULL ; - m_overlayWindow = NULL ; -} - -wxOverlayImpl::~wxOverlayImpl() -{ - Reset(); -} - -bool wxOverlayImpl::IsOk() -{ - return m_overlayWindow != NULL ; -} - -void wxOverlayImpl::MacGetBounds( Rect *bounds ) -{ - int x, y; - x=y=0; - m_window->MacWindowToRootWindow( &x , &y ) ; - wxNonOwnedWindow* tlw = m_window->MacGetTopLevelWindow(); - tlw->GetNonOwnedPeer()->WindowToScreen( &x, &y ); - - bounds->top = y+m_y; - bounds->left = x+m_x; - bounds->bottom = y+m_y+m_height; - bounds->right = x+m_x+m_width; -} - -OSStatus wxOverlayImpl::CreateOverlayWindow() -{ - OSStatus err; - - WindowAttributes overlayAttributes = kWindowIgnoreClicksAttribute; - - if ( m_window ) - { - m_overlayParentWindow =(WindowRef) m_window->MacGetTopLevelWindowRef(); - - Rect bounds ; - MacGetBounds(&bounds); - err = CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, &m_overlayWindow ); - if ( err == noErr ) - { - SetWindowGroup( m_overlayWindow, GetWindowGroup(m_overlayParentWindow)); // Put them in the same group so that their window layers are consistent - } - } - else - { - m_overlayParentWindow = NULL ; - CGRect cgbounds ; - cgbounds = CGDisplayBounds(CGMainDisplayID()); - Rect bounds; - bounds.top = (short)cgbounds.origin.y; - bounds.left = (short)cgbounds.origin.x; - bounds.bottom = (short)(bounds.top + cgbounds.size.height); - bounds.right = (short)(bounds.left + cgbounds.size.width); - err = CreateNewWindow( kOverlayWindowClass, overlayAttributes, &bounds, &m_overlayWindow ); - } - ShowWindow(m_overlayWindow); - return err; -} - -void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height ) -{ - wxASSERT_MSG( !IsOk() , _("You cannot Init an overlay twice") ); - - m_window = dc->GetWindow(); - m_x = x ; - m_y = y ; - if ( dc->IsKindOf( CLASSINFO( wxClientDC ) )) - { - wxPoint origin = m_window->GetClientAreaOrigin(); - m_x += origin.x; - m_y += origin.y; - } - m_width = width ; - m_height = height ; - - OSStatus err = CreateOverlayWindow(); - wxASSERT_MSG( err == noErr , _("Couldn't create the overlay window") ); -#ifndef __LP64__ - err = QDBeginCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext); -#endif - CGContextTranslateCTM( m_overlayContext, 0, m_height ); - CGContextScaleCTM( m_overlayContext, 1, -1 ); - CGContextTranslateCTM( m_overlayContext, -m_x , -m_y ); - wxASSERT_MSG( err == noErr , _("Couldn't init the context on the overlay window") ); -} - -void wxOverlayImpl::BeginDrawing( wxDC* dc) -{ - wxDCImpl *impl = dc->GetImpl(); - wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl); - if (win_impl) - { - win_impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) ); - dc->SetClippingRegion( m_x , m_y , m_width , m_height ) ; - } -} - -void wxOverlayImpl::EndDrawing( wxDC* dc) -{ - wxDCImpl *impl = dc->GetImpl(); - wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl); - if (win_impl) - win_impl->SetGraphicsContext(NULL); - - CGContextFlush( m_overlayContext ); -} - -void wxOverlayImpl::Clear(wxDC* WXUNUSED(dc)) -{ - wxASSERT_MSG( IsOk() , _("You cannot Clear an overlay that is not inited") ); - CGRect box = CGRectMake( m_x - 1, m_y - 1 , m_width + 2 , m_height + 2 ); - CGContextClearRect( m_overlayContext, box ); -} - -void wxOverlayImpl::Reset() -{ - if ( m_overlayContext ) - { -#ifndef __LP64__ - OSStatus err = QDEndCGContext(GetWindowPort(m_overlayWindow), &m_overlayContext); - if ( err != noErr ) - { - wxFAIL_MSG("Couldn't end the context on the overlay window"); - } -#endif - m_overlayContext = NULL ; - } - - // todo : don't dispose, only hide and reposition on next run - if (m_overlayWindow) - { - DisposeWindow(m_overlayWindow); - m_overlayWindow = NULL ; - } -} - -#endif // wxHAS_NATIVE_OVERLAY diff --git a/src/osx/carbon/thread.cpp b/src/osx/carbon/thread.cpp deleted file mode 100644 index d2ea457e14..0000000000 --- a/src/osx/carbon/thread.cpp +++ /dev/null @@ -1,1347 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/thread.cpp -// Purpose: wxThread Implementation -// Author: Original from Wolfram Gloger/Guilhem Lavaux/Vadim Zeitlin -// Modified by: Aj Lavin, Stefan Csomor -// Created: 04/22/98 -// Copyright: (c) Wolfram Gloger (1996, 1997); Guilhem Lavaux (1998), -// Vadim Zeitlin (1999), Stefan Csomor (2000) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/wx.h" - #include "wx/module.h" -#endif - -#if wxUSE_THREADS - -#include "wx/thread.h" - -#if wxOSX_USE_COCOA_OR_CARBON -#include -#else -#include -#endif - -#include "wx/osx/uma.h" - -// the possible states of the thread: -// ("=>" shows all possible transitions from this state) -enum wxThreadState -{ - STATE_NEW, // didn't start execution yet (=> RUNNING) - STATE_RUNNING, // thread is running (=> PAUSED, CANCELED) - STATE_PAUSED, // thread is temporarily suspended (=> RUNNING) - STATE_CANCELED, // thread should terminate a.s.a.p. (=> EXITED) - STATE_EXITED // thread is terminating -}; - -// ---------------------------------------------------------------------------- -// globals -// ---------------------------------------------------------------------------- - -// the task ID of the main thread -wxThreadIdType wxThread::ms_idMainThread = kInvalidID; - -// this is the Per-Task Storage for the pointer to the appropriate wxThread -TaskStorageIndex gs_tlsForWXThread = 0; - -// if it's false, some secondary thread is holding the GUI lock -static bool gs_bGuiOwnedByMainThread = true; - -// critical section which controls access to all GUI functions: any secondary -// thread (i.e. except the main one) must enter this crit section before doing -// any GUI calls -static wxCriticalSection *gs_critsectGui = NULL; - -// critical section which protects gs_nWaitingForGui variable -static wxCriticalSection *gs_critsectWaitingForGui = NULL; - -// number of threads waiting for GUI in wxMutexGuiEnter() -static size_t gs_nWaitingForGui = 0; - -// overall number of threads, needed for determining -// the sleep value of the main event loop -size_t g_numberOfThreads = 0; - - -#if wxUSE_GUI -MPCriticalRegionID gs_guiCritical = kInvalidID; -#endif - -// ============================================================================ -// MacOS implementation of thread classes -// ============================================================================ - -/* - Notes : - - The implementation is very close to the phtreads implementation, the reason for - using MPServices is the fact that these are also available under OS 9. Thus allowing - for one common API for all current builds. - - As soon as wxThreads are on a 64 bit address space, the TLS must be extended - to use two indices one for each 32 bit part as the MP implementation is limited - to longs. - - I have three implementations for mutexes : - version A based on a binary semaphore, problem - not reentrant, version B based - on a critical region, allows for reentrancy, performance implications not - yet tested, and third a plain pthreads implementation - - The same for condition internal, one implementation by Aj Lavin and the other one - copied from the thrimpl.cpp which I assume has been more broadly tested, I've just - replaced the interlock increment with the appropriate PPC calls -*/ - -// ---------------------------------------------------------------------------- -// wxCriticalSection -// ---------------------------------------------------------------------------- - -wxCriticalSection::wxCriticalSection( wxCriticalSectionType WXUNUSED(critSecType) ) -{ - MPCreateCriticalRegion( (MPCriticalRegionID*) &m_critRegion ); -} - -wxCriticalSection::~wxCriticalSection() -{ - MPDeleteCriticalRegion( (MPCriticalRegionID) m_critRegion ); -} - -void wxCriticalSection::Enter() -{ - MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationForever ); -} - -bool wxCriticalSection::TryEnter() -{ - return MPEnterCriticalRegion( (MPCriticalRegionID) m_critRegion, kDurationImmediate ) == noErr; -} - -void wxCriticalSection::Leave() -{ - MPExitCriticalRegion( (MPCriticalRegionID) m_critRegion ); -} - -// ---------------------------------------------------------------------------- -// wxMutex implementation -// ---------------------------------------------------------------------------- - -#define wxUSE_MAC_SEMAPHORE_MUTEX 0 -#define wxUSE_MAC_CRITICAL_REGION_MUTEX 1 -#define wxUSE_MAC_PTHREADS_MUTEX 0 - -#if wxUSE_MAC_CRITICAL_REGION_MUTEX - -class wxMutexInternal -{ -public: - wxMutexInternal( wxMutexType mutexType ); - virtual ~wxMutexInternal(); - - bool IsOk() const { return m_isOk; } - - wxMutexError Lock() { return Lock(kDurationForever); } - wxMutexError Lock(unsigned long ms); - wxMutexError TryLock(); - wxMutexError Unlock(); - -private: - MPCriticalRegionID m_critRegion; - bool m_isOk ; -}; - -wxMutexInternal::wxMutexInternal( wxMutexType WXUNUSED(mutexType) ) -{ - m_isOk = false; - m_critRegion = kInvalidID; - - __Verify_noErr(MPCreateCriticalRegion( &m_critRegion )); - m_isOk = ( m_critRegion != kInvalidID ); - if ( !IsOk() ) - { - wxFAIL_MSG( wxT("Error when creating mutex") ); - } -} - -wxMutexInternal::~wxMutexInternal() -{ - if ( m_critRegion != kInvalidID ) - MPDeleteCriticalRegion( m_critRegion ); - - MPYield(); -} - -wxMutexError wxMutexInternal::Lock(unsigned long ms) -{ - wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ); - - OSStatus err = MPEnterCriticalRegion( m_critRegion, ms ); - switch ( err ) - { - case noErr: - break; - - case kMPTimeoutErr: - wxASSERT_MSG( ms != kDurationForever, wxT("unexpected timeout") ); - return wxMUTEX_TIMEOUT; - - default: - wxLogSysError(wxT("Could not lock mutex")); - return wxMUTEX_MISC_ERROR; - } - - return wxMUTEX_NO_ERROR; -} - -wxMutexError wxMutexInternal::TryLock() -{ - wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ; - - OSStatus err = MPEnterCriticalRegion( m_critRegion, kDurationImmediate); - if (err != noErr) - { - if ( err == kMPTimeoutErr) - return wxMUTEX_BUSY; - - wxLogSysError( wxT("Could not try lock mutex") ); - return wxMUTEX_MISC_ERROR; - } - - return wxMUTEX_NO_ERROR; -} - -wxMutexError wxMutexInternal::Unlock() -{ - wxCHECK_MSG( m_isOk , wxMUTEX_MISC_ERROR , wxT("Invalid Mutex") ) ; - - OSStatus err = MPExitCriticalRegion( m_critRegion ); - MPYield() ; - - if (err != noErr) - { - wxLogSysError( wxT("Could not unlock mutex") ); - - return wxMUTEX_MISC_ERROR; - } - - return wxMUTEX_NO_ERROR; -} - -#endif - -// -------------------------------------------------------------------------- -// wxSemaphore -// -------------------------------------------------------------------------- - -class wxSemaphoreInternal -{ -public: - wxSemaphoreInternal( int initialcount, int maxcount ); - virtual ~wxSemaphoreInternal(); - - bool IsOk() const - { return m_isOk; } - - wxSemaError Post(); - wxSemaError WaitTimeout( unsigned long milliseconds ); - - wxSemaError Wait() - { return WaitTimeout( kDurationForever); } - - wxSemaError TryWait() - { - wxSemaError err = WaitTimeout( kDurationImmediate ); - if (err == wxSEMA_TIMEOUT) - err = wxSEMA_BUSY; - - return err; - } - -private: - MPSemaphoreID m_semaphore; - bool m_isOk; -}; - -wxSemaphoreInternal::wxSemaphoreInternal( int initialcount, int maxcount) -{ - m_isOk = false; - m_semaphore = kInvalidID; - if ( maxcount == 0 ) - // make it practically infinite - maxcount = INT_MAX; - - __Verify_noErr(MPCreateSemaphore( maxcount, initialcount, &m_semaphore )); - m_isOk = ( m_semaphore != kInvalidID ); - - if ( !IsOk() ) - { - wxFAIL_MSG( wxT("Error when creating semaphore") ); - } -} - -wxSemaphoreInternal::~wxSemaphoreInternal() -{ - if (m_semaphore != kInvalidID) - MPDeleteSemaphore( m_semaphore ); - - MPYield(); -} - -wxSemaError wxSemaphoreInternal::WaitTimeout( unsigned long milliseconds ) -{ - OSStatus err = MPWaitOnSemaphore( m_semaphore, milliseconds ); - if (err != noErr) - { - if (err == kMPTimeoutErr) - return wxSEMA_TIMEOUT; - - return wxSEMA_MISC_ERROR; - } - - return wxSEMA_NO_ERROR; -} - -wxSemaError wxSemaphoreInternal::Post() -{ - OSStatus err = MPSignalSemaphore( m_semaphore ); - MPYield(); - if (err != noErr) - return wxSEMA_MISC_ERROR; - - return wxSEMA_NO_ERROR; -} - -// ---------------------------------------------------------------------------- -// wxCondition implementation -// ---------------------------------------------------------------------------- - -class wxConditionInternal -{ -public: - wxConditionInternal( wxMutex& mutex ); - - bool IsOk() const - { return m_mutex.IsOk() && m_semaphore.IsOk(); } - - wxCondError Wait(); - wxCondError WaitTimeout( unsigned long milliseconds ); - - wxCondError Signal(); - wxCondError Broadcast(); - -private: - // the number of threads currently waiting for this condition - SInt32 m_numWaiters; - - // the critical section protecting m_numWaiters - wxCriticalSection m_csWaiters; - - wxMutex& m_mutex; - wxSemaphore m_semaphore; - - wxDECLARE_NO_COPY_CLASS(wxConditionInternal); -}; - -wxConditionInternal::wxConditionInternal( wxMutex& mutex ) - : m_mutex(mutex) -{ - // another thread can't access it until we return from ctor, so no need to - // protect access to m_numWaiters here - m_numWaiters = 0; -} - -wxCondError wxConditionInternal::Wait() -{ - // increment the number of waiters - IncrementAtomic( &m_numWaiters ); - - m_mutex.Unlock(); - - // a potential race condition can occur here - // - // after a thread increments nwaiters, and unlocks the mutex and before the - // semaphore.Wait() is called, if another thread can cause a signal to be - // generated - // - // this race condition is handled by using a semaphore and incrementing the - // semaphore only if 'nwaiters' is greater that zero since the semaphore, - // can 'remember' signals the race condition will not occur - - // wait ( if necessary ) and decrement semaphore - wxSemaError err = m_semaphore.Wait(); - m_mutex.Lock(); - - return err == wxSEMA_NO_ERROR ? wxCOND_NO_ERROR : wxCOND_MISC_ERROR; -} - -wxCondError wxConditionInternal::WaitTimeout( unsigned long milliseconds ) -{ - IncrementAtomic( &m_numWaiters ); - - m_mutex.Unlock(); - - // a race condition can occur at this point in the code - // - // please see the comments in Wait(), for details - - wxSemaError err = m_semaphore.WaitTimeout(milliseconds); - - if ( err == wxSEMA_TIMEOUT ) - { - // another potential race condition exists here it is caused when a - // 'waiting' thread timesout, and returns from WaitForSingleObject, but - // has not yet decremented 'nwaiters'. - // - // at this point if another thread calls signal() then the semaphore - // will be incremented, but the waiting thread will miss it. - // - // to handle this particular case, the waiting thread calls - // WaitForSingleObject again with a timeout of 0, after locking - // 'nwaiters_mutex'. this call does not block because of the zero - // timeout, but will allow the waiting thread to catch the missed - // signals. - wxCriticalSectionLocker lock(m_csWaiters); - - err = m_semaphore.WaitTimeout(0); - - if ( err != wxSEMA_NO_ERROR ) - { - m_numWaiters--; - } - } - - m_mutex.Lock(); - - return err == wxSEMA_NO_ERROR ? wxCOND_NO_ERROR : wxCOND_MISC_ERROR; -} - -wxCondError wxConditionInternal::Signal() -{ - wxCriticalSectionLocker lock(m_csWaiters); - - if ( m_numWaiters > 0 ) - { - // increment the semaphore by 1 - if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) - return wxCOND_MISC_ERROR; - - m_numWaiters--; - } - - return wxCOND_NO_ERROR; -} - -wxCondError wxConditionInternal::Broadcast() -{ - wxCriticalSectionLocker lock(m_csWaiters); - - while ( m_numWaiters > 0 ) - { - if ( m_semaphore.Post() != wxSEMA_NO_ERROR ) - return wxCOND_MISC_ERROR; - - m_numWaiters--; - } - - return wxCOND_NO_ERROR; -} - -// ---------------------------------------------------------------------------- -// wxCriticalSection implementation -// ---------------------------------------------------------------------------- - -// XXX currently implemented as mutex in headers. Change to critical section. - -// ---------------------------------------------------------------------------- -// wxThread implementation -// ---------------------------------------------------------------------------- - -// wxThreadInternal class -// ---------------------- - -class wxThreadInternal -{ -public: - wxThreadInternal() - { - m_tid = kInvalidID; - m_state = STATE_NEW; - m_prio = wxPRIORITY_DEFAULT; - m_notifyQueueId = kInvalidID; - m_exitcode = 0; - m_cancelled = false ; - - // set to true only when the thread starts waiting on m_semSuspend - m_isPaused = false; - - // defaults for joinable threads - m_shouldBeJoined = true; - m_isDetached = false; - } - - virtual ~wxThreadInternal() - { - if ( m_notifyQueueId) - { - MPDeleteQueue( m_notifyQueueId ); - m_notifyQueueId = kInvalidID ; - } - } - - // thread function - static OSStatus MacThreadStart(void* arg); - - // create a new (suspended) thread (for the given thread object) - bool Create(wxThread *thread, unsigned int stackSize); - - // thread actions - - // start the thread - wxThreadError Run(); - - // unblock the thread allowing it to run - void SignalRun() { m_semRun.Post(); } - - // ask the thread to terminate - void Wait(); - - // go to sleep until Resume() is called - void Pause(); - - // resume the thread - void Resume(); - - // accessors - // priority - int GetPriority() const - { return m_prio; } - void SetPriority(int prio); - - // state - wxThreadState GetState() const - { return m_state; } - void SetState(wxThreadState state) - { m_state = state; } - - // Get the ID of this thread's underlying MP Services task. - MPTaskID GetId() const - { return m_tid; } - - void SetCancelFlag() - { m_cancelled = true; } - - bool WasCancelled() const - { return m_cancelled; } - - // exit code - void SetExitCode(wxThread::ExitCode exitcode) - { m_exitcode = exitcode; } - wxThread::ExitCode GetExitCode() const - { return m_exitcode; } - - // the pause flag - void SetReallyPaused(bool paused) - { m_isPaused = paused; } - bool IsReallyPaused() const - { return m_isPaused; } - - // tell the thread that it is a detached one - void Detach() - { - wxCriticalSectionLocker lock(m_csJoinFlag); - - m_shouldBeJoined = false; - m_isDetached = true; - } - -private: - // the thread we're associated with - wxThread * m_thread; - - MPTaskID m_tid; // thread id - MPQueueID m_notifyQueueId; // its notification queue - - wxThreadState m_state; // see wxThreadState enum - int m_prio; // in wxWidgets units: from 0 to 100 - - // this flag is set when the thread should terminate - bool m_cancelled; - - // this flag is set when the thread is blocking on m_semSuspend - bool m_isPaused; - - // the thread exit code - only used for joinable (!detached) threads and - // is only valid after the thread termination - wxThread::ExitCode m_exitcode; - - // many threads may call Wait(), but only one of them should call - // pthread_join(), so we have to keep track of this - wxCriticalSection m_csJoinFlag; - bool m_shouldBeJoined; - bool m_isDetached; - - // this semaphore is posted by Run() and the threads Entry() is not - // called before it is done - wxSemaphore m_semRun; - - // this one is signaled when the thread should resume after having been - // Pause()d - wxSemaphore m_semSuspend; -}; - -OSStatus wxThreadInternal::MacThreadStart(void *parameter) -{ - wxThread* thread = (wxThread*) parameter ; - wxThreadInternal *pthread = thread->m_internal; - - // add to TLS so that This() will work - __Verify_noErr(MPSetTaskStorageValue( gs_tlsForWXThread , (TaskStorageValue) thread )) ; - - // have to declare this before pthread_cleanup_push() which defines a - // block! - bool dontRunAtAll; - - // wait for the semaphore to be posted from Run() - pthread->m_semRun.Wait(); - - // test whether we should run the run at all - may be it was deleted - // before it started to Run()? - { - wxCriticalSectionLocker lock(thread->m_critsect); - - dontRunAtAll = pthread->GetState() == STATE_NEW && - pthread->WasCancelled(); - } - - if ( !dontRunAtAll ) - { - pthread->m_exitcode = thread->CallEntry(); - - { - wxCriticalSectionLocker lock(thread->m_critsect); - pthread->SetState( STATE_EXITED ); - } - } - - if ( dontRunAtAll ) - { - if ( pthread->m_isDetached ) - delete thread; - - return -1; - } - else - { - // on Mac for the running code, - // the correct thread termination is to return - - // terminate the thread - thread->Exit( pthread->m_exitcode ); - - return (OSStatus) NULL; // pthread->m_exitcode; - } -} - -bool wxThreadInternal::Create( wxThread *thread, unsigned int stackSize ) -{ - wxASSERT_MSG( m_state == STATE_NEW && !m_tid, - wxT("Create()ing thread twice?") ); - - if ( thread->IsDetached() ) - Detach(); - - OSStatus err = noErr; - m_thread = thread; - - if ( m_notifyQueueId == kInvalidID ) - { - OSStatus err = MPCreateQueue( &m_notifyQueueId ); - if (err != noErr) - { - wxLogSysError( wxT("Can't create the thread event queue") ); - - return false; - } - } - - m_state = STATE_NEW; - - err = MPCreateTask( - MacThreadStart, (void*)m_thread, stackSize, - m_notifyQueueId, &m_exitcode, 0, 0, &m_tid ); - - if (err != noErr) - { - wxLogSysError( wxT("Can't create thread") ); - - return false; - } - - if ( m_prio != wxPRIORITY_DEFAULT ) - SetPriority( m_prio ); - - return true; -} - -void wxThreadInternal::SetPriority( int priority ) -{ - m_prio = priority; - - if (m_tid) - { - // Mac priorities range from 1 to 10,000, with a default of 100. - // wxWidgets priorities range from 0 to 100 with a default of 50. - // We can map wxWidgets to Mac priorities easily by assuming - // the former uses a logarithmic scale. - const unsigned int macPriority = (int)( exp( priority / 25.0 * log( 10.0)) + 0.5); - - MPSetTaskWeight( m_tid, macPriority ); - } -} - -wxThreadError wxThreadInternal::Run() -{ - wxCHECK_MSG( GetState() == STATE_NEW, wxTHREAD_RUNNING, - wxT("thread may only be started once after Create()") ); - - SetState( STATE_RUNNING ); - - // wake up threads waiting for our start - SignalRun(); - - return wxTHREAD_NO_ERROR; -} - -void wxThreadInternal::Wait() -{ - wxCHECK_RET( !m_isDetached, wxT("can't wait for a detached thread") ); - - // if the thread we're waiting for is waiting for the GUI mutex, we will - // deadlock so make sure we release it temporarily - if ( wxThread::IsMain() ) - { - // give the thread we're waiting for chance to do the GUI call - // it might be in, we don't do this conditionally as the to be waited on - // thread might have to acquire the mutex later but before terminating - if ( wxGuiOwnedByMainThread() ) - wxMutexGuiLeave(); - } - - { - wxCriticalSectionLocker lock(m_csJoinFlag); - - if ( m_shouldBeJoined ) - { - void *param1, *param2, *rc; - - OSStatus err = MPWaitOnQueue( - m_notifyQueueId, - ¶m1, - ¶m2, - &rc, - kDurationForever ); - if (err != noErr) - { - wxLogSysError( wxT( "Cannot wait for thread termination.")); - rc = (void*) -1; - } - - // actually param1 would be the address of m_exitcode - // but we don't need this here - m_exitcode = rc; - - m_shouldBeJoined = false; - } - } -} - -void wxThreadInternal::Pause() -{ - // the state is set from the thread which pauses us first, this function - // is called later so the state should have been already set - wxCHECK_RET( m_state == STATE_PAUSED, - wxT("thread must first be paused with wxThread::Pause().") ); - - // wait until the semaphore is Post()ed from Resume() - m_semSuspend.Wait(); -} - -void wxThreadInternal::Resume() -{ - wxCHECK_RET( m_state == STATE_PAUSED, - wxT("can't resume thread which is not suspended.") ); - - // the thread might be not actually paused yet - if there were no call to - // TestDestroy() since the last call to Pause() for example - if ( IsReallyPaused() ) - { - // wake up Pause() - m_semSuspend.Post(); - - // reset the flag - SetReallyPaused( false ); - } - - SetState( STATE_RUNNING ); -} - -// static functions -// ---------------- - -wxThread *wxThread::This() -{ - wxThread* thr = (wxThread*) MPGetTaskStorageValue( gs_tlsForWXThread ) ; - - return thr; -} - -#ifdef Yield -#undef Yield -#endif - -void wxThread::Yield() -{ - CFRunLoopRunInMode( kCFRunLoopDefaultMode , 0 , true ) ; - - MPYield(); -} - -void wxThread::Sleep( unsigned long milliseconds ) -{ - AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime() ); - MPDelayUntil( &wakeup ); -} - -int wxThread::GetCPUCount() -{ - return MPProcessors(); -} - -unsigned long wxThread::GetCurrentId() -{ - return (unsigned long)MPCurrentTaskID(); -} - -bool wxThread::SetConcurrency( size_t WXUNUSED(level) ) -{ - // Cannot be set in MacOS. - return false; -} - -wxThread::wxThread( wxThreadKind kind ) -{ - g_numberOfThreads++; - m_internal = new wxThreadInternal(); - - m_isDetached = (kind == wxTHREAD_DETACHED); -} - -wxThread::~wxThread() -{ - wxASSERT_MSG( g_numberOfThreads>0 , wxT("More threads deleted than created.") ) ; - - g_numberOfThreads--; - - m_critsect.Enter(); - - // check that the thread either exited or couldn't be created - if ( m_internal->GetState() != STATE_EXITED && - m_internal->GetState() != STATE_NEW ) - { - wxLogDebug( - wxT("The thread %ld is being destroyed although it is still running! The application may crash."), - GetId() ); - } - - m_critsect.Leave(); - - wxDELETE( m_internal ) ; -} - -wxThreadError wxThread::Create( unsigned int stackSize ) -{ - wxCriticalSectionLocker lock(m_critsect); - - if ( !m_internal->Create(this, stackSize) ) - { - m_internal->SetState( STATE_EXITED ); - return wxTHREAD_NO_RESOURCE; - } - - return wxTHREAD_NO_ERROR; -} - -wxThreadError wxThread::Run() -{ - wxCriticalSectionLocker lock(m_critsect); - - // Create the thread if it wasn't created yet with an explicit - // Create() call: - if ( m_internal->GetId() == kInvalidID ) - { - if ( !m_internal->Create(this, stackSize) ) - { - m_internal->SetState( STATE_EXITED ); - return wxTHREAD_NO_RESOURCE; - } - } - - wxCHECK_MSG( m_internal->GetId(), wxTHREAD_MISC_ERROR, - wxT("must call wxThread::Create() first") ); - - return m_internal->Run(); -} - -// ----------------------------------------------------------------------------- -// pause/resume -// ----------------------------------------------------------------------------- - -wxThreadError wxThread::Pause() -{ - wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR, - wxT("a thread can't pause itself") ); - - wxCriticalSectionLocker lock(m_critsect); - - if ( m_internal->GetState() != STATE_RUNNING ) - { - wxLogDebug( wxT("Can't pause thread which is not running.") ); - - return wxTHREAD_NOT_RUNNING; - } - - // just set a flag, the thread will be really paused only during the next - // call to TestDestroy() - m_internal->SetState( STATE_PAUSED ); - - return wxTHREAD_NO_ERROR; -} - -wxThreadError wxThread::Resume() -{ - wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR, - wxT("a thread can't resume itself") ); - - wxCriticalSectionLocker lock(m_critsect); - - wxThreadState state = m_internal->GetState(); - - switch ( state ) - { - case STATE_PAUSED: - m_internal->Resume(); - return wxTHREAD_NO_ERROR; - - case STATE_EXITED: - return wxTHREAD_NO_ERROR; - - default: - wxLogDebug( wxT("Attempt to resume a thread which is not paused.") ); - - return wxTHREAD_MISC_ERROR; - } -} - -// ----------------------------------------------------------------------------- -// exiting thread -// ----------------------------------------------------------------------------- - -wxThread::ExitCode wxThread::Wait(wxThreadWait WXUNUSED(waitMode)) -{ - wxCHECK_MSG( This() != this, (ExitCode)-1, - wxT("a thread can't wait for itself") ); - - wxCHECK_MSG( !m_isDetached, (ExitCode)-1, - wxT("can't wait for detached thread") ); - - m_internal->Wait(); - - return m_internal->GetExitCode(); -} - -wxThreadError wxThread::Delete(ExitCode *rc, wxThreadWait WXUNUSED(waitMode)) -{ - wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR, - wxT("a thread can't delete itself") ); - - bool isDetached = m_isDetached; - - m_critsect.Enter(); - wxThreadState state = m_internal->GetState(); - - // ask the thread to stop - m_internal->SetCancelFlag(); - - m_critsect.Leave(); - - switch ( state ) - { - case STATE_NEW: - // we need to wake up the thread so that PthreadStart() will - // terminate - right now it's blocking on run semaphore in - // PthreadStart() - m_internal->SignalRun(); - - // fall through - - case STATE_EXITED: - // nothing to do - break; - - case STATE_PAUSED: - // resume the thread first - m_internal->Resume(); - - // fall through - - default: - if ( !isDetached ) - { - // wait until the thread stops - m_internal->Wait(); - - if ( rc ) - { - // return the exit code of the thread - *rc = m_internal->GetExitCode(); - } - } - } - - return wxTHREAD_NO_ERROR; -} - -wxThreadError wxThread::Kill() -{ - wxCHECK_MSG( This() != this, wxTHREAD_MISC_ERROR, - wxT("a thread can't kill itself") ); - - switch ( m_internal->GetState() ) - { - case STATE_NEW: - case STATE_EXITED: - return wxTHREAD_NOT_RUNNING; - - case STATE_PAUSED: - // resume the thread first - Resume(); - - // fall through - - default: - OSStatus err = MPTerminateTask( m_internal->GetId() , -1 ) ; - if (err != noErr) - { - wxLogError( wxT("Failed to terminate a thread.") ); - - return wxTHREAD_MISC_ERROR; - } - - if ( m_isDetached ) - { - delete this ; - } - else - { - // this should be retrieved by Wait actually - m_internal->SetExitCode( (void*)-1 ); - } - - return wxTHREAD_NO_ERROR; - } -} - -void wxThread::Exit( ExitCode status ) -{ - wxASSERT_MSG( This() == this, - wxT("wxThread::Exit() can only be called in the context of the same thread") ); - - // don't enter m_critsect before calling OnExit() because the user code - // might deadlock if, for example, it signals a condition in OnExit() (a - // common case) while the main thread calls any of functions entering - // m_critsect on us (almost all of them do) - OnExit(); - - MPTaskID threadid = m_internal->GetId(); - - if ( IsDetached() ) - { - delete this; - } - else // joinable - { - // update the status of the joinable thread - wxCriticalSectionLocker lock( m_critsect ); - m_internal->SetState( STATE_EXITED ); - } - - MPTerminateTask( threadid, (long)status ); -} - -// also test whether we were paused -bool wxThread::TestDestroy() -{ - wxASSERT_MSG( This() == this, - wxT("wxThread::TestDestroy() can only be called in the context of the same thread") ); - - m_critsect.Enter(); - - if ( m_internal->GetState() == STATE_PAUSED ) - { - m_internal->SetReallyPaused( true ); - - // leave the crit section or the other threads will stop too if they attempt - // to call any of (seemingly harmless) IsXXX() functions while we sleep - m_critsect.Leave(); - - m_internal->Pause(); - } - else - { - // thread wasn't requested to pause, nothing to do - m_critsect.Leave(); - } - - return m_internal->WasCancelled(); -} - -// ----------------------------------------------------------------------------- -// priority setting -// ----------------------------------------------------------------------------- - -void wxThread::SetPriority(unsigned int prio) -{ - wxCHECK_RET( wxPRIORITY_MIN <= prio && prio <= wxPRIORITY_MAX, - wxT("invalid thread priority") ); - - wxCriticalSectionLocker lock(m_critsect); - - switch ( m_internal->GetState() ) - { - case STATE_RUNNING: - case STATE_PAUSED: - case STATE_NEW: - // thread not yet started, priority will be set when it is - m_internal->SetPriority( prio ); - break; - - case STATE_EXITED: - default: - wxFAIL_MSG( wxT("impossible to set thread priority in this state") ); - } -} - -unsigned int wxThread::GetPriority() const -{ - wxCriticalSectionLocker lock(const_cast(m_critsect)); - - return m_internal->GetPriority(); -} - -unsigned long wxThread::GetId() const -{ - wxCriticalSectionLocker lock(const_cast(m_critsect)); - - return (unsigned long)m_internal->GetId(); -} - -// ----------------------------------------------------------------------------- -// state tests -// ----------------------------------------------------------------------------- - -bool wxThread::IsRunning() const -{ - wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); - - return m_internal->GetState() == STATE_RUNNING; -} - -bool wxThread::IsAlive() const -{ - wxCriticalSectionLocker lock((wxCriticalSection&)m_critsect); - - switch ( m_internal->GetState() ) - { - case STATE_RUNNING: - case STATE_PAUSED: - return true; - - default: - return false; - } -} - -bool wxThread::IsPaused() const -{ - wxCriticalSectionLocker lock((wxCriticalSection&)m_critsect); - - return (m_internal->GetState() == STATE_PAUSED); -} - -// ---------------------------------------------------------------------------- -// Automatic initialization for thread module -// ---------------------------------------------------------------------------- - -class wxThreadModule : public wxModule -{ -public: - virtual bool OnInit() wxOVERRIDE; - virtual void OnExit() wxOVERRIDE; - -private: - wxDECLARE_DYNAMIC_CLASS(wxThreadModule); -}; - -wxIMPLEMENT_DYNAMIC_CLASS(wxThreadModule, wxModule); - -bool wxThreadModule::OnInit() -{ - bool hasThreadManager = -#ifdef __LP64__ - true ; // TODO VERIFY IN NEXT BUILD -#else - MPLibraryIsLoaded(); -#endif - - if ( !hasThreadManager ) - { - wxLogError( wxT("MP thread support is not available on this system" ) ) ; - - return false; - } - - // main thread's This() is NULL - __Verify_noErr(MPAllocateTaskStorageIndex( &gs_tlsForWXThread )) ; - __Verify_noErr(MPSetTaskStorageValue( gs_tlsForWXThread, 0 )) ; - - wxThread::ms_idMainThread = wxThread::GetCurrentId(); - gs_critsectWaitingForGui = new wxCriticalSection(); - - gs_critsectGui = new wxCriticalSection(); - gs_critsectGui->Enter(); - - return true; -} - -void wxThreadModule::OnExit() -{ - if ( gs_critsectGui ) - { - if ( !wxGuiOwnedByMainThread() ) - { - gs_critsectGui->Enter(); - gs_bGuiOwnedByMainThread = true; - } - - gs_critsectGui->Leave(); - wxDELETE(gs_critsectGui); - } - - wxDELETE(gs_critsectWaitingForGui); -} - -// ---------------------------------------------------------------------------- -// GUI Serialization copied from MSW implementation -// ---------------------------------------------------------------------------- - -void wxMutexGuiEnterImpl() -{ - // this would dead lock everything... - wxASSERT_MSG( !wxThread::IsMain(), - wxT("main thread doesn't want to block in wxMutexGuiEnter()!") ); - - // the order in which we enter the critical sections here is crucial!! - - // set the flag telling to the main thread that we want to do some GUI - { - wxCriticalSectionLocker enter(*gs_critsectWaitingForGui); - - gs_nWaitingForGui++; - } - - wxWakeUpMainThread(); - - // now we may block here because the main thread will soon let us in - // (during the next iteration of OnIdle()) - gs_critsectGui->Enter(); -} - -void wxMutexGuiLeaveImpl() -{ - wxCriticalSectionLocker enter(*gs_critsectWaitingForGui); - - if ( wxThread::IsMain() ) - { - gs_bGuiOwnedByMainThread = false; - } - else - { - // decrement the number of threads waiting for GUI access now - wxASSERT_MSG( gs_nWaitingForGui > 0, - wxT("calling wxMutexGuiLeave() without entering it first?") ); - - gs_nWaitingForGui--; - - wxWakeUpMainThread(); - } - - gs_critsectGui->Leave(); -} - -void WXDLLIMPEXP_BASE wxMutexGuiLeaveOrEnter() -{ - wxASSERT_MSG( wxThread::IsMain(), - wxT("only main thread may call wxMutexGuiLeaveOrEnter()!") ); - - if ( !gs_critsectWaitingForGui ) - return; - - wxCriticalSectionLocker enter(*gs_critsectWaitingForGui); - - if ( gs_nWaitingForGui == 0 ) - { - // no threads are waiting for GUI - so we may acquire the lock without - // any danger (but only if we don't already have it) - if ( !wxGuiOwnedByMainThread() ) - { - gs_critsectGui->Enter(); - - gs_bGuiOwnedByMainThread = true; - } - //else: already have it, nothing to do - } - else - { - // some threads are waiting, release the GUI lock if we have it - if ( wxGuiOwnedByMainThread() ) - wxMutexGuiLeave(); - //else: some other worker thread is doing GUI - } -} - -bool WXDLLIMPEXP_BASE wxGuiOwnedByMainThread() -{ - return gs_bGuiOwnedByMainThread; -} - -// wake up the main thread -void WXDLLEXPORT wxWakeUpMainThread() -{ - wxMacWakeUp(); -} - -// ---------------------------------------------------------------------------- -// include common implementation code -// ---------------------------------------------------------------------------- - -#include "wx/thrimpl.cpp" - -#endif // wxUSE_THREADS From 278d98b2b673d778eb6077e7f030e99415a01a57 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 23 Jan 2020 23:21:08 +0000 Subject: [PATCH 003/329] OSX: Draw background in wxGrid cell when editor is open This was removed when Quick Draw was in use due to an issue, but Quick Draw has been removed, so re-enable it. --- src/generic/grid.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c1dbb96548..267b30cb39 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6106,15 +6106,9 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) // Note: However, only if it is really _shown_, i.e. not hidden! if ( isCurrent && IsCellEditControlShown() ) { - // NB: this "#if..." is temporary and fixes a problem where the - // edit control is erased by this code after being rendered. - // On wxMac (QD build only), the cell editor is a wxTextCntl and is rendered - // implicitly, causing this out-of order render. -#if !defined(__WXMAC__) wxGridCellEditor *editor = attr->GetEditor(this, row, col); editor->PaintBackground(dc, rect, *attr); editor->DecRef(); -#endif } else { From f5c3d9d1fbf3a3413cac035d96296540f9788f01 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Thu, 23 Jan 2020 23:23:18 +0000 Subject: [PATCH 004/329] OSX: Ignore wxHSCROLL and wxVSCROLL in wxDataViewCtrl Using these two style flags in wxDataViewCtrl causes the library to seg fault when trying to create the scrollbars. The wxDataViewCtrl has scrollbars already without these flags. Closes #17028 --- src/osx/dataview_osx.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/osx/dataview_osx.cpp b/src/osx/dataview_osx.cpp index 60e57b70f2..0bee2da4fa 100644 --- a/src/osx/dataview_osx.cpp +++ b/src/osx/dataview_osx.cpp @@ -365,6 +365,10 @@ bool wxDataViewCtrl::Create(wxWindow *parent, const wxValidator& validator, const wxString& name) { + // Remove wxVSCROLL and wxHSCROLL from the style, since the dataview panel has scrollbars + // by default, and wxControl::Create trys to make some but crashes in the process + style &= ~(wxVSCROLL | wxHSCROLL); + DontCreatePeer(); if (!(wxControl::Create(parent,id,pos,size,style,validator,name))) return false; From 654ef6d729a69718ea60ae6f97e64cfa084ce29b Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 24 Jan 2020 00:06:14 +0000 Subject: [PATCH 005/329] OSX: Only update the window level if it has changed Updating the level could lead to windows being reordered in that level on some OS versions, so for safety don't do it unless it is needed. --- src/osx/cocoa/nonownedwnd.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 95319f6ce5..c118d47b08 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -939,9 +939,13 @@ void wxNonOwnedWindowCocoaImpl::SetWindowStyleFlag( long style ) level = NSModalPanelWindowLevel; else if (( style & wxFRAME_FLOAT_ON_PARENT ) || ( style & wxFRAME_TOOL_WINDOW )) level = NSFloatingWindowLevel; - - [m_macWindow setLevel: level]; - m_macWindowLevel = level; + + // Only update the level when it has changed, setting a level can cause the OS to reorder the windows in the level + if ( level != m_macWindowLevel ) + { + [m_macWindow setLevel: level]; + m_macWindowLevel = level; + } } } From 9d470f6433ac1c6bc2b3fc6e96e78dda4cd1f4a1 Mon Sep 17 00:00:00 2001 From: Fulvio Senore Date: Fri, 31 Jan 2020 15:41:55 +0100 Subject: [PATCH 006/329] Fix focus-related problems in wxComboCtrl under MSW Allow default handling of focus events to take place, this is needed at least under MSW to avoid confusing the system focus-tracking logic. --- src/common/combocmn.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index d3920f9d8c..5ede7dfd42 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -2086,6 +2086,9 @@ void wxComboCtrlBase::OnCharEvent(wxKeyEvent& event) void wxComboCtrlBase::OnFocusEvent( wxFocusEvent& event ) { + // Always let default handling of focus events to take place. + event.Skip(); + // On Mac, setting focus here led to infinite recursion so // m_resetFocus is used as a guard From 01d0deb5bfd576f81f048c4233191ecd9a573fdd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 16:15:13 +0100 Subject: [PATCH 007/329] Get rid of unnecessary variable in wxListCtrl::SetColumnWidth() No real changes, just remove a variable assigned and used exactly once. --- src/generic/listctrl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index e4ce5b2672..b8acd1b983 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3279,8 +3279,6 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) wxListHeaderData *column = node->GetData(); - size_t count = GetItemCount(); - if ( width == wxLIST_AUTOSIZE_USEHEADER || width == wxLIST_AUTOSIZE ) { wxListCtrlMaxWidthCalculator calculator(this, col); @@ -3297,7 +3295,8 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) size_t first_visible, last_visible; GetVisibleLinesRange(&first_visible, &last_visible); - calculator.ComputeBestColumnWidth(count, first_visible, last_visible); + calculator.ComputeBestColumnWidth(GetItemCount(), + first_visible, last_visible); pWidthInfo->nMaxWidth = calculator.GetMaxWidth(); pWidthInfo->bNeedsUpdate = false; } From 101487730262180a20f0b05c32a81a66535aef8a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 16:18:41 +0100 Subject: [PATCH 008/329] Slightly reorganize last column width calculation No real changes, just make it more obvious that we increase the last column width to the remaining margin if it's smaller than it. --- src/generic/listctrl.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index b8acd1b983..8056238d6d 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3305,17 +3305,19 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) calculator.UpdateWithWidth(pWidthInfo->nMaxWidth); } + width = calculator.GetMaxWidth() + AUTOSIZE_COL_MARGIN; + // expand the last column to fit the client size // only for AUTOSIZE_USEHEADER to mimic MSW behaviour - int margin = 0; if ( (width == wxLIST_AUTOSIZE_USEHEADER) && (col == GetColumnCount() - 1) ) { - margin = GetClientSize().GetX(); + int margin = GetClientSize().GetX(); for ( int i = 0; i < col && margin > 0; ++i ) margin -= m_columns.Item(i)->GetData()->GetWidth(); - } - width = wxMax(margin, calculator.GetMaxWidth() + AUTOSIZE_COL_MARGIN); + if ( margin > width ) + width = margin; + } } column->SetWidth( width ); From e1fce68be6ae17e0164b2df07c79302f2b8853e6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 16:22:49 +0100 Subject: [PATCH 009/329] Account for checkboxes when autosizing wxListCtrl first column Without this, the text of the first column was truncated when using checkboxes. Closes #18661. --- src/generic/listctrl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 8056238d6d..141531cc75 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3307,6 +3307,13 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) width = calculator.GetMaxWidth() + AUTOSIZE_COL_MARGIN; + if ( col == 0 && HasCheckBoxes() ) + { + // also account for the space needed by the checkbox + width += wxRendererNative::Get().GetCheckBoxSize(this).x + + 2*MARGIN_AROUND_CHECKBOX; + } + // expand the last column to fit the client size // only for AUTOSIZE_USEHEADER to mimic MSW behaviour if ( (width == wxLIST_AUTOSIZE_USEHEADER) && (col == GetColumnCount() - 1) ) From 37cf80240b71a78334e00b50db697334f916962d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 16:41:15 +0100 Subject: [PATCH 010/329] Exclude unwanted files in wxMSW tags script When a new directory is added, it's better to include the tags in it, even if they're not wanted, than to not do it, when they're. --- misc/scripts/makemswtags.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/scripts/makemswtags.bat b/misc/scripts/makemswtags.bat index 22bc2a46f4..e54f016b0a 100755 --- a/misc/scripts/makemswtags.bat +++ b/misc/scripts/makemswtags.bat @@ -1 +1 @@ -@ctags.exe --totals --language-force=c++ --c++-types=+p -I ./misc/scripts/ctags.ignore include/wx/*.h include/wx/aui/*.h include/wx/msw/*.h include/wx/msw/ole/*.h include/wx/msw/private/*.h include/wx/generic/private/*.h include/wx/generic/*.h include/wx/html/*.h include/wx/private/*.h include/wx/propgrid/*.h include/wx/protocol/*.h include/wx/ribbon/*.h include/wx/richtext/*.h include/wx/xml/*.h include/wx/xrc/*.h src/aui/*.cpp src/common/*.cpp src/generic/*.cpp src/msw/*.cpp src/msw/ole/*.cpp src/html/*.cpp src/propgrid/*.cpp src/ribbon/*.cpp src/richtext/*.cpp src/xml/*.cpp src/xrc/*.cpp +@ctags.exe --totals --language-force=c++ --c++-types=+p -I ./misc/scripts/ctags.ignore --exclude=src/android --exclude=src/dfb --exclude=src/gtk --exclude=src/gtk1 --exclude=src/motif --exclude=src/osx --exclude=src/qt --exclude=src/univ --exclude=src/unix--exclude=src/x11 --exclude=include/wx/android --exclude=include/wx/dfb --exclude=include/wx/gtk --exclude=include/wx/gtk1 --exclude=include/wx/motif --exclude=include/wx/osx --exclude=include/wx/qt --exclude=include/wx/univ --exclude=include/wx/unix--exclude=include/wx/x11 include src From c34a7a2e30aebc138fd925afcf1affb45103e638 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 16:54:06 +0100 Subject: [PATCH 011/329] Convert CRT functions test case to use CATCH macros directly Get rid of legacy CppUnit-compatible macros. No real changes. --- tests/strings/crt.cpp | 284 ++++++++++++++++++------------------------ 1 file changed, 122 insertions(+), 162 deletions(-) diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index 1fd1914c1f..54bce32458 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -32,84 +32,47 @@ static const wchar_t *strWC = L"hello, world"; static const wxString strWX("hello, world"); // ---------------------------------------------------------------------------- -// test class +// tests // ---------------------------------------------------------------------------- -class CrtTestCase : public CppUnit::TestCase -{ -public: - CrtTestCase() {} - -private: - CPPUNIT_TEST_SUITE( CrtTestCase ); - CPPUNIT_TEST( SetGetEnv ); -#if wxUSE_UNICODE - CPPUNIT_TEST( Strchr ); -#endif // wxUSE_UNICODE - CPPUNIT_TEST( Strcmp ); - CPPUNIT_TEST( Strspn ); - CPPUNIT_TEST( Strcspn ); - CPPUNIT_TEST( Strpbrk ); - CPPUNIT_TEST( Strnlen ); - CPPUNIT_TEST_SUITE_END(); - - void SetGetEnv(); -#if wxUSE_UNICODE - void Strchr(); -#endif // wxUSE_UNICODE - void Strcmp(); - void Strspn(); - void Strcspn(); - void Strpbrk(); - void Strnlen(); - - wxDECLARE_NO_COPY_CLASS(CrtTestCase); -}; - -// register in the unnamed registry so that these tests are run by default -CPPUNIT_TEST_SUITE_REGISTRATION( CrtTestCase ); - -// also include in its own registry so that these tests can be run alone -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CrtTestCase, "CrtTestCase" ); - -void CrtTestCase::SetGetEnv() +TEST_CASE("CRT::SetGetEnv", "[crt][getenv][setenv]") { #define TESTVAR_NAME wxT("WXTESTVAR") wxString val; wxSetEnv(TESTVAR_NAME, wxT("value")); - CPPUNIT_ASSERT( wxGetEnv(TESTVAR_NAME, &val) ); - CPPUNIT_ASSERT_EQUAL( "value", val ); - CPPUNIT_ASSERT_EQUAL( "value", wxString(wxGetenv(TESTVAR_NAME)) ); + CHECK( wxGetEnv(TESTVAR_NAME, &val) ); + CHECK( val == "value" ); + CHECK( wxString(wxGetenv(TESTVAR_NAME)) == "value" ); wxSetEnv(TESTVAR_NAME, wxT("something else")); - CPPUNIT_ASSERT( wxGetEnv(TESTVAR_NAME, &val) ); - CPPUNIT_ASSERT_EQUAL( "something else", val ); - CPPUNIT_ASSERT_EQUAL( "something else", wxString(wxGetenv(TESTVAR_NAME)) ); + CHECK( wxGetEnv(TESTVAR_NAME, &val) ); + CHECK( val == "something else" ); + CHECK( wxString(wxGetenv(TESTVAR_NAME)) == "something else" ); - CPPUNIT_ASSERT( wxUnsetEnv(TESTVAR_NAME) ); - CPPUNIT_ASSERT( !wxGetEnv(TESTVAR_NAME, NULL) ); - CPPUNIT_ASSERT( !wxGetenv(TESTVAR_NAME) ); + CHECK( wxUnsetEnv(TESTVAR_NAME) ); + CHECK( !wxGetEnv(TESTVAR_NAME, NULL) ); + CHECK( !wxGetenv(TESTVAR_NAME) ); #undef TESTVAR_NAME } #if wxUSE_UNICODE -void CrtTestCase::Strchr() +TEST_CASE("CRT::Strchr", "[crt][strchr]") { // test that searching for a wide character in a narrow string simply // doesn't find it but doesn't fail with an assert (#11487) const wxUniChar smiley = *wxString::FromUTF8("\xe2\x98\xba").begin(); - CPPUNIT_ASSERT( !wxStrchr("hello", smiley) ); + CHECK( !wxStrchr("hello", smiley) ); // but searching for an explicitly wide character does find it - CPPUNIT_ASSERT( wxStrchr(wxString::FromUTF8(":-) == \xe2\x98\xba"), + CHECK( wxStrchr(wxString::FromUTF8(":-) == \xe2\x98\xba"), static_cast(smiley)) ); } #endif // wxUSE_UNICODE -void CrtTestCase::Strcmp() +TEST_CASE("CRT::Strcmp", "[crt][strcmp]") { // this code tests if all possible ways of calling wxStrcmp() compile: const char * const char1 = "first"; @@ -126,150 +89,147 @@ void CrtTestCase::Strcmp() wxCharBuffer charbuf2(char2); wxWCharBuffer wcharbuf2(wchar2); - CPPUNIT_ASSERT( wxStrcmp(char1, char2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(char1, wchar2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(char1, str2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(char1, cstr2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(char1, charbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(char1, wcharbuf2) < 0 ); + CHECK( wxStrcmp(char1, char2) < 0 ); + CHECK( wxStrcmp(char1, wchar2) < 0 ); + CHECK( wxStrcmp(char1, str2) < 0 ); + CHECK( wxStrcmp(char1, cstr2) < 0 ); + CHECK( wxStrcmp(char1, charbuf2) < 0 ); + CHECK( wxStrcmp(char1, wcharbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wchar1, char2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wchar1, wchar2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wchar1, str2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wchar1, cstr2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wchar1, charbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wchar1, wcharbuf2) < 0 ); + CHECK( wxStrcmp(wchar1, char2) < 0 ); + CHECK( wxStrcmp(wchar1, wchar2) < 0 ); + CHECK( wxStrcmp(wchar1, str2) < 0 ); + CHECK( wxStrcmp(wchar1, cstr2) < 0 ); + CHECK( wxStrcmp(wchar1, charbuf2) < 0 ); + CHECK( wxStrcmp(wchar1, wcharbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(str1, char2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(str1, wchar2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(str1, str2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(str1, cstr2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(str1, charbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(str1, wcharbuf2) < 0 ); + CHECK( wxStrcmp(str1, char2) < 0 ); + CHECK( wxStrcmp(str1, wchar2) < 0 ); + CHECK( wxStrcmp(str1, str2) < 0 ); + CHECK( wxStrcmp(str1, cstr2) < 0 ); + CHECK( wxStrcmp(str1, charbuf2) < 0 ); + CHECK( wxStrcmp(str1, wcharbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(cstr1, char2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(cstr1, wchar2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(cstr1, str2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(cstr1, cstr2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(cstr1, charbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(cstr1, wcharbuf2) < 0 ); + CHECK( wxStrcmp(cstr1, char2) < 0 ); + CHECK( wxStrcmp(cstr1, wchar2) < 0 ); + CHECK( wxStrcmp(cstr1, str2) < 0 ); + CHECK( wxStrcmp(cstr1, cstr2) < 0 ); + CHECK( wxStrcmp(cstr1, charbuf2) < 0 ); + CHECK( wxStrcmp(cstr1, wcharbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(charbuf1, char2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(charbuf1, wchar2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(charbuf1, str2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(charbuf1, cstr2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(charbuf1, charbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(charbuf1, wcharbuf2) < 0 ); + CHECK( wxStrcmp(charbuf1, char2) < 0 ); + CHECK( wxStrcmp(charbuf1, wchar2) < 0 ); + CHECK( wxStrcmp(charbuf1, str2) < 0 ); + CHECK( wxStrcmp(charbuf1, cstr2) < 0 ); + CHECK( wxStrcmp(charbuf1, charbuf2) < 0 ); + CHECK( wxStrcmp(charbuf1, wcharbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wcharbuf1, char2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wcharbuf1, wchar2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wcharbuf1, str2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wcharbuf1, cstr2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wcharbuf1, charbuf2) < 0 ); - CPPUNIT_ASSERT( wxStrcmp(wcharbuf1, wcharbuf2) < 0 ); + CHECK( wxStrcmp(wcharbuf1, char2) < 0 ); + CHECK( wxStrcmp(wcharbuf1, wchar2) < 0 ); + CHECK( wxStrcmp(wcharbuf1, str2) < 0 ); + CHECK( wxStrcmp(wcharbuf1, cstr2) < 0 ); + CHECK( wxStrcmp(wcharbuf1, charbuf2) < 0 ); + CHECK( wxStrcmp(wcharbuf1, wcharbuf2) < 0 ); } -void CrtTestCase::Strspn() +TEST_CASE("CRT::Strspn", "[crt][strspn]") { - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strMB, "xyz") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strWC, "xyz") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strWX, "xyz") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strMB, L"xyz") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strWC, L"xyz") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strWX, L"xyz") ); + CHECK( wxStrspn(strMB, "xyz") == 0 ); + CHECK( wxStrspn(strWC, "xyz") == 0 ); + CHECK( wxStrspn(strWX, "xyz") == 0 ); + CHECK( wxStrspn(strMB, L"xyz") == 0 ); + CHECK( wxStrspn(strWC, L"xyz") == 0 ); + CHECK( wxStrspn(strWX, L"xyz") == 0 ); - CPPUNIT_ASSERT_EQUAL( (size_t)5, wxStrspn(strMB, "hleo") ); - CPPUNIT_ASSERT_EQUAL( (size_t)5, wxStrspn(strWC, "hleo") ); - CPPUNIT_ASSERT_EQUAL( (size_t)5, wxStrspn(strWX, "hleo") ); + CHECK( wxStrspn(strMB, "hleo") == 5 ); + CHECK( wxStrspn(strWC, "hleo") == 5 ); + CHECK( wxStrspn(strWX, "hleo") == 5 ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strMB, "ld") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strWC, "ld") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrspn(strWX, "ld") ); + CHECK( wxStrspn(strMB, "ld") == 0 ); + CHECK( wxStrspn(strWC, "ld") == 0 ); + CHECK( wxStrspn(strWX, "ld") == 0 ); - CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrspn(strMB, strWC) ); - CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrspn(strWC, strWX) ); - CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrspn(strWX, strMB) ); + CHECK( wxStrspn(strMB, strWC) == strWX.length() ); + CHECK( wxStrspn(strWC, strWX) == strWX.length() ); + CHECK( wxStrspn(strWX, strMB) == strWX.length() ); } -void CrtTestCase::Strcspn() +TEST_CASE("CRT::Strcspn", "[crt][strcspn]") { - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrcspn(strMB, strWX) ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrcspn(strWC, strMB) ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrcspn(strWX, strWC) ); + CHECK( wxStrcspn(strMB, strWX) == 0 ); + CHECK( wxStrcspn(strWC, strMB) == 0 ); + CHECK( wxStrcspn(strWX, strWC) == 0 ); - CPPUNIT_ASSERT_EQUAL( (size_t)5, wxStrcspn(strMB, ", ") ); - CPPUNIT_ASSERT_EQUAL( (size_t)5, wxStrcspn(strWC, ", ") ); - CPPUNIT_ASSERT_EQUAL( (size_t)5, wxStrcspn(strWX, ", ") ); + CHECK( wxStrcspn(strMB, ", ") == 5 ); + CHECK( wxStrcspn(strWC, ", ") == 5 ); + CHECK( wxStrcspn(strWX, ", ") == 5 ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrcspn(strMB, "hel") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrcspn(strWC, "hel") ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrcspn(strWX, "hel") ); + CHECK( wxStrcspn(strMB, "hel") == 0 ); + CHECK( wxStrcspn(strWC, "hel") == 0 ); + CHECK( wxStrcspn(strWX, "hel") == 0 ); - CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrcspn(strMB, "xy") ); - CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrcspn(strWC, "xy") ); - CPPUNIT_ASSERT_EQUAL( strWX.length(), wxStrcspn(strWX, "xy") ); + CHECK( wxStrcspn(strMB, "xy") == strWX.length() ); + CHECK( wxStrcspn(strWC, "xy") == strWX.length() ); + CHECK( wxStrcspn(strWX, "xy") == strWX.length() ); } -void CrtTestCase::Strpbrk() +TEST_CASE("CRT::Strpbrk", "[crt][strpbrk]") { const wxString s(", "); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, ", ") ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, L", ") ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, ", ") ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX, L", ") ); + CHECK( *wxStrpbrk(strMB, ", ") == ',' ); + CHECK( *wxStrpbrk(strWC, L", ") == L',' ); + CHECK( *wxStrpbrk(strWX, ", ") == ',' ); + CHECK( *wxStrpbrk(strWX, L", ") == L',' ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, s) ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, s) ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, s) ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s) ); + CHECK( *wxStrpbrk(strMB, s) == ',' ); + CHECK( *wxStrpbrk(strWC, s) == L',' ); + CHECK( *wxStrpbrk(strWX, s) == ',' ); + CHECK( *wxStrpbrk(strWX.c_str(), s) == ',' ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, s.c_str()) ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, s.c_str()) ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, s.c_str()) ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s.c_str()) ); + CHECK( *wxStrpbrk(strMB, s.c_str()) == ',' ); + CHECK( *wxStrpbrk(strWC, s.c_str()) == L',' ); + CHECK( *wxStrpbrk(strWX, s.c_str()) == ',' ); + CHECK( *wxStrpbrk(strWX.c_str(), s.c_str()) == ',' ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strMB, s.mb_str()) ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWC, s.wc_str()) ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX, s.mb_str()) ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX, s.wc_str()) ); - CPPUNIT_ASSERT_EQUAL( ',', *wxStrpbrk(strWX.c_str(), s.mb_str()) ); - CPPUNIT_ASSERT_EQUAL( L',', *wxStrpbrk(strWX.c_str(), s.wc_str()) ); + CHECK( *wxStrpbrk(strMB, s.mb_str()) == ',' ); + CHECK( *wxStrpbrk(strWC, s.wc_str()) == L',' ); + CHECK( *wxStrpbrk(strWX, s.mb_str()) == ',' ); + CHECK( *wxStrpbrk(strWX, s.wc_str()) == L',' ); + CHECK( *wxStrpbrk(strWX.c_str(), s.mb_str()) == ',' ); + CHECK( *wxStrpbrk(strWX.c_str(), s.wc_str()) == L',' ); - CPPUNIT_ASSERT( !wxStrpbrk(strWX, "xyz") ); - CPPUNIT_ASSERT( !wxStrpbrk(strWX.c_str(), L"xyz") ); + CHECK( !wxStrpbrk(strWX, "xyz") ); + CHECK( !wxStrpbrk(strWX.c_str(), L"xyz") ); } -void CrtTestCase::Strnlen() +TEST_CASE("CRT::Strnlen", "[crt][strnlen]") { // other misc tests for wxStrnlen(const char*, size_t) - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrnlen("", 0) ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrnlen("", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrnlen("1234", 0) ); - CPPUNIT_ASSERT_EQUAL( (size_t)2, wxStrnlen("1234", 2) ); - CPPUNIT_ASSERT_EQUAL( (size_t)4, wxStrnlen("1234", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)7, wxStrnlen("1234567", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)8, wxStrnlen("12345678", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)8, wxStrnlen("123456789", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)9, wxStrnlen("123456789", 12) ); + CHECK( wxStrnlen("", 0) == 0 ); + CHECK( wxStrnlen("", 8) == 0 ); + CHECK( wxStrnlen("1234", 0) == 0 ); + CHECK( wxStrnlen("1234", 2) == 2 ); + CHECK( wxStrnlen("1234", 8) == 4 ); + CHECK( wxStrnlen("1234567", 8) == 7 ); + CHECK( wxStrnlen("12345678", 8) == 8 ); + CHECK( wxStrnlen("123456789", 8) == 8 ); + CHECK( wxStrnlen("123456789", 12) == 9 ); // other misc tests for wxStrnlen(const wchar_t*, size_t) - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrnlen(L"", 0) ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrnlen(L"", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)0, wxStrnlen(L"1234", 0) ); - CPPUNIT_ASSERT_EQUAL( (size_t)2, wxStrnlen(L"1234", 2) ); - CPPUNIT_ASSERT_EQUAL( (size_t)4, wxStrnlen(L"1234", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)7, wxStrnlen(L"1234567", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)8, wxStrnlen(L"12345678", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)8, wxStrnlen(L"123456789", 8) ); - CPPUNIT_ASSERT_EQUAL( (size_t)9, wxStrnlen(L"123456789", 12) ); + CHECK( wxStrnlen(L"", 0) == 0 ); + CHECK( wxStrnlen(L"", 8) == 0 ); + CHECK( wxStrnlen(L"1234", 0) == 0 ); + CHECK( wxStrnlen(L"1234", 2) == 2 ); + CHECK( wxStrnlen(L"1234", 8) == 4 ); + CHECK( wxStrnlen(L"1234567", 8) == 7 ); + CHECK( wxStrnlen(L"12345678", 8) == 8 ); + CHECK( wxStrnlen(L"123456789", 8) == 8 ); + CHECK( wxStrnlen(L"123456789", 12) == 9 ); // wxStrlen() is only for NULL-terminated strings: - CPPUNIT_ASSERT_EQUAL( (size_t)4, wxStrnlen("1234" "\0" "78", 12) ); - CPPUNIT_ASSERT_EQUAL( (size_t)4, wxStrnlen(L"1234" L"\0" L"5678", 12) ); + CHECK( wxStrnlen("1234" "\0" "78", 12) == 4 ); + CHECK( wxStrnlen(L"1234" L"\0" L"5678", 12) == 4 ); } - - - From 7969f3f81c5a9c38295aadcc4e6b1a6598523c39 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 17:11:50 +0100 Subject: [PATCH 012/329] Define wxHAS_NULLPTR_T if nullptr is supported This is necessary because MSVS versions as old as 2010 support it, even if they don't have full C++11 support and so don't define __cplusplus appropriately. Extract the existing check for nullptr from wx/strvararg.h to wx/defs.h in order to allow reusing it. --- docs/doxygen/mainpages/const_cpp.h | 1 + include/wx/defs.h | 8 ++++++++ include/wx/strvararg.h | 4 +--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/doxygen/mainpages/const_cpp.h b/docs/doxygen/mainpages/const_cpp.h index ce7a5f1f8e..379e9ee3ec 100644 --- a/docs/doxygen/mainpages/const_cpp.h +++ b/docs/doxygen/mainpages/const_cpp.h @@ -187,6 +187,7 @@ Currently the following symbols exist: @itemdef{wxHAS_MULTIPLE_FILEDLG_FILTERS, Defined if wxFileDialog supports multiple ('|'-separated) filters.} @itemdef{wxHAS_NATIVE_DATAVIEWCTRL, Defined if native wxDataViewCtrl class is being used (this symbol only exists in wxWidgets 3.1.4 and later).} @itemdef{wxHAS_NATIVE_WINDOW, Defined if wxNativeWindow class is available.} +@itemdef{wxHAS_NULLPTR_T, Defined if the currently used compiler supports C++11 @c nullptr.} @itemdef{wxHAS_IMAGES_IN_RESOURCES, Defined if Windows resource files or OS/2 resource files are available on the current platform.} @itemdef{wxHAS_POWER_EVENTS, Defined if wxPowerEvent are ever generated on the current platform.} diff --git a/include/wx/defs.h b/include/wx/defs.h index 2bb24814fd..a7472b60b3 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -285,6 +285,14 @@ typedef short int WXTYPE; #define wxOVERRIDE #endif /* HAVE_OVERRIDE */ +/* + Support for nullptr is available since MSVS 2010, even though it doesn't + define __cplusplus as a C++11 compiler. + */ +#if __cplusplus >= 201103 || wxCHECK_VISUALC_VERSION(10) + #define wxHAS_NULLPTR_T +#endif + /* wxFALLTHROUGH is used to notate explicit fallthroughs in switch statements */ #if __cplusplus >= 201703L diff --git a/include/wx/strvararg.h b/include/wx/strvararg.h index 2af4d79734..82cb94536f 100644 --- a/include/wx/strvararg.h +++ b/include/wx/strvararg.h @@ -425,9 +425,7 @@ wxFORMAT_STRING_SPECIFIER(int*, wxFormatString::Arg_IntPtr | wxFormatString::Arg wxFORMAT_STRING_SPECIFIER(short int*, wxFormatString::Arg_ShortIntPtr | wxFormatString::Arg_Pointer) wxFORMAT_STRING_SPECIFIER(long int*, wxFormatString::Arg_LongIntPtr | wxFormatString::Arg_Pointer) -// Support for nullptr is available since MSVS 2010, even though it doesn't -// define __cplusplus as a C++11 compiler. -#if __cplusplus >= 201103 || wxCHECK_VISUALC_VERSION(10) +#ifdef wxHAS_NULLPTR_T wxFORMAT_STRING_SPECIFIER(std::nullptr_t, wxFormatString::Arg_Pointer) #endif From 55efc9e60742d0de61e39556084d09f2332b99be Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 17:13:06 +0100 Subject: [PATCH 013/329] Allow using wxStrtox() functions with nullptr with MSVS too Add a unit test checking that it compiles (and works). This extends the changes of 63b1f00eb87fd366209ca7e09300fd1e309eb7ee to cover MSVS as well. --- include/wx/wxcrt.h | 2 +- tests/strings/crt.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index cfdc47257e..e8bdc628c2 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -844,7 +844,7 @@ template<> struct wxStrtoxCharType return NULL; } }; -#if __cplusplus >= 201103 +#ifdef wxHAS_NULLPTR_T template<> struct wxStrtoxCharType { typedef const char* Type; diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index 54bce32458..6d728f3cb8 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -233,3 +233,33 @@ TEST_CASE("CRT::Strnlen", "[crt][strnlen]") CHECK( wxStrnlen("1234" "\0" "78", 12) == 4 ); CHECK( wxStrnlen(L"1234" L"\0" L"5678", 12) == 4 ); } + +TEST_CASE("CRT::Strtod", "[crt][strtod]") +{ + const wxString s = "123@"; + const double d = 123.0; + + SECTION("char") + { + char* end = NULL; + CHECK( wxStrtod(s, &end) == d ); + REQUIRE( end ); + CHECK( *end == '@' ); + } + + SECTION("wchar_t") + { + wchar_t* end = NULL; + CHECK( wxStrtod(s, &end) == d ); + REQUIRE( end ); + CHECK( *end == L'@' ); + } + + SECTION("other") + { + CHECK( wxStrtod(s, 0) == d ); +#ifdef wxHAS_NULLPTR_T + CHECK( wxStrtod(s, nullptr) == d ); +#endif + } +} From d455c5b99e99705e816ddcebc23d33320c93895e Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Tue, 28 Jan 2020 23:40:21 +0700 Subject: [PATCH 014/329] Fix making the wrong wxGrid cell visible when selecting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should make visible the cell of the corner of the current selected block. Also fix names of the wxGrid::UpdateBlockBeingSelected parameters because actually passed Ñщщквы are of any opposite selection block corners. --- include/wx/generic/grid.h | 12 ++++++------ src/generic/grid.cpp | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index d4e403e8eb..d753161100 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -2325,13 +2325,13 @@ protected: // this function is called to extend the block being currently selected // from mouse and keyboard event handlers - void UpdateBlockBeingSelected(int topRow, int leftCol, - int bottomRow, int rightCol); + void UpdateBlockBeingSelected(int blockStartRow, int blockStartCol, + int blockEndRow, int blockEndCol); - void UpdateBlockBeingSelected(const wxGridCellCoords& topLeft, - const wxGridCellCoords& bottomRight) - { UpdateBlockBeingSelected(topLeft.GetRow(), topLeft.GetCol(), - bottomRight.GetRow(), bottomRight.GetCol()); } + void UpdateBlockBeingSelected(const wxGridCellCoords& blockStart, + const wxGridCellCoords& blockEnd) + { UpdateBlockBeingSelected(blockStart.GetRow(), blockStart.GetCol(), + blockEnd.GetRow(), blockEnd.GetCol()); } virtual bool ShouldScrollToChildOnFocus(wxWindow* WXUNUSED(win)) wxOVERRIDE { return false; } diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c1dbb96548..97a493056e 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5822,11 +5822,16 @@ bool wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) } void -wxGrid::UpdateBlockBeingSelected(int topRow, int leftCol, - int bottomRow, int rightCol) +wxGrid::UpdateBlockBeingSelected(int blockStartRow, int blockStartCol, + int blockEndRow, int blockEndCol) { + m_selectedBlockCorner = wxGridCellCoords(blockEndRow, blockEndCol); MakeCellVisible(m_selectedBlockCorner); - m_selectedBlockCorner = wxGridCellCoords(bottomRow, rightCol); + + int topRow = wxMin(blockStartRow, blockEndRow); + int leftCol = wxMin(blockStartCol, blockEndCol); + int bottomRow = wxMax(blockStartRow, blockEndRow); + int rightCol = wxMax(blockStartCol, blockEndCol); if ( m_selection ) { @@ -5864,9 +5869,6 @@ wxGrid::UpdateBlockBeingSelected(int topRow, int leftCol, } } - EnsureFirstLessThanSecond(topRow, bottomRow); - EnsureFirstLessThanSecond(leftCol, rightCol); - wxGridCellCoords updateTopLeft = wxGridCellCoords(topRow, leftCol), updateBottomRight = wxGridCellCoords(bottomRow, rightCol); From bf5be68510dc827ef18b1f1ecd95998b8ce2f0a8 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Tue, 28 Jan 2020 23:53:26 +0700 Subject: [PATCH 015/329] Test wxGrid scrolling when selecting cells. --- tests/controls/gridtest.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index f38c0c48bf..e9489adde4 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -73,6 +73,7 @@ private: WXUISIM_TEST( RangeSelect ); CPPUNIT_TEST( Cursor ); CPPUNIT_TEST( Selection ); + CPPUNIT_TEST( ScrollWhenSelect ); CPPUNIT_TEST( AddRowCol ); CPPUNIT_TEST( DeleteAndAddRowCol ); CPPUNIT_TEST( ColumnOrder ); @@ -114,6 +115,7 @@ private: void RangeSelect(); void Cursor(); void Selection(); + void ScrollWhenSelect(); void AddRowCol(); void DeleteAndAddRowCol(); void ColumnOrder(); @@ -594,6 +596,30 @@ void GridTestCase::Selection() CPPUNIT_ASSERT(!m_grid->IsInSelection(3, 0)); } +void GridTestCase::ScrollWhenSelect() +{ + m_grid->AppendCols(10); + + REQUIRE( m_grid->GetGridCursorCol() == 0 ); + REQUIRE( m_grid->GetGridCursorRow() == 0 ); + REQUIRE( m_grid->IsVisible(0, 0) ); + REQUIRE( !m_grid->IsVisible(0, 4) ); + + for ( int i = 0; i < 4; ++i ) + { + m_grid->MoveCursorRight(true); + } + CHECK( m_grid->IsVisible(0, 4) ); + + m_grid->ClearSelection(); + m_grid->SetGridCursor(1, 1); + for ( int i = 0; i < 5; ++i ) + { + m_grid->MoveCursorDown(true); + } + CHECK( m_grid->IsVisible(6, 1) ); +} + void GridTestCase::AddRowCol() { CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows()); From 68ccc77e2041f9149a3e6e4c5b85b76aa7bccefa Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Tue, 28 Jan 2020 01:37:12 +0700 Subject: [PATCH 016/329] Fix wxGrid Home and End keys handling Take into account that rows and columns may be hidden and columns also can be reordered. --- src/generic/grid.cpp | 62 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 97a493056e..b48715d05d 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5563,15 +5563,65 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; case WXK_HOME: - GoToCell(event.ControlDown() ? 0 - : m_currentCellCoords.GetRow(), - 0); + { + if ( m_currentCellCoords == wxGridNoCellCoords ) + break; + + int row = m_currentCellCoords.GetRow(); + if ( event.ControlDown() ) + { + row = 0; + + // Find visible row. + for ( ; row < m_numRows; ++row ) + { + if ( IsRowShown(row) ) + break; + } + } + + int col = 0; + // Find visible column. + for ( ; col < m_numCols; ++col ) + { + if ( IsColShown(GetColAt(col)) ) + break; + } + + ClearSelection(); + GoToCell(row, GetColAt(col)); + } break; case WXK_END: - GoToCell(event.ControlDown() ? m_numRows - 1 - : m_currentCellCoords.GetRow(), - m_numCols - 1); + { + if ( m_currentCellCoords == wxGridNoCellCoords ) + break; + + int row = m_currentCellCoords.GetRow(); + if ( event.ControlDown() ) + { + row = m_numRows - 1; + + // Find visible row. + for ( ; row >= 0; --row ) + { + if ( IsRowShown(row) ) + break; + } + } + + int col = m_numCols - 1; + // Find visible column. + for ( ; col >= 0; --col ) + { + if ( IsColShown(GetColAt(col)) ) + break; + } + + ClearSelection(); + GoToCell(row, GetColAt(col)); + } break; case WXK_PAGEUP: From 677b9d21ea41dcacfe7856a43fac1a1e888b5e05 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Wed, 29 Jan 2020 01:31:40 +0700 Subject: [PATCH 017/329] Test moving the grid cursor using End key for wxGrid --- tests/controls/gridtest.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index e9489adde4..80dfee0285 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -74,6 +74,7 @@ private: CPPUNIT_TEST( Cursor ); CPPUNIT_TEST( Selection ); CPPUNIT_TEST( ScrollWhenSelect ); + WXUISIM_TEST( MoveGridCursorUsingEndKey ); CPPUNIT_TEST( AddRowCol ); CPPUNIT_TEST( DeleteAndAddRowCol ); CPPUNIT_TEST( ColumnOrder ); @@ -116,6 +117,7 @@ private: void Cursor(); void Selection(); void ScrollWhenSelect(); + void MoveGridCursorUsingEndKey(); void AddRowCol(); void DeleteAndAddRowCol(); void ColumnOrder(); @@ -620,6 +622,36 @@ void GridTestCase::ScrollWhenSelect() CHECK( m_grid->IsVisible(6, 1) ); } +void GridTestCase::MoveGridCursorUsingEndKey() +{ +#if wxUSE_UIACTIONSIMULATOR + wxUIActionSimulator sim; + + m_grid->AppendCols(10); + + REQUIRE( m_grid->GetGridCursorCol() == 0 ); + REQUIRE( m_grid->GetGridCursorRow() == 0 ); + REQUIRE( m_grid->IsVisible(0, 0) ); + + // Hide the last row. + m_grid->HideRow(9); + // Hide the last column. + m_grid->HideCol(11); + // Move the penult column. + m_grid->SetColPos(10, 5); + + m_grid->SetFocus(); + + sim.KeyDown(WXK_END, wxMOD_CONTROL); + sim.KeyUp(WXK_END, wxMOD_CONTROL); + wxYield(); + + CHECK( m_grid->GetGridCursorRow() == 8 ); + CHECK( m_grid->GetGridCursorCol() == 9 ); + CHECK( m_grid->IsVisible(8, 9) ); +#endif +} + void GridTestCase::AddRowCol() { CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows()); From 6e6eb799c88c1f6dd07636a032510c8e3f06d8b6 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Tue, 28 Jan 2020 02:42:27 +0700 Subject: [PATCH 018/329] Implement wxGrid cells selection for Home and End keys Select cells if Shift is pressed when handling Home and End keys --- src/generic/grid.cpp | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index b48715d05d..4fbe07fb69 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5567,7 +5567,10 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) if ( m_currentCellCoords == wxGridNoCellCoords ) break; - int row = m_currentCellCoords.GetRow(); + const bool useSelectedBlockCorner = + event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords; + int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow() + : m_currentCellCoords.GetRow(); if ( event.ControlDown() ) { row = 0; @@ -5588,8 +5591,17 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; } - ClearSelection(); - GoToCell(row, GetColAt(col)); + if ( event.ShiftDown() ) + { + UpdateBlockBeingSelected(m_currentCellCoords, + wxGridCellCoords(row, col)); + MakeCellVisible(row, col); + } + else + { + ClearSelection(); + GoToCell(row, GetColAt(col)); + } } break; @@ -5598,7 +5610,10 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) if ( m_currentCellCoords == wxGridNoCellCoords ) break; - int row = m_currentCellCoords.GetRow(); + const bool useSelectedBlockCorner = + event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords; + int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow() + : m_currentCellCoords.GetRow(); if ( event.ControlDown() ) { row = m_numRows - 1; @@ -5619,8 +5634,17 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; } - ClearSelection(); - GoToCell(row, GetColAt(col)); + if ( event.ShiftDown() ) + { + UpdateBlockBeingSelected(m_currentCellCoords, + wxGridCellCoords(row, col)); + MakeCellVisible(row, col); + } + else + { + ClearSelection(); + GoToCell(row, GetColAt(col)); + } } break; From 7fa9416fb461668875720693d1f15c52f16f9d47 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Wed, 29 Jan 2020 01:49:51 +0700 Subject: [PATCH 019/329] Test wxGrid cells selection using End key --- tests/controls/gridtest.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 80dfee0285..6d88a72d3c 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -75,6 +75,7 @@ private: CPPUNIT_TEST( Selection ); CPPUNIT_TEST( ScrollWhenSelect ); WXUISIM_TEST( MoveGridCursorUsingEndKey ); + WXUISIM_TEST( SelectUsingEndKey ); CPPUNIT_TEST( AddRowCol ); CPPUNIT_TEST( DeleteAndAddRowCol ); CPPUNIT_TEST( ColumnOrder ); @@ -118,6 +119,7 @@ private: void Selection(); void ScrollWhenSelect(); void MoveGridCursorUsingEndKey(); + void SelectUsingEndKey(); void AddRowCol(); void DeleteAndAddRowCol(); void ColumnOrder(); @@ -652,6 +654,38 @@ void GridTestCase::MoveGridCursorUsingEndKey() #endif } +void GridTestCase::SelectUsingEndKey() +{ +#if wxUSE_UIACTIONSIMULATOR + wxUIActionSimulator sim; + + m_grid->AppendCols(10); + + REQUIRE( m_grid->GetGridCursorCol() == 0 ); + REQUIRE( m_grid->GetGridCursorRow() == 0 ); + REQUIRE( m_grid->IsVisible(0, 0) ); + + m_grid->SetFocus(); + + sim.KeyDown(WXK_END, wxMOD_CONTROL | wxMOD_SHIFT); + sim.KeyUp(WXK_END, wxMOD_CONTROL | wxMOD_SHIFT); + wxYield(); + + wxGridCellCoordsArray topleft = m_grid->GetSelectionBlockTopLeft(); + wxGridCellCoordsArray bottomright = m_grid->GetSelectionBlockBottomRight(); + + CHECK( topleft.Count() == 1 ); + CHECK( bottomright.Count() == 1 ); + + CHECK( topleft.Item(0).GetCol() == 0 ); + CHECK( topleft.Item(0).GetRow() == 0 ); + CHECK( bottomright.Item(0).GetCol() == 11 ); + CHECK( bottomright.Item(0).GetRow() == 9 ); + + CHECK( m_grid->IsVisible(8, 9) ); +#endif +} + void GridTestCase::AddRowCol() { CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows()); From c7707a16c7f854514268940695ccca44ef52e02f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 1 Feb 2020 01:57:04 +0100 Subject: [PATCH 020/329] Simplify check for current cell in Home/End handling code Prefer to just test whether we have it instead of breaking out of the case if we don't, this is slightly more straightforward. No real changes. --- src/generic/grid.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4fbe07fb69..19359643e7 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5563,10 +5563,8 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; case WXK_HOME: + if ( m_currentCellCoords != wxGridNoCellCoords ) { - if ( m_currentCellCoords == wxGridNoCellCoords ) - break; - const bool useSelectedBlockCorner = event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords; int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow() @@ -5606,10 +5604,8 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; case WXK_END: + if ( m_currentCellCoords != wxGridNoCellCoords ) { - if ( m_currentCellCoords == wxGridNoCellCoords ) - break; - const bool useSelectedBlockCorner = event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords; int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow() From 5b797618a1a5d11fd2934a5e96987e20d8c7c151 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 1 Feb 2020 02:23:05 +0100 Subject: [PATCH 021/329] Merge WXK_HOME and WXK_END handling in a single case There are more commonalities than differences between the handling of these 2 keys and it's better to have a single version of this code. No changes in behaviour. --- src/generic/grid.cpp | 105 +++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 19359643e7..570f8a776c 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5563,71 +5563,66 @@ void wxGrid::OnKeyDown( wxKeyEvent& event ) break; case WXK_HOME: - if ( m_currentCellCoords != wxGridNoCellCoords ) - { - const bool useSelectedBlockCorner = - event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords; - int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow() - : m_currentCellCoords.GetRow(); - if ( event.ControlDown() ) - { - row = 0; - - // Find visible row. - for ( ; row < m_numRows; ++row ) - { - if ( IsRowShown(row) ) - break; - } - } - - int col = 0; - // Find visible column. - for ( ; col < m_numCols; ++col ) - { - if ( IsColShown(GetColAt(col)) ) - break; - } - - if ( event.ShiftDown() ) - { - UpdateBlockBeingSelected(m_currentCellCoords, - wxGridCellCoords(row, col)); - MakeCellVisible(row, col); - } - else - { - ClearSelection(); - GoToCell(row, GetColAt(col)); - } - } - break; - case WXK_END: if ( m_currentCellCoords != wxGridNoCellCoords ) { - const bool useSelectedBlockCorner = - event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords; - int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow() - : m_currentCellCoords.GetRow(); + const bool goToBeginning = event.GetKeyCode() == WXK_HOME; + + // Find the first or last visible row if we need to go to it + // (without Control, we keep the current row). + int row; if ( event.ControlDown() ) { - row = m_numRows - 1; - - // Find visible row. - for ( ; row >= 0; --row ) + if ( goToBeginning ) { - if ( IsRowShown(row) ) - break; + for ( row = 0; row < m_numRows; ++row ) + { + if ( IsRowShown(row) ) + break; + } + } + else + { + for ( row = m_numRows - 1; row >= 0; --row ) + { + if ( IsRowShown(row) ) + break; + } + } + } + else + { + // If we're selecting, continue in the same row, which + // may well be different from the one in which we + // started selecting. + if ( event.ShiftDown() && + m_selectedBlockCorner != wxGridNoCellCoords ) + { + row = m_selectedBlockCorner.GetRow(); + } + else // Just use the current row. + { + row = m_currentCellCoords.GetRow(); } } - int col = m_numCols - 1; - // Find visible column. - for ( ; col >= 0; --col ) + // Also find the last or first visible column in any case. + int col; + if ( goToBeginning ) { - if ( IsColShown(GetColAt(col)) ) - break; + for ( col = 0; col < m_numCols; ++col ) + { + if ( IsColShown(GetColAt(col)) ) + break; + } + } + else + { + for ( col = m_numCols - 1; col >= 0; --col ) + { + if ( IsColShown(GetColAt(col)) ) + break; + } } if ( event.ShiftDown() ) From 0073b54f8eb3b40cf5929beb4b1f82001d534102 Mon Sep 17 00:00:00 2001 From: flederwiesel Date: Sun, 2 Feb 2020 00:13:55 +0100 Subject: [PATCH 022/329] Pass CPPFLAGS to cpp when generating rcdefs.h Honour user-defined CPPFLAGS when creating rcdefs.h, this notably fixes generating the file with wrong architecture when cross-compiling from 64 to 32 bits with CPPFLAGS=-m32. Closes #17844. --- build/bakefiles/wx.bkl | 2 +- build/msw/makefile.bcc | 2 +- build/msw/makefile.gcc | 2 +- build/msw/makefile.vc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/bakefiles/wx.bkl b/build/bakefiles/wx.bkl index 9c7b419b40..fe5f922871 100644 --- a/build/bakefiles/wx.bkl +++ b/build/bakefiles/wx.bkl @@ -205,7 +205,7 @@ $(SRCDIR)/include/wx/msw/genrcdefs.h - $(DOLLAR)(CPP) "$(nativePaths(SRCDIR))\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" + $(DOLLAR)(CPP) $(DOLLAR)(CPPFLAGS) "$(nativePaths(SRCDIR))\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index fefb2ee256..a7690d7647 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -5580,7 +5580,7 @@ $(SETUPHDIR)\wx\msw: $(SETUPHDIR)\wx if not exist $(SETUPHDIR)\wx\msw mkdir $(SETUPHDIR)\wx\msw $(SETUPHDIR)\wx\msw\rcdefs.h: $(SETUPHDIR)\wx\msw ..\..\include\wx\msw\genrcdefs.h - $(CPP) "..\..\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" + $(CPP) $(CPPFLAGS) "..\..\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" build_cfg_file: $(SETUPHDIR) @echo WXVER_MAJOR=3 >$(BUILD_CFG_FILE) diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index c1c27dcc5f..908cae4338 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -5885,7 +5885,7 @@ $(SETUPHDIR)\wx\msw: $(SETUPHDIR)\wx if not exist $(SETUPHDIR)\wx\msw mkdir $(SETUPHDIR)\wx\msw $(SETUPHDIR)\wx\msw\rcdefs.h: $(SETUPHDIR)\wx\msw ..\..\include\wx\msw\genrcdefs.h - $(CPP) "..\..\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" + $(CPP) $(CPPFLAGS) "..\..\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" build_cfg_file: $(SETUPHDIR) @echo WXVER_MAJOR=3 >$(BUILD_CFG_FILE) diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 8f828728ba..c679224f48 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -6331,7 +6331,7 @@ $(SETUPHDIR)\wx\msw: $(SETUPHDIR)\wx if not exist $(SETUPHDIR)\wx\msw mkdir $(SETUPHDIR)\wx\msw $(SETUPHDIR)\wx\msw\rcdefs.h: $(SETUPHDIR)\wx\msw ..\..\include\wx\msw\genrcdefs.h - $(CPP) "..\..\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" + $(CPP) $(CPPFLAGS) "..\..\include\wx\msw\genrcdefs.h" > "$(SETUPHDIR)\wx\msw\rcdefs.h" build_cfg_file: $(SETUPHDIR) @echo WXVER_MAJOR=3 >$(BUILD_CFG_FILE) From 6724f8c0523ad4b14ea04dc2977013f6ff8c7589 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 Feb 2020 01:12:28 +0100 Subject: [PATCH 023/329] Work around MSVS 2012 bug with handling of nullptr Avoid error C2180 given by this compiler for if statements with controlling expression of type nullptr_t. --- include/wx/wxcrt.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index e8bdc628c2..9f17dc759b 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -858,7 +858,8 @@ template<> struct wxStrtoxCharType template inline double wxStrtod(const wxString& nptr, T endptr) { - if (endptr) + // Explicit comparison with 0 required when using T=nullptr with MSVS 2012. + if (endptr != 0) { // note that it is important to use c_str() here and not mb_str() or // wc_str(), because we store the pointer into (possibly converted) From 8e2f674c0bc8a3f7c62de608bcb6a3319af364b0 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 2 Feb 2020 14:50:57 +0100 Subject: [PATCH 024/329] Remove trailing whitespace --- include/wx/graphics.h | 42 ++++++++++++++++++++--------------------- src/msw/graphics.cpp | 4 ++-- src/msw/graphicsd2d.cpp | 32 +++++++++++++++---------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/include/wx/graphics.h b/include/wx/graphics.h index 415b8c9e83..b2d26c386a 100644 --- a/include/wx/graphics.h +++ b/include/wx/graphics.h @@ -371,11 +371,11 @@ public: wxGraphicsPenInfo& Width(wxDouble width) { m_width = width; return *this; } - wxGraphicsPenInfo& + wxGraphicsPenInfo& LinearGradient(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxColour& c1, const wxColour& c2, const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) - { + { m_gradientType = wxGRADIENT_LINEAR; m_x1 = x1; m_y1 = y1; @@ -384,14 +384,14 @@ public: m_stops.SetStartColour(c1); m_stops.SetEndColour(c2); m_matrix = matrix; - return *this; - } + return *this; + } - wxGraphicsPenInfo& + wxGraphicsPenInfo& LinearGradient(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, const wxGraphicsGradientStops& stops, const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) - { + { m_gradientType = wxGRADIENT_LINEAR; m_x1 = x1; m_y1 = y1; @@ -399,42 +399,42 @@ public: m_y2 = y2; m_stops = stops; m_matrix = matrix; - return *this; + return *this; } - wxGraphicsPenInfo& + wxGraphicsPenInfo& RadialGradient(wxDouble startX, wxDouble startY, - wxDouble endX, wxDouble endY, wxDouble radius, + wxDouble endX, wxDouble endY, wxDouble radius, const wxColour& oColor, const wxColour& cColor, const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) - { + { m_gradientType = wxGRADIENT_RADIAL; m_x1 = startX; - m_y1 = startY; - m_x2 = endX; + m_y1 = startY; + m_x2 = endX; m_y2 = endY; m_radius = radius; m_stops.SetStartColour(oColor); m_stops.SetEndColour(cColor); m_matrix = matrix; - return *this; - } + return *this; + } - wxGraphicsPenInfo& + wxGraphicsPenInfo& RadialGradient(wxDouble startX, wxDouble startY, - wxDouble endX, wxDouble endY, + wxDouble endX, wxDouble endY, wxDouble radius, const wxGraphicsGradientStops& stops, const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix) - { + { m_gradientType = wxGRADIENT_RADIAL; - m_x1 = startX; - m_y1 = startY; - m_x2 = endX; + m_x1 = startX; + m_y1 = startY; + m_x2 = endX; m_y2 = endY; m_radius = radius; m_stops = stops; m_matrix = matrix; - return *this; + return *this; } // Accessors diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index 4af45bb4b0..14342a7dad 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -745,7 +745,7 @@ wxGDIPlusPenBrushBaseData::CreateLinearGradientBrush( } SetGradientStops(brush, stops); - m_brush = brush; + m_brush = brush; } void @@ -769,7 +769,7 @@ wxGDIPlusPenBrushBaseData::CreateRadialGradientBrush( brush->SetSurroundColors(&col, &count); // TODO: There doesn't seem to be an equivallent for SetWrapMode, so - // the area outside of the gradient's radius is not getting painted. + // the area outside of the gradient's radius is not getting painted. // Apply the matrix if there is one if ( !matrix.IsNull() ) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index b84bfa0d1d..6f17fcf308 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -1890,7 +1890,7 @@ void wxD2DPathData::Transform(const wxGraphicsMatrixData* matrix) // constraints this can be fully done only if open figure was empty. // So, Transform() can be safely called if path doesn't contain the open // sub-path or if open sub-path is empty. - + // Close current geometry. Flush(); @@ -2427,15 +2427,15 @@ public: const wxDouble y2; const wxGraphicsGradientStops stops; const wxGraphicsMatrix matrix; - LinearGradientInfo(wxDouble& x1_, wxDouble& y1_, - wxDouble& x2_, wxDouble& y2_, + LinearGradientInfo(wxDouble& x1_, wxDouble& y1_, + wxDouble& x2_, wxDouble& y2_, const wxGraphicsGradientStops& stops_, const wxGraphicsMatrix& matrix_) : x1(x1_), y1(y1_), x2(x2_), y2(y2_), stops(stops_), matrix(matrix_) {} }; - wxD2DLinearGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, - wxDouble& x2, wxDouble& y2, + wxD2DLinearGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, + wxDouble& x2, wxDouble& y2, const wxGraphicsGradientStops& stops, const wxGraphicsMatrix& matrix) : m_linearGradientInfo(x1, y1, x2, y2, stops, matrix) {} @@ -2478,17 +2478,17 @@ public: const wxGraphicsGradientStops stops; const wxGraphicsMatrix matrix; - RadialGradientInfo(wxDouble x1_, wxDouble y1_, - wxDouble x2_, wxDouble y2_, - wxDouble r, + RadialGradientInfo(wxDouble x1_, wxDouble y1_, + wxDouble x2_, wxDouble y2_, + wxDouble r, const wxGraphicsGradientStops& stops_, const wxGraphicsMatrix& matrix_) : x1(x1_), y1(y1_), x2(x2_), y2(y2_), radius(r), stops(stops_), matrix(matrix_) {} }; - wxD2DRadialGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, - wxDouble& x2, wxDouble& y2, - wxDouble& r, + wxD2DRadialGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, + wxDouble& x2, wxDouble& y2, + wxDouble& r, const wxGraphicsGradientStops& stops, const wxGraphicsMatrix& matrix) : m_radialGradientInfo(x1, y1, x2, y2, r, stops, matrix) {} @@ -2535,14 +2535,14 @@ public: wxD2DBrushData(wxGraphicsRenderer* renderer); - void CreateLinearGradientBrush(wxDouble x1, wxDouble y1, - wxDouble x2, wxDouble y2, + void CreateLinearGradientBrush(wxDouble x1, wxDouble y1, + wxDouble x2, wxDouble y2, const wxGraphicsGradientStops& stops, const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix); - void CreateRadialGradientBrush(wxDouble startX, wxDouble startY, - wxDouble endX, wxDouble endY, - wxDouble radius, + void CreateRadialGradientBrush(wxDouble startX, wxDouble startY, + wxDouble endX, wxDouble endY, + wxDouble radius, const wxGraphicsGradientStops& stops, const wxGraphicsMatrix& matrix = wxNullGraphicsMatrix); From 95d3064a6b7877f007f701176855c31348447d3d Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 2 Feb 2020 14:53:16 +0100 Subject: [PATCH 025/329] Fix reference count in D2D renderer gradient brushes Closes #18656. --- src/msw/graphicsd2d.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 6f17fcf308..11df206206 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -2444,23 +2444,21 @@ protected: void DoAcquireResource() wxOVERRIDE { wxD2DGradientStopsHelper helper(m_linearGradientInfo.stops, GetContext()); - ID2D1LinearGradientBrush *linearGradientBrush; HRESULT hr = GetContext()->CreateLinearGradientBrush( D2D1::LinearGradientBrushProperties( D2D1::Point2F(m_linearGradientInfo.x1, m_linearGradientInfo.y1), D2D1::Point2F(m_linearGradientInfo.x2, m_linearGradientInfo.y2)), helper.GetGradientStopCollection(), - &linearGradientBrush); + &m_nativeResource); wxCHECK_HRESULT_RET(hr); if (! m_linearGradientInfo.matrix.IsNull()) { D2D1::Matrix3x2F matrix = wxGetD2DMatrixData(m_linearGradientInfo.matrix)->GetMatrix3x2F(); matrix.Invert(); - linearGradientBrush->SetTransform(matrix); + m_nativeResource->SetTransform(matrix); } - m_nativeResource = linearGradientBrush; } private: const LinearGradientInfo m_linearGradientInfo; @@ -2497,7 +2495,6 @@ protected: void DoAcquireResource() wxOVERRIDE { wxD2DGradientStopsHelper helper(m_radialGradientInfo.stops, GetContext()); - ID2D1RadialGradientBrush *radialGradientBrush; wxDouble xo = m_radialGradientInfo.x1 - m_radialGradientInfo.x2; wxDouble yo = m_radialGradientInfo.y1 - m_radialGradientInfo.y2; @@ -2508,16 +2505,15 @@ protected: D2D1::Point2F(xo, yo), m_radialGradientInfo.radius, m_radialGradientInfo.radius), helper.GetGradientStopCollection(), - &radialGradientBrush); + &m_nativeResource); wxCHECK_HRESULT_RET(hr); if (! m_radialGradientInfo.matrix.IsNull()) { D2D1::Matrix3x2F matrix = wxGetD2DMatrixData(m_radialGradientInfo.matrix)->GetMatrix3x2F(); matrix.Invert(); - radialGradientBrush->SetTransform(matrix); + m_nativeResource->SetTransform(matrix); } - m_nativeResource = radialGradientBrush; } private: From 948ddc6e0f76fb69ddc17859c29a821290a7969f Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 2 Feb 2020 22:50:32 -0800 Subject: [PATCH 026/329] Eliminate -Wcast-qual warnings with GCC and Clang Use const_cast, mutable, and various other changes to avoid -Wcast-qual --- include/wx/confbase.h | 2 +- include/wx/dataview.h | 2 +- include/wx/dynarray.h | 2 +- include/wx/generic/dcpsg.h | 4 +-- include/wx/gtk/spinctrl.h | 4 +-- include/wx/list.h | 8 ++++-- include/wx/msw/dde.h | 11 ++++---- include/wx/msw/dib.h | 2 +- include/wx/msw/registry.h | 2 +- include/wx/msw/winundef.h | 4 +-- include/wx/osx/core/cfref.h | 2 +- include/wx/ownerdrw.h | 12 ++++----- include/wx/propgrid/propgridiface.h | 2 +- include/wx/propgrid/propgridpagestate.h | 2 +- include/wx/stringimpl.h | 7 ++--- include/wx/thread.h | 6 ++--- include/wx/window.h | 2 +- include/wx/wxcrt.h | 4 +-- samples/artprov/artbrows.cpp | 2 +- samples/dataview/mymodels.cpp | 2 +- samples/dnd/dnd.cpp | 2 +- samples/dragimag/dragimag.h | 4 +-- samples/propgrid/tests.cpp | 4 +-- samples/text/text.cpp | 4 +-- src/common/config.cpp | 2 +- src/common/encconv.cpp | 2 +- src/common/file.cpp | 3 ++- src/common/filename.cpp | 2 +- src/common/fontcmn.cpp | 2 +- src/common/image.cpp | 4 +-- src/common/imagiff.cpp | 12 ++++----- src/common/list.cpp | 6 ++--- src/common/menucmn.cpp | 2 +- src/common/prntbase.cpp | 2 +- src/common/selectdispatcher.cpp | 4 +-- src/common/strconv.cpp | 6 ++--- src/common/stream.cpp | 2 +- src/common/translation.cpp | 9 ++++--- src/common/variant.cpp | 2 +- src/common/wincmn.cpp | 19 +++++++------- src/common/wxcrt.cpp | 2 +- src/common/zipstrm.cpp | 2 +- src/common/zstream.cpp | 6 ++--- src/generic/accel.cpp | 2 +- src/generic/datavgen.cpp | 4 +-- src/generic/dcpsg.cpp | 9 ++----- src/generic/graphicc.cpp | 8 +++--- src/generic/grid.cpp | 4 +-- src/generic/hyperlinkg.cpp | 2 +- src/generic/icon.cpp | 2 +- src/gtk/assertdlg_gtk.cpp | 18 ++++--------- src/gtk/brush.cpp | 2 +- src/gtk/button.cpp | 2 +- src/gtk/clipbrd.cpp | 4 +-- src/gtk/dcclient.cpp | 6 ++--- src/gtk/dirdlg.cpp | 11 +++----- src/gtk/filedlg.cpp | 13 +++------- src/gtk/menu.cpp | 2 ++ src/gtk/msgdlg.cpp | 20 ++++----------- src/gtk/pen.cpp | 6 ++--- src/gtk/spinbutt.cpp | 4 +-- src/gtk/spinctrl.cpp | 18 +++++-------- src/gtk/textctrl.cpp | 2 +- src/gtk/window.cpp | 2 +- src/html/helpwnd.cpp | 2 +- src/html/htmlpars.cpp | 4 +-- src/html/htmltag.cpp | 4 +-- src/html/m_image.cpp | 16 +++++------- src/msw/dc.cpp | 6 ++--- src/msw/dde.cpp | 8 +++--- src/msw/dib.cpp | 4 +-- src/msw/dirdlg.cpp | 2 +- src/msw/enhmeta.cpp | 4 +-- src/msw/imaglist.cpp | 6 ++--- src/msw/mediactrl_qt.cpp | 2 +- src/msw/notebook.cpp | 2 +- src/msw/ole/activex.cpp | 2 +- src/msw/ole/automtn.cpp | 2 +- src/msw/ole/dataobj.cpp | 4 +-- src/msw/ole/uuid.cpp | 2 +- src/msw/progdlg.cpp | 2 +- src/msw/regconf.cpp | 8 +++--- src/msw/region.cpp | 4 +-- src/msw/registry.cpp | 8 ++---- src/msw/toplevel.cpp | 2 +- src/msw/utils.cpp | 4 +-- src/msw/utilsexc.cpp | 2 +- src/osx/carbon/font.cpp | 2 +- src/osx/carbon/metafile.cpp | 5 ++-- src/osx/core/bitmap.cpp | 12 ++++----- src/osx/core/display.cpp | 4 +-- src/osx/core/printmac.cpp | 4 +-- src/osx/core/strconv_cf.cpp | 2 +- src/osx/fswatcher_fsevents.cpp | 2 +- src/osx/pen.cpp | 2 +- src/osx/utils_osx.cpp | 2 +- src/osx/window_osx.cpp | 2 +- src/propgrid/editors.cpp | 3 ++- src/propgrid/manager.cpp | 2 +- src/propgrid/propgrid.cpp | 4 +-- src/propgrid/propgridpagestate.cpp | 6 ++--- src/ribbon/panel.cpp | 16 ++++++------ src/richtext/richtextbuffer.cpp | 34 ++++++++++++------------- src/richtext/richtextctrl.cpp | 8 +++--- src/richtext/richtextstyles.cpp | 4 +-- src/unix/dialup.cpp | 2 +- src/unix/fontenum.cpp | 6 +++-- src/unix/glx11.cpp | 2 +- src/unix/mediactrl_gstplayer.cpp | 6 +++-- src/unix/mimetype.cpp | 2 +- src/unix/sound.cpp | 2 +- src/unix/threadpsx.cpp | 8 +++--- src/unix/utilsunx.cpp | 2 +- tests/mbconv/mbconvtest.cpp | 2 +- tests/strings/unicode.cpp | 4 +-- 115 files changed, 273 insertions(+), 303 deletions(-) diff --git a/include/wx/confbase.h b/include/wx/confbase.h index 714e3d0092..7188f50790 100644 --- a/include/wx/confbase.h +++ b/include/wx/confbase.h @@ -211,7 +211,7 @@ public: if ( !found ) { if (IsRecordingDefaults()) - ((wxConfigBase *)this)->Write(key, defVal); + const_cast(this)->Write(key, defVal); *value = defVal; } return found; diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 6558cd05c2..52c2f98cea 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -1218,7 +1218,7 @@ public: { return m_data; } wxDataViewItem GetItem() const - { return wxDataViewItem( (void*) this ); } + { return wxDataViewItem(const_cast(static_cast(this))); } virtual bool IsContainer() { return false; } diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index c5cb138e64..23be3289be 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -391,7 +391,7 @@ public: void Insert(const T* pItem, size_t uiIndex) { - base::insert(this->begin() + uiIndex, (T*)pItem); + base::insert(this->begin() + uiIndex, pItem); } void Empty() { DoEmpty(); base::clear(); } diff --git a/include/wx/generic/dcpsg.h b/include/wx/generic/dcpsg.h index 84f9e6690e..b26cde59f7 100644 --- a/include/wx/generic/dcpsg.h +++ b/include/wx/generic/dcpsg.h @@ -152,8 +152,8 @@ protected: unsigned char m_currentBlue; int m_pageNumber; bool m_clipping; - double m_underlinePosition; - double m_underlineThickness; + mutable double m_underlinePosition; + mutable double m_underlineThickness; wxPrintData m_printData; double m_pageHeight; wxArrayString m_definedPSFonts; diff --git a/include/wx/gtk/spinctrl.h b/include/wx/gtk/spinctrl.h index 0b96827dd6..60e464c85a 100644 --- a/include/wx/gtk/spinctrl.h +++ b/include/wx/gtk/spinctrl.h @@ -68,8 +68,8 @@ protected: void DoSetRange(double min_val, double max_val); void DoSetIncrement(double inc); - void GtkDisableEvents() const; - void GtkEnableEvents() const; + void GtkDisableEvents(); + void GtkEnableEvents(); // Update the number of digits used to match our range (and base). void GtkSetEntryWidth(); diff --git a/include/wx/list.h b/include/wx/list.h index 3c3ddd896e..40f5b79341 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -483,7 +483,8 @@ public: wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item // kludge for typesafe list migration in core classes. - wxDEPRECATED( operator wxList&() const ); + wxDEPRECATED( operator wxList&() ); + wxDEPRECATED( operator const wxList&() const ); #endif // wxLIST_COMPATIBILITY protected: @@ -1147,7 +1148,6 @@ inline int wxListBase::Number() const { return (int)GetCount(); } inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); } inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); } inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); } -inline wxListBase::operator wxList&() const { return *(wxList*)this; } #endif @@ -1200,6 +1200,10 @@ public: #if !wxUSE_STD_CONTAINERS +// wxListBase deprecated methods +inline wxListBase::operator wxList&() { return *static_cast(this); } +inline wxListBase::operator const wxList&() const { return *static_cast(this); } + // ----------------------------------------------------------------------------- // wxStringList class for compatibility with the old code // ----------------------------------------------------------------------------- diff --git a/include/wx/msw/dde.h b/include/wx/msw/dde.h index a7cd04ccda..64ec55677a 100644 --- a/include/wx/msw/dde.h +++ b/include/wx/msw/dde.h @@ -87,10 +87,11 @@ public: // Find/delete wxDDEConnection corresponding to the HCONV wxDDEConnection *FindConnection(WXHCONV conv); bool DeleteConnection(WXHCONV conv); - wxString& GetServiceName() const { return (wxString&) m_serviceName; } + wxString& GetServiceName() { return m_serviceName; } + const wxString& GetServiceName() const { return m_serviceName; } - wxDDEConnectionList& GetConnections() const - { return (wxDDEConnectionList&) m_connections; } + wxDDEConnectionList& GetConnections() { return m_connections; } + const wxDDEConnectionList& GetConnections() const { return m_connections; } protected: int m_lastError; @@ -120,8 +121,8 @@ public: wxDDEConnection *FindConnection(WXHCONV conv); bool DeleteConnection(WXHCONV conv); - wxDDEConnectionList& GetConnections() const - { return (wxDDEConnectionList&) m_connections; } + wxDDEConnectionList& GetConnections() { return m_connections; } + const wxDDEConnectionList& GetConnections() const { return m_connections; } protected: int m_lastError; diff --git a/include/wx/msw/dib.h b/include/wx/msw/dib.h index 6fb4c3eca3..3b068879bc 100644 --- a/include/wx/msw/dib.h +++ b/include/wx/msw/dib.h @@ -122,7 +122,7 @@ public: // non NULL) static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, HDC hdc = 0, - void *bits = NULL); + const void *bits = NULL); // create a plain DIB (not a DIB section) from a DDB, the caller is // responsable for freeing it using ::GlobalFree() diff --git a/include/wx/msw/registry.h b/include/wx/msw/registry.h index f3925f97bf..783706f4e4 100644 --- a/include/wx/msw/registry.h +++ b/include/wx/msw/registry.h @@ -263,7 +263,7 @@ private: wxString m_strKey; // key name (relative to m_hRootKey) WOW64ViewMode m_viewMode; // which view to select under WOW64 AccessMode m_mode; // valid only if key is opened - long m_dwLastError; // last error (0 if none) + mutable long m_dwLastError; // last error (0 if none) wxDECLARE_NO_COPY_CLASS(wxRegKey); diff --git a/include/wx/msw/winundef.h b/include/wx/msw/winundef.h index aedf4340d3..879a6ef626 100644 --- a/include/wx/msw/winundef.h +++ b/include/wx/msw/winundef.h @@ -263,12 +263,12 @@ #if wxUSE_UNICODE_WINDOWS_H inline int StartDoc(HDC h, CONST DOCINFOW* info) { - return StartDocW(h, (DOCINFOW*) info); + return StartDocW(h, const_cast(info)); } #else inline int StartDoc(HDC h, CONST DOCINFOA* info) { - return StartDocA(h, (DOCINFOA*) info); + return StartDocA(h, const_cast(info); } #endif #endif diff --git a/include/wx/osx/core/cfref.h b/include/wx/osx/core/cfref.h index 56a0697f3f..4a258ba21b 100644 --- a/include/wx/osx/core/cfref.h +++ b/include/wx/osx/core/cfref.h @@ -66,7 +66,7 @@ inline Type* wxCFRetain(Type *r) // Casting r to CFTypeRef ensures we are calling the real C version defined in CFBase.h // and not any possibly templated/overloaded CFRetain. if ( r != NULL ) - r = (Type*)::CFRetain((CFTypeRef)r); + r = const_cast(static_cast(::CFRetain(static_cast(r)))); return r; } diff --git a/include/wx/ownerdrw.h b/include/wx/ownerdrw.h index 7ae3b71cb4..4dfc30b47c 100644 --- a/include/wx/ownerdrw.h +++ b/include/wx/ownerdrw.h @@ -43,21 +43,21 @@ public: void SetFont(const wxFont& font) { m_font = font; m_ownerDrawn = true; } - wxFont& GetFont() const - { return (wxFont&) m_font; } + wxFont& GetFont() { return m_font; } + const wxFont& GetFont() const { return m_font; } void SetTextColour(const wxColour& colText) { m_colText = colText; m_ownerDrawn = true; } - wxColour& GetTextColour() const - { return (wxColour&) m_colText; } + wxColour& GetTextColour() { return m_colText; } + const wxColour& GetTextColour() const { return m_colText; } void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_ownerDrawn = true; } - wxColour& GetBackgroundColour() const - { return (wxColour&) m_colBack ; } + wxColour& GetBackgroundColour() { return m_colBack; } + const wxColour& GetBackgroundColour() const { return m_colBack ; } void SetMarginWidth(int width) diff --git a/include/wx/propgrid/propgridiface.h b/include/wx/propgrid/propgridiface.h index 2235ff1090..955b935779 100644 --- a/include/wx/propgrid/propgridiface.h +++ b/include/wx/propgrid/propgridiface.h @@ -27,7 +27,7 @@ class WXDLLIMPEXP_PROPGRID wxPGPropArgCls public: wxPGPropArgCls( const wxPGProperty* property ) { - m_ptr.property = (wxPGProperty*) property; + m_ptr.property = const_cast(property); m_flags = IsProperty; } wxPGPropArgCls( const wxString& str ) diff --git a/include/wx/propgrid/propgridpagestate.h b/include/wx/propgrid/propgridpagestate.h index e2b2777eef..7f5f25bb57 100644 --- a/include/wx/propgrid/propgridpagestate.h +++ b/include/wx/propgrid/propgridpagestate.h @@ -571,7 +571,7 @@ protected: // Returns property by its label. wxPGProperty* BaseGetPropertyByLabel( const wxString& label, - wxPGProperty* parent = NULL ) const; + const wxPGProperty* parent = NULL ) const; // Unselect sub-properties. void DoRemoveChildrenFromSelection(wxPGProperty* p, bool recursive, diff --git a/include/wx/stringimpl.h b/include/wx/stringimpl.h index e46bb800de..d10242e7a4 100644 --- a/include/wx/stringimpl.h +++ b/include/wx/stringimpl.h @@ -105,7 +105,8 @@ struct WXDLLIMPEXP_BASE wxStringData nAllocLength; // allocated memory size // mimics declaration 'wxStringCharType data[nAllocLength]' - wxStringCharType* data() const { return (wxStringCharType*)(this + 1); } + wxStringCharType* data() { return reinterpret_cast(this + 1); } + const wxStringCharType* data() const { return reinterpret_cast(this + 1); } // empty string has a special ref count so it's never deleted bool IsEmpty() const { return (nRefs == -1); } @@ -151,9 +152,9 @@ protected: // initializes the string to the empty value (must be called only from // ctors, use Reinit() otherwise) #if wxUSE_UNICODE_UTF8 - void Init() { m_pchData = (wxStringCharType *)wxEmptyStringImpl; } // FIXME-UTF8 + void Init() { m_pchData = const_cast(wxEmptyStringImpl); } // FIXME-UTF8 #else - void Init() { m_pchData = (wxStringCharType *)wxEmptyString; } + void Init() { m_pchData = const_cast(wxEmptyString); } #endif // initializes the string with (a part of) C-string void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos); diff --git a/include/wx/thread.h b/include/wx/thread.h index 5a0ac27514..872609ca30 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -640,7 +640,7 @@ private: wxThreadInternal *m_internal; // protects access to any methods of wxThreadInternal object - wxCriticalSection m_critsect; + mutable wxCriticalSection m_critsect; // true if the thread is detached, false if it is joinable bool m_isDetached; @@ -731,7 +731,7 @@ public: // returns a pointer to the thread which can be used to call Run() wxThread *GetThread() const { - wxCriticalSectionLocker locker((wxCriticalSection&)m_critSection); + wxCriticalSectionLocker locker(m_critSection); wxThread* thread = m_thread; @@ -741,7 +741,7 @@ public: protected: wxThread *m_thread; wxThreadKind m_kind; - wxCriticalSection m_critSection; // To guard the m_thread variable + mutable wxCriticalSection m_critSection; // To guard the m_thread variable friend class wxThreadHelperThread; }; diff --git a/include/wx/window.h b/include/wx/window.h index 92cd592644..22fc655a4b 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -1032,7 +1032,7 @@ public: // does this window have the capture? virtual bool HasCapture() const - { return (wxWindow *)this == GetCapture(); } + { return reinterpret_cast(this) == GetCapture(); } // enable the specified touch events for this window, return false if // the requested events are not supported diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index 9f17dc759b..d239f6cfeb 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -110,7 +110,7 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); // (notice that these intentionally return "char *" and not "void *" unlike the // standard memxxx() for symmetry with the wide char versions): inline char* wxTmemchr(const char* s, char c, size_t len) - { return (char*)memchr(s, c, len); } + { return const_cast(static_cast(memchr(s, c, len))); } inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len) { return memcmp(sz1, sz2, len); } inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len) @@ -727,7 +727,7 @@ inline char * wxStrchr(char *s, T c) { return const_cast(wxStrchr(const_cast(s), c)); } template inline wchar_t * wxStrchr(wchar_t *s, T c) - { return (wchar_t *)wxStrchr((const wchar_t *)s, c); } + { return const_cast(wxStrchr(const_cast(s), c)); } template inline char * wxStrrchr(char *s, T c) { return const_cast(wxStrrchr(const_cast(s), c)); } diff --git a/samples/artprov/artbrows.cpp b/samples/artprov/artbrows.cpp index ea0b9944da..e9b464bb87 100644 --- a/samples/artprov/artbrows.cpp +++ b/samples/artprov/artbrows.cpp @@ -28,7 +28,7 @@ #include "artbrows.h" #define ART_CLIENT(id) \ - choice->Append(#id, (void*)id); + choice->Append(#id, const_cast(static_cast(id))); #define ART_ICON(id) \ { \ int ind; \ diff --git a/samples/dataview/mymodels.cpp b/samples/dataview/mymodels.cpp index 75f375d817..9c5ee3112b 100644 --- a/samples/dataview/mymodels.cpp +++ b/samples/dataview/mymodels.cpp @@ -292,7 +292,7 @@ unsigned int MyMusicTreeModel::GetChildren( const wxDataViewItem &parent, if (node == m_classical) { - MyMusicTreeModel *model = (MyMusicTreeModel*)(const MyMusicTreeModel*) this; + MyMusicTreeModel* model = const_cast(this); model->m_classicalMusicIsKnownToControl = true; } diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index daa78a4a25..74e2e1ffb6 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -2022,7 +2022,7 @@ void DnDShapeDataObject::CreateBitmap() const m_shape->Draw(dc); dc.SelectObject(wxNullBitmap); - DnDShapeDataObject *self = (DnDShapeDataObject *)this; // const_cast + DnDShapeDataObject* self = const_cast(this); self->m_dobjBitmap.SetBitmap(bitmap); self->m_hasBitmap = true; } diff --git a/samples/dragimag/dragimag.h b/samples/dragimag/dragimag.h index c3ec6aef6b..53036676e1 100644 --- a/samples/dragimag/dragimag.h +++ b/samples/dragimag/dragimag.h @@ -53,7 +53,7 @@ public: bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap); //// Accessors - wxBitmap& GetBackgroundBitmap() const { return (wxBitmap&) m_background; } + const wxBitmap& GetBackgroundBitmap() const { return m_background; } bool GetUseScreen() const { return m_useScreen; } void SetUseScreen(bool useScreen) { m_useScreen = useScreen; } @@ -136,7 +136,7 @@ public: wxRect GetRect() const { return wxRect(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight()); } - wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; } + const wxBitmap& GetBitmap() const { return m_bitmap; } void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; } int GetDragMethod() const { return m_dragMethod; } diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index cfdffeb8fd..3edada4d52 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -634,7 +634,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pgman->SetPropertyValue("ArrayStringProperty",test_arrstr_1); wxColour emptyCol; pgman->SetPropertyValue("ColourProperty",emptyCol); - pgman->SetPropertyValue("ColourProperty",(wxObject*)wxBLACK); + pgman->SetPropertyValue("ColourProperty", const_cast(static_cast(wxBLACK))); pgman->SetPropertyValue("Size",WXVARIANT(wxSize(150,150))); pgman->SetPropertyValue("Position",WXVARIANT(wxPoint(150,150))); pgman->SetPropertyValue("MultiChoiceProperty",test_arrint_1); @@ -690,7 +690,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) pg->SetPropertyValue("BoolProperty",true); pg->SetPropertyValue("EnumProperty",80); pg->SetPropertyValue("ArrayStringProperty",test_arrstr_2); - pg->SetPropertyValue("ColourProperty",(wxObject*)wxWHITE); + pg->SetPropertyValue("ColourProperty", const_cast(static_cast(wxWHITE))); pg->SetPropertyValue("Size",WXVARIANT(wxSize(300,300))); pg->SetPropertyValue("Position",WXVARIANT(wxPoint(300,300))); pg->SetPropertyValue("MultiChoiceProperty",test_arrint_2); diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 309c505a95..739483fccb 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -1205,11 +1205,11 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_tab = new MyTextCtrl( this, 100, "Multiline, allow processing.", wxPoint(180,90), wxSize(200,70), wxTE_MULTILINE | wxTE_PROCESS_TAB ); - m_tab->SetClientData((void *)wxS("tab")); + m_tab->SetClientData(const_cast(static_cast(wxS("tab")))); m_enter = new MyTextCtrl( this, 100, "Multiline, allow processing.", wxPoint(180,170), wxSize(200,70), wxTE_MULTILINE | wxTE_PROCESS_ENTER ); - m_enter->SetClientData((void *)wxS("enter")); + m_enter->SetClientData(const_cast(static_cast(wxS("enter")))); m_textrich = new MyTextCtrl(this, wxID_ANY, "Allows more than 30Kb of text\n" "(on all Windows versions)\n" diff --git a/src/common/config.cpp b/src/common/config.cpp index c4382ef656..924ed51c86 100644 --- a/src/common/config.cpp +++ b/src/common/config.cpp @@ -140,7 +140,7 @@ wxConfigBase *wxConfigBase::Create() { \ if ( IsRecordingDefaults() ) \ { \ - ((wxConfigBase *)this)->DoWrite##name(key, defVal); \ + const_cast(this)->DoWrite##name(key, defVal);\ } \ \ *val = defVal; \ diff --git a/src/common/encconv.cpp b/src/common/encconv.cpp index a95c7f7208..b08b063682 100644 --- a/src/common/encconv.cpp +++ b/src/common/encconv.cpp @@ -80,7 +80,7 @@ extern "C" static int wxCMPFUNC_CONV CompareCharsetItems(const void *i1, const void *i2) { - return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u ); + return static_cast(i1)->u - static_cast(i2)->u; } } diff --git a/src/common/file.cpp b/src/common/file.cpp index 9446bb32d9..717f66f334 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -479,7 +479,8 @@ wxFileOffset wxFile::Length() const wxFileOffset iLen = const_cast(this)->SeekEnd(); if ( iLen != wxInvalidOffset ) { // restore old position - if ( ((wxFile *)this)->Seek(iRc) == wxInvalidOffset ) { + if (const_cast(this)->Seek(iRc) == wxInvalidOffset) + { // error iLen = wxInvalidOffset; } diff --git a/src/common/filename.cpp b/src/common/filename.cpp index ea4597078e..474f7fa1c1 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -945,7 +945,7 @@ static wxString wxCreateTempImpl( wxCharBuffer buf(path.fn_str()); // cast is safe because the string length doesn't change - int fdTemp = mkstemp( (char*)(const char*) buf ); + int fdTemp = mkstemp(const_cast(static_cast(buf))); if ( fdTemp == -1 ) { // this might be not necessary as mkstemp() on most systems should have diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index cadf89b1e5..ab2fa540dc 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -261,7 +261,7 @@ int wxFontBase::GetPointSize() const wxSize wxFontBase::GetPixelSize() const { wxScreenDC dc; - dc.SetFont(*(wxFont *)this); + dc.SetFont(*static_cast(this)); return wxSize(dc.GetCharWidth(), dc.GetCharHeight()); } diff --git a/src/common/image.cpp b/src/common/image.cpp index 2bf29a0864..096f823f0c 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -2641,7 +2641,7 @@ bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), #if HAS_FILE_STREAMS wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); - ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); + const_cast(this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); wxImageFileOutputStream stream(filename); @@ -2661,7 +2661,7 @@ bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename), #if HAS_FILE_STREAMS wxCHECK_MSG( IsOk(), false, wxT("invalid image") ); - ((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); + const_cast(this)->SetOption(wxIMAGE_OPTION_FILENAME, filename); wxImageFileOutputStream stream(filename); diff --git a/src/common/imagiff.cpp b/src/common/imagiff.cpp index 032e1526a6..32510b799f 100644 --- a/src/common/imagiff.cpp +++ b/src/common/imagiff.cpp @@ -360,7 +360,7 @@ int wxIFFDecoder::ReadIFF() } // check if we really got an IFF file - if (strncmp((char *)dataptr, "FORM", 4) != 0) { + if (strncmp(reinterpret_cast(dataptr), "FORM", 4) != 0) { Destroy(); return wxIFF_INVFORMAT; } @@ -368,7 +368,7 @@ int wxIFFDecoder::ReadIFF() dataptr = dataptr + 8; // skip ID and length of FORM // check if the IFF file is an ILBM (picture) file - if (strncmp((char *) dataptr, "ILBM", 4) != 0) { + if (strncmp(reinterpret_cast(dataptr), "ILBM", 4) != 0) { Destroy(); return wxIFF_INVFORMAT; } @@ -394,7 +394,7 @@ int wxIFFDecoder::ReadIFF() } bool truncated = (dataptr + 8 + chunkLen > dataend); - if (strncmp((char *)dataptr, "BMHD", 4) == 0) { // BMHD chunk? + if (strncmp(reinterpret_cast(dataptr), "BMHD", 4) == 0) { // BMHD chunk? if (chunkLen < 12 + 2 || truncated) { break; } @@ -407,7 +407,7 @@ int wxIFFDecoder::ReadIFF() BMHDok = true; // got BMHD dataptr += 8 + chunkLen; // to next chunk } - else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ? + else if (strncmp(reinterpret_cast(dataptr), "CMAP", 4) == 0) { // CMAP ? if (truncated) { break; } @@ -435,7 +435,7 @@ int wxIFFDecoder::ReadIFF() colors); dataptr += 8 + chunkLen; // to next chunk - } else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ? + } else if (strncmp(reinterpret_cast(dataptr), "CAMG", 4) == 0) { // CAMG ? if (chunkLen < 4 || truncated) { break; } @@ -443,7 +443,7 @@ int wxIFFDecoder::ReadIFF() CAMGok = true; // got CAMG dataptr += 8 + chunkLen; // to next chunk } - else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ? + else if (strncmp(reinterpret_cast(dataptr), "BODY", 4) == 0) { // BODY ? if (!BMHDok) { // BMHD found? break; } diff --git a/src/common/list.cpp b/src/common/list.cpp index 3b51fce4ff..e5a30cac4a 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -689,10 +689,10 @@ static int LINKAGEMODE wx_comparestrings(const void *arg1, const void *arg2) { - wxChar **s1 = (wxChar **) arg1; - wxChar **s2 = (wxChar **) arg2; + const wxChar* s1 = *static_cast(arg1); + const wxChar* s2 = *static_cast(arg2); - return wxStrcmp (*s1, *s2); + return wxStrcmp(s1, s2); } } // end of extern "C" (required because of GCC Bug c++/33078 diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index d665f18c20..f23aa68322 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -537,7 +537,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const if ( item->GetId() == itemId ) { if ( itemMenu ) - *itemMenu = (wxMenu *)this; + *itemMenu = const_cast(static_cast(this)); } else if ( item->IsSubMenu() ) { diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 7ea4d88441..8794308d95 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -349,7 +349,7 @@ void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout) wxPrintDialogData& wxPrinterBase::GetPrintDialogData() const { - return (wxPrintDialogData&) m_printDialogData; + return const_cast(m_printDialogData); } //---------------------------------------------------------------------------- diff --git a/src/common/selectdispatcher.cpp b/src/common/selectdispatcher.cpp index 13639392e3..6b1f98536f 100644 --- a/src/common/selectdispatcher.cpp +++ b/src/common/selectdispatcher.cpp @@ -78,7 +78,7 @@ bool wxSelectSets::HasFD(int fd) const { for ( int n = 0; n < Max; n++ ) { - if ( wxFD_ISSET(fd, (fd_set*) &m_fds[n]) ) + if ( wxFD_ISSET(fd, const_cast(&m_fds[n])) ) return true; } @@ -113,7 +113,7 @@ bool wxSelectSets::Handle(int fd, wxFDIOHandler& handler) const { for ( int n = 0; n < Max; n++ ) { - if ( wxFD_ISSET(fd, (fd_set*) &m_fds[n]) ) + if ( wxFD_ISSET(fd, const_cast(&m_fds[n])) ) { wxLogTrace(wxSelectDispatcher_Trace, wxT("Got %s event on fd %d"), ms_names[n], fd); diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index e839a3a0d3..ba04f3c144 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -2047,7 +2047,7 @@ wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen, #define ICONV_FAILED(cres, bufLeft) (cres == (size_t)-1) #endif -#define ICONV_CHAR_CAST(x) ((ICONV_CONST char **)(x)) +#define ICONV_CHAR_CAST(x) const_cast(x) #define ICONV_T_INVALID ((iconv_t)-1) @@ -2396,7 +2396,7 @@ size_t wxMBConv_iconv::FromWChar(char *dst, size_t dstLen, src = tmpbuf; } - char* inbuf = (char*)src; + const char* inbuf = reinterpret_cast(src); if ( dst ) { // have destination buffer, convert there @@ -2450,7 +2450,7 @@ size_t wxMBConv_iconv::GetMBNulLen() const char buf[8]; // should be enough for NUL in any encoding size_t inLen = sizeof(wchar_t), outLen = WXSIZEOF(buf); - char *inBuff = (char *)wnul; + const char* inBuff = reinterpret_cast(wnul); char *outBuff = buf; if ( iconv(w2m, ICONV_CHAR_CAST(&inBuff), &inLen, &outBuff, &outLen) == (size_t)-1 ) { diff --git a/src/common/stream.cpp b/src/common/stream.cpp index 97ba7588e7..b5eb381ada 100644 --- a/src/common/stream.cpp +++ b/src/common/stream.cpp @@ -511,7 +511,7 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size) { PutToBuffer(buffer, left); size -= left; - buffer = (char *)buffer + left; + buffer = static_cast(buffer) + left; if ( !FlushBuffer() ) { diff --git a/src/common/translation.cpp b/src/common/translation.cpp index 97162940ac..ee8b586fa0 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -1065,6 +1065,7 @@ private: // data description size_t32 m_numStrings; // number of strings in this domain + const wxMsgTableEntry *m_pOrigTable, // pointer to original strings *m_pTransTable; // translated @@ -1079,7 +1080,7 @@ private: : ui; } - const char *StringAtOfs(wxMsgTableEntry *pTable, size_t32 n) const + const char* StringAtOfs(const wxMsgTableEntry* pTable, size_t32 n) const { const wxMsgTableEntry * const ent = pTable + n; @@ -1155,7 +1156,7 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data, // examine header bool bValid = data.length() > sizeof(wxMsgCatalogHeader); - const wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)data.data(); + const wxMsgCatalogHeader* pHeader = reinterpret_cast(data.data()); if ( bValid ) { // we'll have to swap all the integers if it's true m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW; @@ -1174,9 +1175,9 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data, // initialize m_numStrings = Swap(pHeader->numStrings); - m_pOrigTable = (wxMsgTableEntry *)(data.data() + + m_pOrigTable = reinterpret_cast(data.data() + Swap(pHeader->ofsOrigTable)); - m_pTransTable = (wxMsgTableEntry *)(data.data() + + m_pTransTable = reinterpret_cast(data.data() + Swap(pHeader->ofsTransTable)); // now parse catalog's header and try to extract catalog charset and diff --git a/src/common/variant.cpp b/src/common/variant.cpp index 0362653cc8..d20e539b28 100644 --- a/src/common/variant.cpp +++ b/src/common/variant.cpp @@ -99,7 +99,7 @@ wxObjectRefData *wxVariant::CreateRefData() const wxObjectRefData *wxVariant::CloneRefData(const wxObjectRefData *data) const { - return ((wxVariantData*) data)->Clone(); + return static_cast(data)->Clone(); } // Assignment diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 0b744892fd..9f65f2799b 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -1768,7 +1768,7 @@ void wxWindowBase::SetPalette(const wxPalette& pal) wxWindow *wxWindowBase::GetAncestorWithCustomPalette() const { - wxWindow *win = (wxWindow *)this; + wxWindow* win = const_cast(static_cast(this)); while ( win && !win->HasCustomPalette() ) { win = win->GetParent(); @@ -1858,7 +1858,7 @@ void wxWindowBase::ClearBackground() wxWindow *wxWindowBase::FindWindow(long id) const { if ( id == m_windowId ) - return (wxWindow *)this; + return const_cast(static_cast(this)); wxWindowBase *res = NULL; wxWindowList::compatibility_iterator node; @@ -1874,13 +1874,13 @@ wxWindow *wxWindowBase::FindWindow(long id) const res = child->FindWindow( id ); } - return (wxWindow *)res; + return static_cast(res); } wxWindow *wxWindowBase::FindWindow(const wxString& name) const { if ( name == m_windowName ) - return (wxWindow *)this; + return const_cast(static_cast(this)); wxWindowBase *res = NULL; wxWindowList::compatibility_iterator node; @@ -1895,7 +1895,7 @@ wxWindow *wxWindowBase::FindWindow(const wxString& name) const res = child->FindWindow(name); } - return (wxWindow *)res; + return static_cast(res); } @@ -1939,7 +1939,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent, { // see if this is the one we're looking for if ( (*cmp)(parent, label, id) ) - return (wxWindow *)parent; + return const_cast(parent); // It wasn't, so check all its children for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst(); @@ -1947,7 +1947,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent, node = node->GetNext() ) { // recursively check each child - wxWindow *win = (wxWindow *)node->GetData(); + wxWindow* win = static_cast(node->GetData()); wxWindow *retwin = wxFindWindowRecursively(win, label, id, cmp); if (retwin) return retwin; @@ -2921,7 +2921,8 @@ wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* w) // using them. wxSize wxWindowBase::GetDlgUnitBase() const { - const wxWindowBase* const parent = wxGetTopLevelParent((wxWindow*)this); + const wxWindowBase* const parent = + wxGetTopLevelParent(const_cast(static_cast(this))); wxCHECK_MSG( parent, wxDefaultSize, wxS("Must have TLW parent") ); @@ -3499,7 +3500,7 @@ wxWindow *wxWindowBase::DoGetSibling(WindowOrder order) const wxT("GetPrev/NextSibling() don't work for TLWs!") ); wxWindowList& siblings = GetParent()->GetChildren(); - wxWindowList::compatibility_iterator i = siblings.Find((wxWindow *)this); + wxWindowList::compatibility_iterator i = siblings.Find(this); wxCHECK_MSG( i, NULL, wxT("window not a child of its parent?") ); if ( order == OrderBefore ) diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index d6d2798ab2..f3118375d1 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -908,7 +908,7 @@ wxCRT_StrtoullBase(const T* nptr, T** endptr, int base, T* sign) { // Then it's an error. if ( endptr ) - *endptr = (T*) nptr; + *endptr = const_cast(nptr); errno = EINVAL; return sum; } diff --git a/src/common/zipstrm.cpp b/src/common/zipstrm.cpp index 34ae8e66a4..ff39cba742 100644 --- a/src/common/zipstrm.cpp +++ b/src/common/zipstrm.cpp @@ -2639,7 +2639,7 @@ size_t wxZipOutputStream::OnSysWrite(const void *buffer, size_t size) if (m_comp->Write(buffer, size).LastWrite() != size) m_lasterror = wxSTREAM_WRITE_ERROR; - m_crcAccumulator = crc32(m_crcAccumulator, (Byte*)buffer, size); + m_crcAccumulator = crc32(m_crcAccumulator, static_cast(buffer), size); m_entrySize += m_comp->LastWrite(); return m_comp->LastWrite(); diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index 8ae6c1c466..3b2e4645e6 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -268,7 +268,7 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size) bool wxZlibInputStream::SetDictionary(const char *data, size_t datalen) { - return (inflateSetDictionary(m_inflate, (Bytef*)data, datalen) == Z_OK); + return inflateSetDictionary(m_inflate, reinterpret_cast(data), datalen) == Z_OK; } bool wxZlibInputStream::SetDictionary(const wxMemoryBuffer &buf) @@ -400,7 +400,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size) return 0; int err = Z_OK; - m_deflate->next_in = (unsigned char *)buffer; + m_deflate->next_in = const_cast(static_cast(buffer)); m_deflate->avail_in = size; while (err == Z_OK && m_deflate->avail_in > 0) { @@ -439,7 +439,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size) bool wxZlibOutputStream::SetDictionary(const char *data, size_t datalen) { - return (deflateSetDictionary(m_deflate, (Bytef*)data, datalen) == Z_OK); + return deflateSetDictionary(m_deflate, reinterpret_cast(data), datalen) == Z_OK; } bool wxZlibOutputStream::SetDictionary(const wxMemoryBuffer &buf) diff --git a/src/generic/accel.cpp b/src/generic/accel.cpp index e4382f455d..2174111161 100644 --- a/src/generic/accel.cpp +++ b/src/generic/accel.cpp @@ -213,7 +213,7 @@ wxObjectRefData *wxAcceleratorTable::CreateRefData() const wxObjectRefData *wxAcceleratorTable::CloneRefData(const wxObjectRefData *data) const { - return new wxAccelRefData(*(wxAccelRefData *)data); + return new wxAccelRefData(*static_cast(data)); } #endif // wxUSE_ACCEL diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 042f7216eb..7cf49aefa4 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3913,8 +3913,8 @@ int wxDataViewMainWindow::RecalculateCount() const { if (IsVirtualList()) { - wxDataViewVirtualListModel *list_model = - (wxDataViewVirtualListModel*) GetModel(); + const wxDataViewVirtualListModel* list_model = + static_cast(GetModel()); return list_model->GetCount(); } diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 77b50fbf99..076e535502 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -2253,13 +2253,8 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, /* JC: calculate UnderlineThickness/UnderlinePosition */ - // VS: dirty, but is there any better solution? - double *pt; - pt = (double*) &m_underlinePosition; - *pt = YLOG2DEVREL((wxCoord)(UnderlinePosition * fontSize)) / 1000.0f; - pt = (double*) &m_underlineThickness; - *pt = YLOG2DEVREL((wxCoord)(UnderlineThickness * fontSize)) / 1000.0f; - + m_underlinePosition = YLOG2DEVREL(int(UnderlinePosition * fontSize)) / 1000.0; + m_underlineThickness = YLOG2DEVREL(int(UnderlineThickness * fontSize)) / 1000.0; } diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 9899056c50..a5c6f74ca0 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1020,7 +1020,7 @@ void wxCairoPenData::Apply( wxGraphicsContext* context ) cairo_set_line_width(ctext,m_width); cairo_set_line_cap(ctext,m_cap); cairo_set_line_join(ctext,m_join); - cairo_set_dash(ctext,(double*)m_lengths,m_count,0.0); + cairo_set_dash(ctext, m_lengths, m_count, 0); } //----------------------------------------------------------------------------- @@ -1504,7 +1504,7 @@ void wxCairoMatrixData::TransformDistance( wxDouble *dx, wxDouble *dy ) const // returns the native representation void * wxCairoMatrixData::GetNativeMatrix() const { - return (void*) &m_matrix; + return const_cast(&m_matrix); } // ---------------------------------------------------------------------------- @@ -1954,7 +1954,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC& cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); Init(cr ? cairo_reference(cr) : NULL); #elif defined __WXGTK20__ - wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); + const wxGTKDCImpl* impldc = static_cast(dc.GetImpl()); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); // Transfer transformation settings from source DC to Cairo context on our own. @@ -2167,7 +2167,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC& cairo_t* cr = static_cast(dc.GetImpl()->GetCairoContext()); Init(cr ? cairo_reference(cr) : NULL); #elif defined __WXGTK20__ - wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); + const wxGTKDCImpl* impldc = static_cast(dc.GetImpl()); Init( gdk_cairo_create( impldc->GetGDKWindow() ) ); // Transfer transformation settings from source DC to Cairo context on our own. diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c1dbb96548..047c6f95f2 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -7025,7 +7025,7 @@ bool wxGrid::IsCellEditControlShown() const int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); wxGridCellAttr* attr = GetCellAttr(row, col); - wxGridCellEditor* editor = attr->GetEditor((wxGrid*) this, row, col); + wxGridCellEditor* editor = attr->GetEditor(this, row, col); attr->DecRef(); if ( editor ) @@ -8743,7 +8743,7 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const { wxGridCellAttr *attr = NULL; - bool canHave = ((wxGrid*)this)->CanHaveAttributes(); + const bool canHave = CanHaveAttributes(); wxCHECK_MSG( canHave, attr, wxT("Cell attributes not allowed")); wxCHECK_MSG( m_table, attr, wxT("must have a table") ); diff --git a/src/generic/hyperlinkg.cpp b/src/generic/hyperlinkg.cpp index 133a9371d6..9788fc2422 100644 --- a/src/generic/hyperlinkg.cpp +++ b/src/generic/hyperlinkg.cpp @@ -125,7 +125,7 @@ void wxGenericHyperlinkCtrl::ConnectMenuHandlers() wxSize wxGenericHyperlinkCtrl::DoGetBestClientSize() const { - wxClientDC dc((wxWindow *)this); + wxClientDC dc(const_cast(this)); return dc.GetTextExtent(GetLabel()); } diff --git a/src/generic/icon.cpp b/src/generic/icon.cpp index 53b1c80fee..f7aebe6654 100644 --- a/src/generic/icon.cpp +++ b/src/generic/icon.cpp @@ -41,6 +41,6 @@ wxIcon::wxIcon() : wxBitmap() void wxIcon::CopyFromBitmap(const wxBitmap& bmp) { - wxIcon *icon = (wxIcon*)(&bmp); + const wxIcon* icon = static_cast(&bmp); *this = *icon; } diff --git a/src/gtk/assertdlg_gtk.cpp b/src/gtk/assertdlg_gtk.cpp index b7d90a5f93..a2dbadca85 100644 --- a/src/gtk/assertdlg_gtk.cpp +++ b/src/gtk/assertdlg_gtk.cpp @@ -711,7 +711,7 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) /* icon */ wxGCC_WARNING_SUPPRESS(deprecated-declarations) - image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); + image = gtk_image_new_from_stock("gtk-dialog-error", GTK_ICON_SIZE_DIALOG); wxGCC_WARNING_RESTORE() gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 12); @@ -768,15 +768,11 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) gtk_button_box_set_layout (GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END); /* add the buttons */ - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Save to _file", GTK_STOCK_SAVE); - wxGCC_WARNING_RESTORE() + button = gtk_assert_dialog_add_button_to(GTK_BOX(hbox), "Save to _file", "gtk-save"); g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_save_backtrace_callback), dlg); - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Copy to clip_board", GTK_STOCK_COPY); - wxGCC_WARNING_RESTORE() + button = gtk_assert_dialog_add_button_to(GTK_BOX(hbox), "Copy to clip_board", "gtk-copy"); g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_copy_callback), dlg); } #endif // wxUSE_STACKWALKER @@ -789,14 +785,10 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*) wxGCC_WARNING_RESTORE() /* add the stop button */ - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - gtk_assert_dialog_add_button (dlg, "_Stop", GTK_STOCK_QUIT, GTK_ASSERT_DIALOG_STOP); - wxGCC_WARNING_RESTORE() + gtk_assert_dialog_add_button(dlg, "_Stop", "gtk-quit", GTK_ASSERT_DIALOG_STOP); /* add the continue button */ - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - continuebtn = gtk_assert_dialog_add_button (dlg, "_Continue", GTK_STOCK_YES, GTK_ASSERT_DIALOG_CONTINUE); - wxGCC_WARNING_RESTORE() + continuebtn = gtk_assert_dialog_add_button(dlg, "_Continue", "gtk-yes", GTK_ASSERT_DIALOG_CONTINUE); gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_ASSERT_DIALOG_CONTINUE); g_signal_connect (continuebtn, "clicked", G_CALLBACK(gtk_assert_dialog_continue_callback), dlg); diff --git a/src/gtk/brush.cpp b/src/gtk/brush.cpp index a903929e4d..d4fe907597 100644 --- a/src/gtk/brush.cpp +++ b/src/gtk/brush.cpp @@ -87,7 +87,7 @@ wxGDIRefData *wxBrush::CreateGDIRefData() const wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const { - return new wxBrushRefData(*(wxBrushRefData *)data); + return new wxBrushRefData(*static_cast(data)); } bool wxBrush::operator==(const wxBrush& brush) const diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 012aa24b44..71e4bd52f9 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -184,7 +184,7 @@ wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win)) GtkWidget *btn = gtk_button_new_with_mnemonic(labelGTK.utf8_str()); #else wxGCC_WARNING_SUPPRESS(deprecated-declarations) - GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL); + GtkWidget* btn = gtk_button_new_from_stock("gtk-cancel"); wxGCC_WARNING_RESTORE() #endif gtk_container_add(GTK_CONTAINER(box), btn); diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index b1daebc085..6d6aad79f6 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -160,7 +160,7 @@ targets_selection_received( GtkWidget *WXUNUSED(widget), clip.GetId().c_str() ); // the atoms we received, holding a list of targets (= formats) - const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data); + const GdkAtom* const atoms = reinterpret_cast(gtk_selection_data_get_data(selection_data)); for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++) { const wxDataFormat format(atoms[i]); @@ -406,7 +406,7 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget), clip.GetId().c_str() ); // the atoms we received, holding a list of targets (= formats) - const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data); + const GdkAtom* const atoms = reinterpret_cast(gtk_selection_data_get_data(selection_data)); for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++) { const wxDataFormat format(atoms[i]); diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index d879b2f9e0..fed357b468 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -745,7 +745,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset } if (m_gdkwindow) - gdk_draw_lines( m_gdkwindow, m_penGC, (GdkPoint*) gpts, n); + gdk_draw_lines(m_gdkwindow, m_penGC, const_cast(gpts), n); delete[] gpts_alloc; } @@ -791,7 +791,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], bool originChanged; DrawingSetup(gc, originChanged); - gdk_draw_polygon(m_gdkwindow, gc, true, (GdkPoint*) gdkpoints, n); + gdk_draw_polygon(m_gdkwindow, gc, true, const_cast(gdkpoints), n); if (originChanged) gdk_gc_set_ts_origin(gc, 0, 0); @@ -809,7 +809,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], gdkpoints[(i+1)%n].y); } */ - gdk_draw_polygon( m_gdkwindow, m_penGC, FALSE, (GdkPoint*) gdkpoints, n ); + gdk_draw_polygon(m_gdkwindow, m_penGC, false, const_cast(gdkpoints), n); } } diff --git a/src/gtk/dirdlg.cpp b/src/gtk/dirdlg.cpp index 3514cc406e..005771a54e 100644 --- a/src/gtk/dirdlg.cpp +++ b/src/gtk/dirdlg.cpp @@ -85,9 +85,6 @@ bool wxDirDialog::Create(wxWindow* parent, if (parent) gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) ); -#ifndef __WXGTK4__ - wxGCC_WARNING_SUPPRESS(deprecated-declarations) -#endif m_widget = gtk_file_chooser_dialog_new( wxGTK_CONV(m_message), gtk_parent, @@ -95,19 +92,17 @@ bool wxDirDialog::Create(wxWindow* parent, #ifdef __WXGTK4__ static_cast(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))), #else - GTK_STOCK_CANCEL, + "gtk-cancel", #endif GTK_RESPONSE_CANCEL, #ifdef __WXGTK4__ static_cast(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)))), #else - GTK_STOCK_OPEN, + "gtk-open", #endif GTK_RESPONSE_ACCEPT, NULL); -#ifndef __WXGTK4__ - wxGCC_WARNING_RESTORE() -#endif + g_object_ref(m_widget); gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT); diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 9f5ae2beb9..9439f4b58a 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -213,9 +213,6 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, if (parent) gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) ); -#ifndef __WXGTK4__ - wxGCC_WARNING_SUPPRESS(deprecated-declarations) -#endif wxString ok_btn_stock; if ( style & wxFD_SAVE ) { @@ -223,7 +220,7 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, #ifdef __WXGTK4__ ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_SAVE)); #else - ok_btn_stock = GTK_STOCK_SAVE; + ok_btn_stock = "gtk-save"; #endif } else @@ -232,7 +229,7 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, #ifdef __WXGTK4__ ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)); #else - ok_btn_stock = GTK_STOCK_OPEN; + ok_btn_stock = "gtk-open"; #endif } @@ -243,14 +240,12 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, #ifdef __WXGTK4__ static_cast(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))), #else - GTK_STOCK_CANCEL, + "gtk-cancel", #endif GTK_RESPONSE_CANCEL, static_cast(wxGTK_CONV(ok_btn_stock)), GTK_RESPONSE_ACCEPT, NULL); -#ifndef __WXGTK4__ - wxGCC_WARNING_RESTORE() -#endif + g_object_ref(m_widget); GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(m_widget); diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index fc7ebaa6ba..7fa4a4eee9 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -1349,6 +1349,7 @@ wxGetGtkAccel(const wxMenuItem* item, guint* accel_key, GdkModifierType* accel_m #ifndef __WXGTK4__ wxGCC_WARNING_SUPPRESS(deprecated-declarations) +wxGCC_WARNING_SUPPRESS(cast-qual) const char *wxGetStockGtkID(wxWindowID id) { #define STOCKITEM(wx,gtk) \ @@ -1451,6 +1452,7 @@ const char *wxGetStockGtkID(wxWindowID id) return NULL; } +wxGCC_WARNING_RESTORE(cast-qual) wxGCC_WARNING_RESTORE() #endif // !__WXGTK4__ diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 25d67009f8..033f857e35 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -52,9 +52,7 @@ wxString wxMessageDialog::GetDefaultYesLabel() const #ifdef __WXGTK4__ return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_YES)); #else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return GTK_STOCK_YES; - wxGCC_WARNING_RESTORE() + return "gtk-yes"; #endif } @@ -63,9 +61,7 @@ wxString wxMessageDialog::GetDefaultNoLabel() const #ifdef __WXGTK4__ return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_NO)); #else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return GTK_STOCK_NO; - wxGCC_WARNING_RESTORE() + return "gtk-no"; #endif } @@ -74,9 +70,7 @@ wxString wxMessageDialog::GetDefaultOKLabel() const #ifdef __WXGTK4__ return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OK)); #else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return GTK_STOCK_OK; - wxGCC_WARNING_RESTORE() + return "gtk-ok"; #endif } @@ -85,9 +79,7 @@ wxString wxMessageDialog::GetDefaultCancelLabel() const #ifdef __WXGTK4__ return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)); #else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return GTK_STOCK_CANCEL; - wxGCC_WARNING_RESTORE() + return "gtk-cancel"; #endif } @@ -96,9 +88,7 @@ wxString wxMessageDialog::GetDefaultHelpLabel() const #ifdef __WXGTK4__ return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_HELP)); #else - wxGCC_WARNING_SUPPRESS(deprecated-declarations) - return GTK_STOCK_HELP; - wxGCC_WARNING_RESTORE() + return "gtk-help"; #endif } diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index e47aa44818..1fe4c90fe1 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -127,7 +127,7 @@ wxGDIRefData *wxPen::CreateGDIRefData() const wxGDIRefData *wxPen::CloneGDIRefData(const wxGDIRefData *data) const { - return new wxPenRefData(*(wxPenRefData *)data); + return new wxPenRefData(*static_cast(data)); } bool wxPen::operator == ( const wxPen& pen ) const @@ -193,7 +193,7 @@ int wxPen::GetDashes( wxDash **ptr ) const { wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") ); - *ptr = (wxDash*)M_PENDATA->m_dash; + *ptr = const_cast(M_PENDATA->m_dash); return M_PENDATA->m_countDashes; } @@ -208,7 +208,7 @@ wxDash* wxPen::GetDash() const { wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") ); - return (wxDash*)M_PENDATA->m_dash; + return const_cast(M_PENDATA->m_dash); } wxPenCap wxPen::GetCap() const diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 56f86fb1f0..dd0066b449 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -188,13 +188,13 @@ void wxSpinButton::DoEnable(bool enable) void wxSpinButton::GtkDisableEvents() const { g_signal_handlers_block_by_func(m_widget, - (gpointer)gtk_value_changed, (void*) this); + (void*)gtk_value_changed, const_cast(this)); } void wxSpinButton::GtkEnableEvents() const { g_signal_handlers_unblock_by_func(m_widget, - (gpointer)gtk_value_changed, (void*) this); + (void*)gtk_value_changed, const_cast(this)); } GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED_IN_GTK2(windows)) const diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index a341b79752..150a6284ec 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -291,22 +291,16 @@ void wxSpinCtrlGTKBase::DoSetIncrement(double inc) gtk_spin_button_set_increments( GTK_SPIN_BUTTON(m_widget), inc, page); } -void wxSpinCtrlGTKBase::GtkDisableEvents() const +void wxSpinCtrlGTKBase::GtkDisableEvents() { - g_signal_handlers_block_by_func( m_widget, - (gpointer)gtk_value_changed, (void*) this); - - g_signal_handlers_block_by_func(m_widget, - (gpointer)gtk_changed, (void*) this); + g_signal_handlers_block_by_func(m_widget, (void*)gtk_value_changed, this); + g_signal_handlers_block_by_func(m_widget, (void*)gtk_changed, this); } -void wxSpinCtrlGTKBase::GtkEnableEvents() const +void wxSpinCtrlGTKBase::GtkEnableEvents() { - g_signal_handlers_unblock_by_func(m_widget, - (gpointer)gtk_value_changed, (void*) this); - - g_signal_handlers_unblock_by_func(m_widget, - (gpointer)gtk_changed, (void*) this); + g_signal_handlers_unblock_by_func(m_widget, (void*)gtk_value_changed, this); + g_signal_handlers_unblock_by_func(m_widget, (void*)gtk_changed, this); } void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event ) diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 675d597a42..aa1411fb08 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -66,7 +66,7 @@ wxGtkTextRemoveTagsWithPrefix(GtkTextBuffer *text_buffer, text_buffer, "remove_tag", G_CALLBACK(wxGtkOnRemoveTag), - gpointer(prefix) + const_cast(static_cast(prefix)) ); gtk_text_buffer_remove_all_tags(text_buffer, start, end); g_signal_handler_disconnect(text_buffer, remove_handler_id); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ee6e7db6d6..f771bbad11 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -5182,7 +5182,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) GTK_SHADOW_NONE, &rect, parent->m_widget, - (char *)"base", + const_cast("base"), 0, 0, w, h); #endif // !__WXGTK3__ } diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index aa1d9d8ed7..1a896be108 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -877,7 +877,7 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword, #if wxUSE_PROGRESSDLG progress.Update(status.GetCurIndex(), foundstr); #endif - m_SearchList->Append(status.GetName(), (void*)status.GetCurItem()); + m_SearchList->Append(status.GetName(), const_cast(status.GetCurItem())); } } diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index ac04fcd7b6..84b5971a6b 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -543,9 +543,9 @@ extern "C" { static int LINKAGEMODE wxHtmlEntityCompare(const void *key, const void *item) { #if wxUSE_UNICODE_UTF8 - return strcmp((char*)key, ((wxHtmlEntityInfo*)item)->name); + return strcmp(static_cast(key), static_cast(item)->name); #else - return wxStrcmp((wxChar*)key, ((wxHtmlEntityInfo*)item)->name); + return wxStrcmp(static_cast(key), static_cast(item)->name); #endif } } diff --git a/src/html/htmltag.cpp b/src/html/htmltag.cpp index 3d17acfee9..6c5fc0b02d 100644 --- a/src/html/htmltag.cpp +++ b/src/html/htmltag.cpp @@ -662,7 +662,7 @@ wxHtmlTag *wxHtmlTag::GetFirstSibling() const return m_Parent->m_FirstChild; else { - wxHtmlTag *cur = (wxHtmlTag*)this; + wxHtmlTag* cur = const_cast(this); while (cur->m_Prev) cur = cur->m_Prev; return cur; @@ -675,7 +675,7 @@ wxHtmlTag *wxHtmlTag::GetLastSibling() const return m_Parent->m_LastChild; else { - wxHtmlTag *cur = (wxHtmlTag*)this; + wxHtmlTag* cur = const_cast(this); while (cur->m_Next) cur = cur->m_Next; return cur; diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 2685a80cd4..2d67921074 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -269,7 +269,7 @@ const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const { if (cond == wxHTML_COND_ISIMAGEMAP) { - if (m_Name == *((wxString*)(param))) + if (m_Name == *static_cast(param)) return this; } return wxHtmlCell::Find(cond, param); @@ -331,8 +331,8 @@ private: size_t m_nCurrFrame; #endif double m_scale; - wxHtmlImageMapCell *m_imageMap; - wxString m_mapName; + mutable const wxHtmlImageMapCell* m_imageMap; + mutable wxString m_mapName; wxString m_alt; wxDECLARE_NO_COPY_CLASS(wxHtmlImageCell); @@ -655,18 +655,14 @@ wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const p = p->GetParent(); } p = op; - wxHtmlCell *cell = (wxHtmlCell*)p->Find(wxHTML_COND_ISIMAGEMAP, + const wxHtmlCell* cell = p->Find(wxHTML_COND_ISIMAGEMAP, (const void*)(&m_mapName)); if (!cell) { - ((wxString&)m_mapName).Clear(); + m_mapName.Clear(); return wxHtmlCell::GetLink( x, y ); } - { // dirty hack, ask Joel why he fills m_ImageMap in this place - // THE problem is that we're in const method and we can't modify m_ImageMap - wxHtmlImageMapCell **cx = (wxHtmlImageMapCell**)(&m_imageMap); - *cx = (wxHtmlImageMapCell*)cell; - } + m_imageMap = static_cast(cell); } return m_imageMap->GetLink(x, y); } diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 85be5b4877..6e9209baa1 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -989,7 +989,7 @@ void wxMSWDCImpl::DoDrawPolygon(int n, CalcBoundingBox(points[i].x, points[i].y); int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); - (void)Polygon(GetHdc(), (POINT*) points, n); + Polygon(GetHdc(), reinterpret_cast(points), n); SetPolyFillMode(GetHdc(),prev); } } @@ -1029,7 +1029,7 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n, CalcBoundingBox(points[i].x, points[i].y); int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING); - (void)PolyPolygon(GetHdc(), (POINT*) points, count, n); + PolyPolygon(GetHdc(), reinterpret_cast(points), count, n); SetPolyFillMode(GetHdc(),prev); } } @@ -1057,7 +1057,7 @@ void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wx for (i = 0; i < n; i++) CalcBoundingBox(points[i].x, points[i].y); - (void)Polyline(GetHdc(), (POINT*) points, n); + Polyline(GetHdc(), reinterpret_cast(points), n); } } diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index 0b5cc4b287..9382b4c2ce 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -565,7 +565,7 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format) } else // no conversion necessary for wxIPC_UNICODETEXT { - realData = (LPBYTE)data; + realData = const_cast(static_cast(data)); realSize = size; } @@ -689,7 +689,7 @@ bool wxDDEConnection::DoPoke(const wxString& item, const void *data, size_t size DWORD result; HSZ item_atom = DDEGetAtom(item); - bool ok = DdeClientTransaction((LPBYTE)data, + bool ok = DdeClientTransaction(const_cast(static_cast(data)), size, GetHConv(), item_atom, format, @@ -952,7 +952,7 @@ _DDECallback(UINT wType, } HDDEDATA handle = DdeCreateDataHandle(DDEIdInst, - (LPBYTE)data, + const_cast(static_cast(data)), user_size, 0, hsz2, @@ -1035,7 +1035,7 @@ _DDECallback(UINT wType, HDDEDATA data = DdeCreateDataHandle ( DDEIdInst, - (LPBYTE)connection->m_sendingData, + const_cast(static_cast(connection->m_sendingData)), connection->m_dataSize, 0, hsz2, diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 0850c7eca6..3854dcb293 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -348,7 +348,7 @@ HBITMAP wxDIB::CreateDDB(HDC hdc) const } /* static */ -HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, void *bits) +HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, const void *bits) { wxCHECK_MSG( pbmi, 0, wxT("invalid DIB in ConvertToBitmap") ); @@ -389,7 +389,7 @@ HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, void *bits) numColors = 0; } - bits = (char *)pbmih + sizeof(*pbmih) + numColors*sizeof(RGBQUAD); + bits = reinterpret_cast(pbmih + 1) + numColors * sizeof(RGBQUAD); } HBITMAP hbmp = ::CreateDIBitmap diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index b0b9ed84d9..dbd567889b 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -292,7 +292,7 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner) // do show the dialog wxItemIdList pidl(SHBrowseForFolder(&bi)); - wxItemIdList::Free((LPITEMIDLIST)bi.pidlRoot); + wxItemIdList::Free(const_cast(bi.pidlRoot)); if ( !pidl ) { diff --git a/src/msw/enhmeta.cpp b/src/msw/enhmeta.cpp index bd08a76206..a6a06ccd93 100644 --- a/src/msw/enhmeta.cpp +++ b/src/msw/enhmeta.cpp @@ -480,7 +480,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format, if ( format == wxDF_ENHMETAFILE ) { - hEMF = *(HENHMETAFILE *)buf; + hEMF = *static_cast(buf); wxCHECK_MSG( hEMF, false, wxT("pasting invalid enh metafile") ); } @@ -555,7 +555,7 @@ bool wxEnhMetaFileSimpleDataObject::GetDataHere(void *buf) const bool wxEnhMetaFileSimpleDataObject::SetData(size_t WXUNUSED(len), const void *buf) { - HENHMETAFILE hEMF = *(HENHMETAFILE *)buf; + HENHMETAFILE hEMF = *static_cast(buf); wxCHECK_MSG( hEMF, false, wxT("pasting invalid enh metafile") ); m_metafile.SetHENHMETAFILE((WXHANDLE)hEMF); diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index b710efaac8..12c2705ff1 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -411,7 +411,7 @@ wxBitmap wxImageList::GetBitmap(int index) const if ( ii.hbmMask ) { // draw it the first time to find a suitable mask colour - ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); + const_cast(this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); dc.SelectObject(wxNullBitmap); // find the suitable mask colour @@ -426,7 +426,7 @@ wxBitmap wxImageList::GetBitmap(int index) const // redraw icon over the mask colour to actually draw it dc.SelectObject(bitmap); - ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); + const_cast(this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT); dc.SelectObject(wxNullBitmap); // get the image, set the mask colour and convert back to get transparent bitmap @@ -437,7 +437,7 @@ wxBitmap wxImageList::GetBitmap(int index) const else // no mask { // Just draw it normally. - ((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL); + const_cast(this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL); dc.SelectObject(wxNullBitmap); // And adjust its alpha flag as the destination bitmap would get it if diff --git a/src/msw/mediactrl_qt.cpp b/src/msw/mediactrl_qt.cpp index 65948e9635..eaa9b4fe44 100644 --- a/src/msw/mediactrl_qt.cpp +++ b/src/msw/mediactrl_qt.cpp @@ -695,7 +695,7 @@ bool wxQTMediaBackend::Load(const wxString& fileName) FSSpec sfFile; OSErr err = m_lib.NativePathNameToFSSpec( - (char*) (const char*) fileName.mb_str(), + const_cast(static_cast(fileName.mb_str())), &sfFile, 0); bool result = (err == noErr); diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 7f0565225b..40a8ba8b01 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -1225,7 +1225,7 @@ wxColour wxNotebook::GetThemeBackgroundColour() const #if wxUSE_UXTHEME if (wxUxThemeIsActive()) { - wxUxThemeHandle hTheme((wxNotebook*) this, L"TAB"); + wxUxThemeHandle hTheme(this, L"TAB"); if (hTheme) { // This is total guesswork. diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index ca7ad6bfae..a707456c3f 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -768,7 +768,7 @@ namespace const int invalid_entry_marker = 0; } -wxVariant wxActiveXEvents::ms_invalidEntryMarker((void*)&invalid_entry_marker); +wxVariant wxActiveXEvents::ms_invalidEntryMarker(static_cast(&invalid_entry_marker)); size_t wxActiveXEvent::ParamCount() const { diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 4d091c5285..1b30be2e88 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -567,7 +567,7 @@ bool wxAutomationObject::GetInstance(const wxString& progId, int flags) const return false; } - hr = pUnk->QueryInterface(IID_IDispatch, (LPVOID*) &m_dispatchPtr); + hr = pUnk->QueryInterface(IID_IDispatch, const_cast(&m_dispatchPtr)); if (FAILED(hr)) { wxLogSysError(hr, diff --git a/src/msw/ole/dataobj.cpp b/src/msw/ole/dataobj.cpp index e052521521..d03d4277c6 100644 --- a/src/msw/ole/dataobj.cpp +++ b/src/msw/ole/dataobj.cpp @@ -1114,7 +1114,7 @@ bool wxBitmapDataObject2::GetDataHere(void *pBuf) const bool wxBitmapDataObject2::SetData(size_t WXUNUSED(len), const void *pBuf) { - HBITMAP hbmp = *(HBITMAP *)pBuf; + HBITMAP hbmp = *static_cast(pBuf); BITMAP bmp; if ( !GetObject(hbmp, sizeof(BITMAP), &bmp) ) @@ -1273,7 +1273,7 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size), // ((char *)&(pDropFiles.pFiles)) + pDropFiles.pFiles. We're also advised // to use DragQueryFile to work with this structure, but not told where and // how to get HDROP. - HDROP hdrop = (HDROP)pData; // NB: it works, but I'm not sure about it + HDROP hdrop = static_cast(const_cast(pData)); // NB: it works, but I'm not sure about it // get number of files (magic value -1) UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, NULL, 0u); diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp index 3bafbba898..6c08eb4540 100644 --- a/src/msw/ole/uuid.cpp +++ b/src/msw/ole/uuid.cpp @@ -138,7 +138,7 @@ bool Uuid::Set(const wxChar *pc) { // get UUID from string #ifdef _UNICODE - if ( UuidFromString((unsigned short *)pc, &m_uuid) != RPC_S_OK) + if (UuidFromString(reinterpret_cast(const_cast(pc)), &m_uuid) != RPC_S_OK) #else if ( UuidFromString((wxUChar *)pc, &m_uuid) != RPC_S_OK) #endif diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index 34b7704e85..d4b4e19634 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -442,7 +442,7 @@ wxProgressDialog::~wxProgressDialog() DWORD rc = ::MsgWaitForMultipleObjects ( 1, // number of objects to wait for - (HANDLE *)&hThread, // the objects + &hThread, // the objects false, // wait for any objects, not all INFINITE, // no timeout QS_ALLINPUT | // return as soon as there are any events diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 7ef36a9840..b42edb7be8 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -481,11 +481,11 @@ size_t wxRegConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const // dummy vars wxString str; long l; - bool bCont = ((wxRegConfig*)this)->GetFirstEntry(str, l); + bool bCont = GetFirstEntry(str, l); while ( bCont ) { nEntries++; - bCont = ((wxRegConfig*)this)->GetNextEntry(str, l); + bCont = GetNextEntry(str, l); } return nEntries; @@ -498,11 +498,11 @@ size_t wxRegConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const // dummy vars wxString str; long l; - bool bCont = ((wxRegConfig*)this)->GetFirstGroup(str, l); + bool bCont = GetFirstGroup(str, l); while ( bCont ) { nGroups++; - bCont = ((wxRegConfig*)this)->GetNextGroup(str, l); + bCont = GetNextGroup(str, l); } return nGroups; diff --git a/src/msw/region.cpp b/src/msw/region.cpp index 8766364efe..4bd19571cf 100644 --- a/src/msw/region.cpp +++ b/src/msw/region.cpp @@ -135,7 +135,7 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle) m_refData = new wxRegionRefData; M_REGION = ::CreatePolygonRgn ( - (POINT*)points, + reinterpret_cast(points), n, fillStyle == wxODDEVEN_RULE ? ALTERNATE : WINDING ); @@ -153,7 +153,7 @@ wxGDIRefData *wxRegion::CreateGDIRefData() const wxGDIRefData *wxRegion::CloneGDIRefData(const wxGDIRefData *data) const { - return new wxRegionRefData(*(wxRegionRefData *)data); + return new wxRegionRefData(*static_cast(data)); } // ---------------------------------------------------------------------------- diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index bc5e1d273c..b24af19b33 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -87,11 +87,7 @@ aStdKeys[] = // macros // ---------------------------------------------------------------------------- -// const_cast<> is not yet supported by all compilers -#define CONST_CAST ((wxRegKey *)this)-> - -// and neither is mutable which m_dwLastError should be -#define m_dwLastError CONST_CAST m_dwLastError +#define CONST_CAST const_cast(this)-> // ---------------------------------------------------------------------------- // non member functions @@ -1071,7 +1067,7 @@ bool wxRegKey::SetValue(const wxString& szValue, const wxString& strValue) m_dwLastError = RegSetValueEx((HKEY) m_hKey, RegValueStr(szValue), (DWORD) RESERVED, REG_SZ, - (RegString)wxMSW_CONV_LPCTSTR(strValue), + reinterpret_cast(wxMSW_CONV_LPCTSTR(strValue)), (strValue.Len() + 1)*sizeof(wxChar)); if ( m_dwLastError == ERROR_SUCCESS ) return true; diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 0a7de130e2..2ede920e8b 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -401,7 +401,7 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, m_hWnd = (WXHWND)::CreateDialogIndirect ( wxGetInstance(), - (DLGTEMPLATE*)dlgTemplate, + static_cast(dlgTemplate), parent ? GetHwndOf(parent) : NULL, (DLGPROC)wxDlgProc ); diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 74a3a596c3..4059e6b726 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -812,9 +812,9 @@ bool wxShell(const wxString& command) { wxString cmd; - wxChar *shell = wxGetenv(wxT("COMSPEC")); + const wxChar* shell = wxGetenv(wxT("COMSPEC")); if ( !shell ) - shell = (wxChar*) wxT("\\COMMAND.COM"); + shell = wxT("\\COMMAND.COM"); if ( !command ) { diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 60841d8edd..446c16f859 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -520,7 +520,7 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len) if ( !chunkWritten ) break; - buffer = (char *)buffer + chunkWritten; + buffer = static_cast(buffer) + chunkWritten; totalWritten += chunkWritten; len -= chunkWritten; } diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 8504b4c609..0797596629 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -638,7 +638,7 @@ wxSize wxFont::GetPixelSize() const #if wxUSE_GRAPHICS_CONTEXT // TODO: consider caching the value wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef)NULL); - dc->SetFont(*(wxFont*)this, *wxBLACK); + dc->SetFont(*this, *wxBLACK); wxDouble width, height = 0; dc->GetTextExtent(wxT("g"), &width, &height, NULL, NULL); delete dc; diff --git a/src/osx/carbon/metafile.cpp b/src/osx/carbon/metafile.cpp index 685e627124..89b34f0b9c 100644 --- a/src/osx/carbon/metafile.cpp +++ b/src/osx/carbon/metafile.cpp @@ -187,7 +187,8 @@ wxMetaFile::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const WXHMETAFILE wxMetaFile::GetHMETAFILE() const { - return (WXHMETAFILE) (CFDataRef) M_METAFILEDATA->GetData(); + const void* p = M_METAFILEDATA->GetData(); + return static_cast(const_cast(p)); } bool wxMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height)) @@ -340,7 +341,7 @@ bool wxMetafileDataObject::GetDataHere(void *buf) const bool wxMetafileDataObject::SetData(size_t len, const void *buf) { - wxMetafileRefData* metafiledata = new wxMetafileRefData(wxCFRefFromGet(wxCFDataRef((UInt8*)buf, len).get())); + wxMetafileRefData* metafiledata = new wxMetafileRefData(wxCFRefFromGet(wxCFDataRef(static_cast(buf), len).get())); m_metafile.UnRef(); m_metafile.SetRefData( metafiledata ); return true; diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 550fc9c6d1..127db0e16e 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -173,7 +173,7 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData &tocopy) : wxGDIRefData() UseAlpha(true); unsigned char* dest = (unsigned char*)GetRawAccess(); - unsigned char* source = (unsigned char*)tocopy.GetRawAccess(); + const unsigned char* source = static_cast(tocopy.GetRawAccess()); size_t numbytes = GetBytesPerRow() * GetHeight(); memcpy( dest, source, numbytes ); } @@ -780,7 +780,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits if ( the_width % 8 ) linesize++; - unsigned char* linestart = (unsigned char*) bits ; + const unsigned char* linestart = reinterpret_cast(bits); unsigned char* destptr = (unsigned char*) GetBitmapData()->BeginRawAccess() ; for ( int y = 0 ; y < the_height ; ++y , linestart += linesize, destptr += GetBitmapData()->GetBytesPerRow() ) @@ -949,7 +949,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const int destheight = rect.height*scale ; { - unsigned char *sourcedata = (unsigned char*) GetBitmapData()->GetRawAccess() ; + const unsigned char* sourcedata = static_cast(GetBitmapData()->GetRawAccess()); unsigned char *destdata = (unsigned char*) ret.GetBitmapData()->BeginRawAccess() ; wxASSERT((sourcedata != NULL) && (destdata != NULL)); @@ -957,7 +957,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const { int sourcelinesize = GetBitmapData()->GetBytesPerRow() ; int destlinesize = ret.GetBitmapData()->GetBytesPerRow() ; - unsigned char* source = sourcedata + size_t(rect.x * scale) * 4 + size_t(rect.y * scale) * sourcelinesize; + const unsigned char* source = sourcedata + size_t(rect.x * scale) * 4 + size_t(rect.y * scale) * sourcelinesize; unsigned char* dest = destdata; for (int yy = 0; yy < destheight; ++yy, source += sourcelinesize , dest += destlinesize) @@ -1199,7 +1199,7 @@ wxImage wxBitmap::ConvertToImage() const // this call may trigger a conversion from platform image to bitmap, issue it // before any measurements are taken, multi-resolution platform images may be // rendered incorrectly otherwise - unsigned char* sourcestart = (unsigned char*) GetBitmapData()->GetRawAccess() ; + const unsigned char* sourcestart = static_cast(GetBitmapData()->GetRawAccess()); // create an wxImage object int width = GetWidth(); @@ -1244,7 +1244,7 @@ wxImage wxBitmap::ConvertToImage() const for (int yy = 0; yy < height; yy++ , sourcestart += GetBitmapData()->GetBytesPerRow() , mask += maskBytesPerRow ) { unsigned char * maskp = mask ; - const wxUint32 * source = (wxUint32*)sourcestart; + const wxUint32* source = reinterpret_cast(sourcestart); for (int xx = 0; xx < width; xx++) { diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index 395ef7a8c2..796a7ef7cb 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -292,7 +292,7 @@ wxArrayVideoModes wxDisplayImplMacOSX::GetModes(const wxVideoMode& mode) const for (CFIndex i = 0; i < CFArrayGetCount(theArray); ++i) { - CGDisplayModeRef theValue = (CGDisplayModeRef) CFArrayGetValueAtIndex( theArray, i ); + CGDisplayModeRef theValue = static_cast(const_cast(CFArrayGetValueAtIndex(theArray, i))); wxVideoMode theMode( CGDisplayModeGetWidth(theValue), @@ -336,7 +336,7 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) for (CFIndex i = 0; i < CFArrayGetCount(theArray); ++i) { - CGDisplayModeRef theValue = (CGDisplayModeRef) CFArrayGetValueAtIndex( theArray, i ); + CGDisplayModeRef theValue = static_cast(const_cast(CFArrayGetValueAtIndex(theArray, i))); wxVideoMode theMode( CGDisplayModeGetWidth(theValue), diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index 0fe3214fc9..cb4879bc8b 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -130,7 +130,7 @@ void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data ) count = CFArrayGetCount(printerList); for (index = 0; index < count; index++) { - printer = (PMPrinter)CFArrayGetValueAtIndex(printerList, index); + printer = static_cast(const_cast(CFArrayGetValueAtIndex(printerList, index))); if ((data.GetPrinterName().empty()) && (PMPrinterIsDefault(printer))) break; @@ -184,7 +184,7 @@ void wxOSXPrintData::TransferPaperInfoFrom( const wxPrintData &data ) CFIndex top = CFArrayGetCount(paperlist); for ( CFIndex i = 0 ; i < top ; ++ i ) { - PMPaper paper = (PMPaper) CFArrayGetValueAtIndex( paperlist, i ); + PMPaper paper = static_cast(const_cast(CFArrayGetValueAtIndex(paperlist, i))); PMPaperGetHeight(paper, &height); PMPaperGetWidth(paper, &width); if ( fabs( width - papersize.x ) < 5 && diff --git a/src/osx/core/strconv_cf.cpp b/src/osx/core/strconv_cf.cpp index 4870533a50..18f232bdbe 100644 --- a/src/osx/core/strconv_cf.cpp +++ b/src/osx/core/strconv_cf.cpp @@ -183,7 +183,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding) { theString = wxCFRef(CFStringCreateWithBytes( kCFAllocatorDefault, - (UInt8*)src, + reinterpret_cast(src), srcSize * sizeof(wchar_t), wxCFStringEncodingWcharT, false)); diff --git a/src/osx/fswatcher_fsevents.cpp b/src/osx/fswatcher_fsevents.cpp index dbf6e457bd..2d5573c256 100644 --- a/src/osx/fswatcher_fsevents.cpp +++ b/src/osx/fswatcher_fsevents.cpp @@ -269,7 +269,7 @@ static void wxFSEventCallback(ConstFSEventStreamRef WXUNUSED(streamRef), void *c static void wxDeleteContext(const void* context) { wxFSEventWatcherContext* watcherContext = - (wxFSEventWatcherContext*) context; + static_cast(const_cast(context)); delete watcherContext; } diff --git a/src/osx/pen.cpp b/src/osx/pen.cpp index 3a485a6f9d..171a4263b6 100644 --- a/src/osx/pen.cpp +++ b/src/osx/pen.cpp @@ -274,7 +274,7 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash) Unshare(); M_PENDATA->m_nbDash = nb_dashes; - M_PENDATA->m_dash = (wxDash *)Dash; + M_PENDATA->m_dash = const_cast(Dash); RealizeResource(); } diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index 0b43c1fef9..4de0607d62 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -195,7 +195,7 @@ void wxMacStringToPascal( const wxString&from , unsigned char * to ) wxString wxMacMakeStringFromPascal( const unsigned char * from ) { - return wxString( (char*) &from[1] , wxConvLocal , from[0] ); + return wxString(&from[1], wxConvLocal, from[0]); } #endif // wxOSX_USE_COCOA_OR_CARBON diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 51686ffd13..4eaa5a907c 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -1853,7 +1853,7 @@ void wxWindowMac::Update() wxNonOwnedWindow* wxWindowMac::MacGetTopLevelWindow() const { - wxWindowMac *iter = (wxWindowMac*)this ; + wxWindowMac* iter = const_cast(this); while ( iter ) { diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 4fe4cacceb..4bf316f028 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -637,7 +637,8 @@ public: } else { - pg->OnComboItemPaint( this, item, &dc, (wxRect&)rect, flags ); + wxRect r(rect); + pg->OnComboItemPaint(this, item, &dc, r, flags); } } diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 60a7613ce6..b0a4c4b366 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -2201,7 +2201,7 @@ private: wxPGVIterator wxPropertyGridManager::GetVIterator( int flags ) const { - return wxPGVIterator( new wxPGVIteratorBase_Manager( (wxPropertyGridManager*)this, flags ) ); + return wxPGVIterator(new wxPGVIteratorBase_Manager(const_cast(this), flags)); } #endif // wxUSE_PROPGRID diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index f6a9699103..7898c75b7e 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1936,7 +1936,7 @@ void wxPropertyGrid::DrawExpanderButton( wxDC& dc, const wxRect& rect, // Hopefully this does not cause problems. #if (wxPG_USE_RENDERER_NATIVE) wxRendererNative::Get().DrawTreeItemButton( - (wxWindow*)this, + const_cast(this), dc, r, wxCONTROL_EXPANDED @@ -1952,7 +1952,7 @@ void wxPropertyGrid::DrawExpanderButton( wxDC& dc, const wxRect& rect, { #if (wxPG_USE_RENDERER_NATIVE) wxRendererNative::Get().DrawTreeItemButton( - (wxWindow*)this, + const_cast(this), dc, r, 0 diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index 99bccbefea..e8c937b5aa 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -432,7 +432,7 @@ wxPropertyCategory* wxPropertyGridPageState::GetPropertyCategory( const wxPGProp parent = grandparent; grandparent = parent->GetParent(); if ( parent->IsCategory() && grandparent ) - return (wxPropertyCategory*)parent; + return const_cast(static_cast(parent)); } while ( grandparent ); return NULL; @@ -451,11 +451,11 @@ wxPGProperty* wxPropertyGridPageState::GetPropertyByLabel #endif // WXWIN_COMPATIBILITY_3_0 wxPGProperty* wxPropertyGridPageState::BaseGetPropertyByLabel - ( const wxString& label, wxPGProperty* parent ) const + ( const wxString& label, const wxPGProperty* parent ) const { if ( !parent ) { - parent = (wxPGProperty*) &m_regularArray; + parent = &m_regularArray; } for ( size_t i=0; iGetChildCount(); i++ ) diff --git a/src/ribbon/panel.cpp b/src/ribbon/panel.cpp index dc97dac68c..2f222e8b88 100644 --- a/src/ribbon/panel.cpp +++ b/src/ribbon/panel.cpp @@ -352,7 +352,7 @@ wxSize wxRibbonPanel::GetBestSizeForParentSize(const wxSize& parentSize) const wxRibbonControl* control = wxDynamicCast(win, wxRibbonControl); if (control) { - wxClientDC temp_dc((wxRibbonPanel*) this); + wxClientDC temp_dc(const_cast(this)); wxSize clientParentSize = m_art->GetPanelClientSize(temp_dc, this, parentSize, NULL); wxSize childSize = control->GetBestSizeForParentSize(clientParentSize); wxSize overallSize = m_art->GetPanelSize(temp_dc, this, childSize, NULL); @@ -374,7 +374,7 @@ wxSize wxRibbonPanel::DoGetNextSmallerSize(wxOrientation direction, if(m_art != NULL) { - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); wxSize child_relative = m_art->GetPanelClientSize(dc, this, relative_to, NULL); wxSize smaller(-1, -1); bool minimise = false; @@ -495,7 +495,7 @@ wxSize wxRibbonPanel::DoGetNextLargerSize(wxOrientation direction, if(m_art != NULL) { - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); wxSize child_relative = m_art->GetPanelClientSize(dc, this, relative_to, NULL); wxSize larger(-1, -1); @@ -587,14 +587,14 @@ wxSize wxRibbonPanel::GetMinNotMinimisedSize() const // Ask sizer if present if(GetSizer()) { - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); return m_art->GetPanelSize(dc, this, GetPanelSizerMinSize(), NULL); } else if(GetChildren().GetCount() == 1) { // Common case of single child taking up the entire panel wxWindow* child = GetChildren().Item(0)->GetData(); - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); return m_art->GetPanelSize(dc, this, child->GetMinSize(), NULL); } @@ -615,7 +615,7 @@ wxSize wxRibbonPanel::GetPanelSizerMinSize() const return GetSizer()->CalcMin(); } // else use previously calculated m_smallest_unminimised_size - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); return m_art->GetPanelClientSize(dc, this, m_smallest_unminimised_size, @@ -636,14 +636,14 @@ wxSize wxRibbonPanel::DoGetBestSize() const // Ask sizer if present if( GetSizer()) { - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); return m_art->GetPanelSize(dc, this, GetPanelSizerBestSize(), NULL); } else if(GetChildren().GetCount() == 1) { // Common case of no sizer and single child taking up the entire panel wxWindow* child = GetChildren().Item(0)->GetData(); - wxClientDC dc((wxRibbonPanel*) this); + wxClientDC dc(const_cast(this)); return m_art->GetPanelSize(dc, this, child->GetBestSize(), NULL); } diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 0c77999338..de5e1c982b 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -613,7 +613,7 @@ wxRect wxRichTextObject::GetAvailableContentArea(wxDC& dc, wxRichTextDrawingCont wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect; marginRect = outerRect; wxRichTextAttr attr(GetAttributes()); - ((wxRichTextObject*)this)->AdjustAttributes(attr, context); + const_cast(this)->AdjustAttributes(attr, context); GetBoxRects(dc, GetBuffer(), attr, marginRect, borderRect, contentRect, paddingRect, outlineRect); return contentRect; } @@ -7177,7 +7177,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz int relativeX = position.x - GetParent()->GetPosition().x; wxRichTextAttr textAttr(para ? para->GetCombinedAttributes(GetAttributes()) : GetAttributes()); - ((wxRichTextObject*) this)->AdjustAttributes(textAttr, context); + const_cast(this)->AdjustAttributes(textAttr, context); // Always assume unformatted text, since at this level we have no knowledge // of line breaks - and we don't need it, since we'll calculate size within @@ -7251,7 +7251,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz for (int i = 0; i < tabCount; ++i) { int pos = tabArray[i]; - pos = ((wxRichTextPlainText*) this)->ConvertTenthsMMToPixels(dc, pos); + pos = const_cast(this)->ConvertTenthsMMToPixels(dc, pos); tabArray[i] = pos; } @@ -7305,7 +7305,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz { if (nextTabPos <= absoluteWidth) { - int defaultTabWidth = ((wxRichTextPlainText*) this)->ConvertTenthsMMToPixels(dc, WIDTH_FOR_DEFAULT_TABS); + int defaultTabWidth = const_cast(this)->ConvertTenthsMMToPixels(dc, WIDTH_FOR_DEFAULT_TABS); nextTabPos = absoluteWidth + defaultTabWidth; } @@ -7452,16 +7452,16 @@ bool wxRichTextPlainText::CanMerge(wxRichTextObject* object, wxRichTextDrawingCo // Check if differing virtual attributes makes it impossible to merge // these strings. - bool hasVirtualAttr1 = context.HasVirtualAttributes((wxRichTextObject*) this); - bool hasVirtualAttr2 = context.HasVirtualAttributes((wxRichTextObject*) object); + bool hasVirtualAttr1 = context.HasVirtualAttributes(const_cast(this)); + bool hasVirtualAttr2 = context.HasVirtualAttributes(object); if (!hasVirtualAttr1 && !hasVirtualAttr2) return true; else if (hasVirtualAttr1 != hasVirtualAttr2) return false; else { - wxRichTextAttr virtualAttr1 = context.GetVirtualAttributes((wxRichTextObject*) this); - wxRichTextAttr virtualAttr2 = context.GetVirtualAttributes((wxRichTextObject*) object); + wxRichTextAttr virtualAttr1 = context.GetVirtualAttributes(const_cast(this)); + wxRichTextAttr virtualAttr2 = context.GetVirtualAttributes(object); return virtualAttr1 == virtualAttr2; } } @@ -7489,7 +7489,7 @@ bool wxRichTextPlainText::CanSplit(wxRichTextDrawingContext& context) const // If this object has any virtual attributes at all, whether for the whole object // or individual ones, we should try splitting it by calling Split. // Must be more than one character in order to be able to split. - return m_text.Length() > 1 && context.HasVirtualAttributes((wxRichTextObject*) this); + return m_text.Length() > 1 && context.HasVirtualAttributes(const_cast(this)); } wxRichTextObject* wxRichTextPlainText::Split(wxRichTextDrawingContext& context) @@ -9440,13 +9440,13 @@ bool wxRichTextField::GetRangeSize(const wxRichTextRange& range, wxSize& size, i { wxRichTextFieldType* fieldType = wxRichTextBuffer::FindFieldType(GetFieldType()); if (fieldType) - return fieldType->GetRangeSize((wxRichTextField*) this, range, size, descent, dc, context, flags, position, parentSize, partialExtents); + return fieldType->GetRangeSize(const_cast(this), range, size, descent, dc, context, flags, position, parentSize, partialExtents); // Fallback so unknown fields don't become invisible. wxString fieldTypeStr(GetFieldType()); wxRichTextFieldTypeStandard defaultFieldType; defaultFieldType.SetLabel(wxString::Format(wxT("unknown field %s"), fieldTypeStr.c_str())); - return defaultFieldType.GetRangeSize((wxRichTextField*) this, range, size, descent, dc, context, flags, position, parentSize, partialExtents); + return defaultFieldType.GetRangeSize(const_cast(this), range, size, descent, dc, context, flags, position, parentSize, partialExtents); } /// Calculate range @@ -9480,7 +9480,7 @@ bool wxRichTextField::CanEditProperties() const { wxRichTextFieldType* fieldType = wxRichTextBuffer::FindFieldType(GetFieldType()); if (fieldType) - return fieldType->CanEditProperties((wxRichTextField*) this); + return fieldType->CanEditProperties(const_cast(this)); return false; } @@ -9489,7 +9489,7 @@ wxString wxRichTextField::GetPropertiesMenuLabel() const { wxRichTextFieldType* fieldType = wxRichTextBuffer::FindFieldType(GetFieldType()); if (fieldType) - return fieldType->GetPropertiesMenuLabel((wxRichTextField*) this); + return fieldType->GetPropertiesMenuLabel(const_cast(this)); return wxEmptyString; } @@ -9507,7 +9507,7 @@ bool wxRichTextField::IsTopLevel() const { wxRichTextFieldType* fieldType = wxRichTextBuffer::FindFieldType(GetFieldType()); if (fieldType) - return fieldType->IsTopLevel((wxRichTextField*) this); + return fieldType->IsTopLevel(const_cast(this)); return true; } @@ -11130,7 +11130,7 @@ wxRichTextCell* wxRichTextTable::GetCell(int row, int col) const wxRichTextSelection wxRichTextTable::GetSelection(long start, long end) const { wxRichTextSelection selection; - selection.SetContainer((wxRichTextTable*) this); + selection.SetContainer(const_cast(this)); if (start > end) { @@ -12815,7 +12815,7 @@ bool wxRichTextImage::GetRangeSize(const wxRichTextRange& range, wxSize& size, i return false; wxSize imageSize; - if (!((wxRichTextImage*)this)->LoadImageCache(dc, context, imageSize, false, parentSize)) + if (!const_cast(this)->LoadImageCache(dc, context, imageSize, false, parentSize)) { size.x = 0; size.y = 0; if (partialExtents) @@ -12824,7 +12824,7 @@ bool wxRichTextImage::GetRangeSize(const wxRichTextRange& range, wxSize& size, i } wxRichTextAttr attr(GetAttributes()); - ((wxRichTextObject*)this)->AdjustAttributes(attr, context); + const_cast(this)->AdjustAttributes(attr, context); wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect; contentRect = wxRect(wxPoint(0,0), imageSize); diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index 2af028ed7b..003dd761f3 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -3239,8 +3239,8 @@ wxTextCtrlHitTestResult wxRichTextCtrl::HitTest(const wxPoint& pt, long * pos) const { - wxClientDC dc((wxRichTextCtrl*) this); - ((wxRichTextCtrl*)this)->PrepareDC(dc); + wxClientDC dc(const_cast(this)); + const_cast(this)->PrepareDC(dc); // Buffer uses logical position (relative to start of buffer) // so convert @@ -3248,8 +3248,8 @@ wxRichTextCtrl::HitTest(const wxPoint& pt, wxRichTextObject* hitObj = NULL; wxRichTextObject* contextObj = NULL; - wxRichTextDrawingContext context((wxRichTextBuffer*) & GetBuffer()); - int hit = ((wxRichTextCtrl*)this)->GetFocusObject()->HitTest(dc, context, pt2, *pos, & hitObj, & contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS); + wxRichTextDrawingContext context(const_cast(&GetBuffer())); + int hit = const_cast(this)->GetFocusObject()->HitTest(dc, context, pt2, *pos, &hitObj, &contextObj, wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS); if ((hit & wxRICHTEXT_HITTEST_BEFORE) && (hit & wxRICHTEXT_HITTEST_OUTSIDE)) return wxTE_HT_BEFORE; diff --git a/src/richtext/richtextstyles.cpp b/src/richtext/richtextstyles.cpp index 8e8c2a6fc5..80fb8f2a66 100644 --- a/src/richtext/richtextstyles.cpp +++ b/src/richtext/richtextstyles.cpp @@ -71,7 +71,7 @@ wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTex const wxRichTextStyleDefinition* def = this; while (def) { - styles.Insert((wxObject*) def); + styles.Insert(const_cast(def)); styleNames.Add(def->GetName()); wxString baseStyleName = def->GetBaseStyle(); @@ -756,7 +756,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons if (attr.GetLeftIndent() > 0) { - wxClientDC dc((wxWindow*) this); + wxClientDC dc(const_cast(this)); str << wxT(""); } diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp index 1a00d15463..277c4ff9f9 100644 --- a/src/unix/dialup.cpp +++ b/src/unix/dialup.cpp @@ -420,7 +420,7 @@ void wxDialUpManagerImpl::CheckStatus(bool fromAsync) const // which is OS - specific and then sends the events. NetConnection oldIsOnline = m_IsOnline; - ( /* non-const */ (wxDialUpManagerImpl *)this)->CheckStatusInternal(); + const_cast(this)->CheckStatusInternal(); // now send the events as appropriate: i.e. if the status changed and // if we're in defined state diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index a396c94c05..01d4a61a75 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -50,8 +50,10 @@ extern "C" static int wxCMPFUNC_CONV wxCompareFamilies (const void *a, const void *b) { - const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a); - const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b); + const PangoFontFamily* fam_a = *static_cast(a); + const PangoFontFamily* fam_b = *static_cast(b); + const char* a_name = pango_font_family_get_name(const_cast(fam_a)); + const char* b_name = pango_font_family_get_name(const_cast(fam_b)); return g_utf8_collate (a_name, b_name); } diff --git a/src/unix/glx11.cpp b/src/unix/glx11.cpp index cc6e8c3c8f..e3f87feef8 100644 --- a/src/unix/glx11.cpp +++ b/src/unix/glx11.cpp @@ -502,7 +502,7 @@ wxGLContext::wxGLContext(wxGLCanvas *win, if (fbc) { wx_glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC) - glXGetProcAddress((GLubyte*)"glXCreateContextAttribsARB"); + glXGetProcAddress(reinterpret_cast("glXCreateContextAttribsARB")); } glXDestroyContext( dpy, tempContext ); diff --git a/src/unix/mediactrl_gstplayer.cpp b/src/unix/mediactrl_gstplayer.cpp index 6566dd4010..d82599e102 100644 --- a/src/unix/mediactrl_gstplayer.cpp +++ b/src/unix/mediactrl_gstplayer.cpp @@ -15,8 +15,6 @@ #include "wx/mediactrl.h" -#include // main gstreamer player header - #ifndef WX_PRECOMP #include "wx/log.h" // wxLogDebug/wxLogSysError/wxLogTrace #include "wx/app.h" // wxTheApp->argc, wxTheApp->argv @@ -32,6 +30,10 @@ #include #endif +wxGCC_WARNING_SUPPRESS(cast-qual) +#include // main gstreamer player header +wxGCC_WARNING_RESTORE() + //============================================================================= // Declarations //============================================================================= diff --git a/src/unix/mimetype.cpp b/src/unix/mimetype.cpp index 7f619f6048..97bcd199cb 100644 --- a/src/unix/mimetype.cpp +++ b/src/unix/mimetype.cpp @@ -61,7 +61,7 @@ public: size_t size = file.Length(); wxCharBuffer buffer( size ); - file.Read( (void*) (const char*) buffer, size ); + file.Read(buffer.data(), size); // Check for valid UTF-8 here? wxString all = wxString::FromUTF8( buffer, size ); diff --git a/src/unix/sound.cpp b/src/unix/sound.cpp index 355fc8673d..41825cb284 100644 --- a/src/unix/sound.cpp +++ b/src/unix/sound.cpp @@ -717,7 +717,7 @@ bool wxSound::LoadWAV(const void* data_, size_t length, bool copyData) memcpy(m_data->m_dataWithHeader, data, length); } else - m_data->m_dataWithHeader = (wxUint8*)data; + m_data->m_dataWithHeader = const_cast(data); m_data->m_data = (&m_data->m_dataWithHeader[FMT_INDEX + waveformat.uiSize + 8]); diff --git a/src/unix/threadpsx.cpp b/src/unix/threadpsx.cpp index 0e54c0a83b..256ef53919 100644 --- a/src/unix/threadpsx.cpp +++ b/src/unix/threadpsx.cpp @@ -1462,7 +1462,7 @@ void wxThread::SetPriority(unsigned int prio) unsigned int wxThread::GetPriority() const { - wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); + wxCriticalSectionLocker lock(m_critsect); return m_internal->GetPriority(); } @@ -1765,14 +1765,14 @@ wxThread::~wxThread() bool wxThread::IsRunning() const { - wxCriticalSectionLocker lock((wxCriticalSection &)m_critsect); + wxCriticalSectionLocker lock(m_critsect); return m_internal->GetState() == STATE_RUNNING; } bool wxThread::IsAlive() const { - wxCriticalSectionLocker lock((wxCriticalSection&)m_critsect); + wxCriticalSectionLocker lock(m_critsect); switch ( m_internal->GetState() ) { @@ -1787,7 +1787,7 @@ bool wxThread::IsAlive() const bool wxThread::IsPaused() const { - wxCriticalSectionLocker lock((wxCriticalSection&)m_critsect); + wxCriticalSectionLocker lock(m_critsect); return (m_internal->GetState() == STATE_PAUSED); } diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 9681cc6354..709fcad43b 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -1265,7 +1265,7 @@ bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspace #if defined(HAVE_STATFS) || defined(HAVE_STATVFS) // the case to "char *" is needed for AIX 4.3 wxStatfs_t fs; - if ( wxStatfs((char *)(const char*)path.fn_str(), &fs) != 0 ) + if ( wxStatfs(const_cast(static_cast(path.fn_str())), &fs) != 0 ) { wxLogSysError( wxT("Failed to get file system statistics") ); diff --git a/tests/mbconv/mbconvtest.cpp b/tests/mbconv/mbconvtest.cpp index ae192bf0a4..0b151cd43f 100644 --- a/tests/mbconv/mbconvtest.cpp +++ b/tests/mbconv/mbconvtest.cpp @@ -259,7 +259,7 @@ void MBConvTestCase::WC2CP1250() // it's very useful when debugging a failed test. wxString CByteArrayFormat( const void* data, size_t len, const wxChar* name ) { - const unsigned char* bytes = (unsigned char*)data; + const unsigned char* bytes = static_cast(data); wxString result; result.Printf( wxT("static const unsigned char %s[%i] = \n{"), name, (int)len ); diff --git a/tests/strings/unicode.cpp b/tests/strings/unicode.cpp index 7fb69b4728..79b3092943 100644 --- a/tests/strings/unicode.cpp +++ b/tests/strings/unicode.cpp @@ -199,8 +199,8 @@ void UnicodeTestCase::ConstructorsWithConversion() // the string "Déjà" in UTF-8 and wchar_t: const unsigned char utf8Buf[] = {0x44,0xC3,0xA9,0x6A,0xC3,0xA0,0}; const unsigned char utf8subBuf[] = {0x44,0xC3,0xA9,0x6A,0}; // just "Déj" - const char *utf8 = (char *)utf8Buf; - const char *utf8sub = (char *)utf8subBuf; + const char* utf8 = reinterpret_cast(utf8Buf); + const char* utf8sub = reinterpret_cast(utf8subBuf); wxString s1(utf8, wxConvUTF8); From 05183b7099179e07c8f99c452ad0c48c733b261f Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 2 Feb 2020 23:40:01 -0800 Subject: [PATCH 027/329] Eliminate -Wzero-as-null-pointer-constant warnings in the headers --- include/wx/dataview.h | 2 +- include/wx/dc.h | 2 +- include/wx/dynlib.h | 12 +++++------ include/wx/dynload.h | 2 +- include/wx/event.h | 2 +- include/wx/gdiobj.h | 2 +- include/wx/html/htmprint.h | 2 +- include/wx/msw/dib.h | 10 ++++----- include/wx/msw/enhmeta.h | 4 ++-- include/wx/msw/font.h | 4 ++-- include/wx/msw/gdiimage.h | 6 +++--- include/wx/msw/ole/automtn.h | 2 +- include/wx/msw/private.h | 9 +++++---- include/wx/msw/registry.h | 2 +- include/wx/msw/window.h | 2 +- include/wx/object.h | 2 +- include/wx/quantize.h | 4 ++-- include/wx/rtti.h | 2 +- include/wx/thread.h | 2 +- include/wx/translation.h | 2 +- include/wx/utils.h | 4 ++-- include/wx/wxcrt.h | 39 ++++++++++++++++++------------------ 22 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 52c2f98cea..61ce45e2de 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -709,7 +709,7 @@ public: wxDataViewItem GetCurrentItem() const; void SetCurrentItem(const wxDataViewItem& item); - virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(0); } + virtual wxDataViewItem GetTopItem() const { return wxDataViewItem(NULL); } virtual int GetCountPerPage() const { return wxNOT_FOUND; } // Currently focused column of the current item or NULL if no column has focus diff --git a/include/wx/dc.h b/include/wx/dc.h index cc0a48238e..088c22c683 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -1327,7 +1327,7 @@ public: : m_dc(thdc.m_dc), m_hdc(thdc.m_hdc) { - const_cast(thdc).m_hdc = 0; + const_cast(thdc).m_hdc = NULL; } ~TempHDC() diff --git a/include/wx/dynlib.h b/include/wx/dynlib.h index 0f035d904f..4ea6b8a60c 100644 --- a/include/wx/dynlib.h +++ b/include/wx/dynlib.h @@ -231,9 +231,9 @@ public: // return the platform standard DLL extension (with leading dot) static wxString GetDllExt(wxDynamicLibraryCategory cat = wxDL_LIBRARY); - wxDynamicLibrary() : m_handle(0) { } + wxDynamicLibrary() : m_handle(NULL) { } wxDynamicLibrary(const wxString& libname, int flags = wxDL_DEFAULT) - : m_handle(0) + : m_handle(NULL) { Load(libname, flags); } @@ -243,7 +243,7 @@ public: ~wxDynamicLibrary() { Unload(); } // return true if the library was loaded successfully - bool IsLoaded() const { return m_handle != 0; } + bool IsLoaded() const { return m_handle != NULL; } // load the library with the given name (full or not), return true if ok bool Load(const wxString& libname, int flags = wxDL_DEFAULT); @@ -256,13 +256,13 @@ public: // detach the library object from its handle, i.e. prevent the object from // unloading the library in its dtor -- the caller is now responsible for // doing this - wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; } + wxDllType Detach() { wxDllType h = m_handle; m_handle = NULL; return h; } // unload the given library handle (presumably returned by Detach() before) static void Unload(wxDllType handle); // unload the library, also done automatically in dtor - void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = 0; } } + void Unload() { if ( IsLoaded() ) { Unload(m_handle); m_handle = NULL; } } // Return the raw handle from dlopen and friends. wxDllType GetLibHandle() const { return m_handle; } @@ -363,7 +363,7 @@ public: protected: // common part of GetSymbol() and HasSymbol() - void *DoGetSymbol(const wxString& name, bool *success = 0) const; + void* DoGetSymbol(const wxString& name, bool* success = NULL) const; #ifdef wxHAVE_DYNLIB_ERROR // log the error after a dlxxx() function failure diff --git a/include/wx/dynload.h b/include/wx/dynload.h index 7cb4d25bac..79239cbf11 100644 --- a/include/wx/dynload.h +++ b/include/wx/dynload.h @@ -123,7 +123,7 @@ public: void Unload(); bool IsLoaded() const { return m_entry && m_entry->IsLoaded(); } - void *GetSymbol(const wxString &symbol, bool *success = 0) + void* GetSymbol(const wxString& symbol, bool* success = NULL) { return m_entry->GetSymbol( symbol, success ); } diff --git a/include/wx/event.h b/include/wx/event.h index fd25c7a1ca..482758b7a2 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -91,7 +91,7 @@ typedef int wxEventType; wxEventTableEntry(type, winid, idLast, wxNewEventTableFunctor(type, fn), obj) #define wxDECLARE_EVENT_TABLE_TERMINATOR() \ - wxEventTableEntry(wxEVT_NULL, 0, 0, 0, 0) + wxEventTableEntry(wxEVT_NULL, 0, 0, NULL, NULL) // generate a new unique event type extern WXDLLIMPEXP_BASE wxEventType wxNewEventType(); diff --git a/include/wx/gdiobj.h b/include/wx/gdiobj.h index 81d1f46a6b..d8e7956006 100644 --- a/include/wx/gdiobj.h +++ b/include/wx/gdiobj.h @@ -66,7 +66,7 @@ public: virtual bool IsFree() const { return false; } // Returns handle. - virtual WXHANDLE GetResourceHandle() const { return 0; } + virtual WXHANDLE GetResourceHandle() const { return NULL; } #endif // defined(__WXMSW__) protected: diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h index 554413d44c..00a318983d 100644 --- a/include/wx/html/htmprint.h +++ b/include/wx/html/htmprint.h @@ -257,7 +257,7 @@ public: // pg is one of wxPAGE_ODD, wxPAGE_EVEN and wx_PAGE_ALL constants. // You can set different header/footer for odd and even pages - void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes = 0); + void SetFonts(const wxString& normal_face, const wxString& fixed_face, const int* sizes = NULL); // Sets fonts to be used when displaying HTML page. (if size null then default sizes used) // Sets font sizes to be relative to the given size or the system diff --git a/include/wx/msw/dib.h b/include/wx/msw/dib.h index 3b068879bc..29cf56a202 100644 --- a/include/wx/msw/dib.h +++ b/include/wx/msw/dib.h @@ -73,11 +73,11 @@ public: // create a bitmap compatible with the given HDC (or screen by default) and // return its handle, the caller is responsible for freeing it (using // DeleteObject()) - HBITMAP CreateDDB(HDC hdc = 0) const; + HBITMAP CreateDDB(HDC hdc = NULL) const; // get the handle from the DIB and reset it, i.e. this object won't destroy // the DIB after this (but the caller should do it) - HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; } + HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = NULL; return hbmp; } #if defined(__WXMSW__) && wxUSE_PALETTE // create a palette for this DIB (always a trivial/default one for 24bpp) @@ -92,7 +92,7 @@ public: // --------- // return true if DIB was successfully created, false otherwise - bool IsOk() const { return m_handle != 0; } + bool IsOk() const { return m_handle != NULL; } // get the bitmap size wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); } @@ -121,7 +121,7 @@ public: // a plain DIB or a DIB section (in which case the last parameter must be // non NULL) static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi, - HDC hdc = 0, + HDC hdc = NULL, const void *bits = NULL); // create a plain DIB (not a DIB section) from a DDB, the caller is @@ -242,7 +242,7 @@ private: inline void wxDIB::Init() { - m_handle = 0; + m_handle = NULL; m_ownsHandle = true; m_data = NULL; diff --git a/include/wx/msw/enhmeta.h b/include/wx/msw/enhmeta.h index bd6c5f729e..80f380cf31 100644 --- a/include/wx/msw/enhmeta.h +++ b/include/wx/msw/enhmeta.h @@ -43,7 +43,7 @@ public: bool Play(wxDC *dc, wxRect *rectBound = NULL); // accessors - virtual bool IsOk() const wxOVERRIDE { return m_hMF != 0; } + virtual bool IsOk() const wxOVERRIDE { return m_hMF != NULL; } wxSize GetSize() const; int GetWidth() const { return GetSize().x; } @@ -59,7 +59,7 @@ public: // Detach the HENHMETAFILE from this object, i.e. don't delete the handle // in the dtor -- the caller is now responsible for doing this, e.g. using // Free() method below. - WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = 0; return h; } + WXHANDLE Detach() { WXHANDLE h = m_hMF; m_hMF = NULL; return h; } // Destroy the given HENHMETAFILE object. static void Free(WXHANDLE handle); diff --git a/include/wx/msw/font.h b/include/wx/msw/font.h index 70ede34b88..ed75e8890f 100644 --- a/include/wx/msw/font.h +++ b/include/wx/msw/font.h @@ -65,7 +65,7 @@ public: underlined, face, encoding); } - wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) + wxFont(const wxNativeFontInfo& info, WXHFONT hFont = NULL) { Create(info, hFont); } @@ -90,7 +90,7 @@ public: encoding)); } - bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); + bool Create(const wxNativeFontInfo& info, WXHFONT hFont = NULL); virtual ~wxFont(); diff --git a/include/wx/msw/gdiimage.h b/include/wx/msw/gdiimage.h index 9f39219c67..94b6f01091 100644 --- a/include/wx/msw/gdiimage.h +++ b/include/wx/msw/gdiimage.h @@ -36,7 +36,7 @@ public: { m_width = m_height = m_depth = 0; - m_handle = 0; + m_handle = NULL; } wxGDIImageRefData(const wxGDIImageRefData& data) : wxGDIRefData() @@ -50,7 +50,7 @@ public: } // accessors - virtual bool IsOk() const wxOVERRIDE { return m_handle != 0; } + virtual bool IsOk() const wxOVERRIDE { return m_handle != NULL; } void SetSize(int w, int h) { m_width = w; m_height = h; } @@ -104,7 +104,7 @@ public: // accessors WXHANDLE GetHandle() const - { return IsNull() ? 0 : GetGDIImageData()->m_handle; } + { return IsNull() ? NULL : GetGDIImageData()->m_handle; } void SetHandle(WXHANDLE handle) { AllocExclusive(); GetGDIImageData()->m_handle = handle; } diff --git a/include/wx/msw/ole/automtn.h b/include/wx/msw/ole/automtn.h index 1d1eb33af3..beea810f6e 100644 --- a/include/wx/msw/ole/automtn.h +++ b/include/wx/msw/ole/automtn.h @@ -67,7 +67,7 @@ public: // Low-level invocation function. Pass either an array of variants, // or an array of pointers to variants. bool Invoke(const wxString& member, int action, - wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const; + wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = NULL) const; // Invoke a member function wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]); diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index e413799050..9dc7357958 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -162,7 +162,8 @@ protected: // implicitly convertible to HANDLE, which is a pointer. static HANDLE InvalidHandle() { - return reinterpret_cast(INVALID_VALUE); + wxUIntPtr h = INVALID_VALUE; + return reinterpret_cast(h); } void DoClose() @@ -449,7 +450,7 @@ private: class MemoryHDC { public: - MemoryHDC(HDC hdc = 0) { m_hdc = ::CreateCompatibleDC(hdc); } + MemoryHDC(HDC hdc = NULL) { m_hdc = ::CreateCompatibleDC(hdc); } ~MemoryHDC() { ::DeleteDC(m_hdc); } operator HDC() const { return m_hdc; } @@ -483,7 +484,7 @@ public: ~SelectInHDC() { if ( m_hdc ) ::SelectObject(m_hdc, m_hgdiobj); } // return true if the object was successfully selected - operator bool() const { return m_hgdiobj != 0; } + operator bool() const { return m_hgdiobj != NULL; } private: HDC m_hdc; @@ -578,7 +579,7 @@ class MonoBitmap : public AutoHBITMAP { public: MonoBitmap(int w, int h) - : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, 0)) + : AutoHBITMAP(::CreateBitmap(w, h, 1, 1, NULL)) { } }; diff --git a/include/wx/msw/registry.h b/include/wx/msw/registry.h index 783706f4e4..ae43a075ba 100644 --- a/include/wx/msw/registry.h +++ b/include/wx/msw/registry.h @@ -136,7 +136,7 @@ public: size_t *pnValues, // number of values size_t *pnMaxValueLen) const; // return true if the key is opened - bool IsOpened() const { return m_hKey != 0; } + bool IsOpened() const { return m_hKey != NULL; } // for "if ( !key ) wxLogError(...)" kind of expressions operator bool() const { return m_dwLastError == 0; } diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 230d099b27..47203237f1 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -453,7 +453,7 @@ public: // The brush returned from here must remain valid at least until the next // event loop iteration. Returning 0, as is done by default, indicates // there is no custom background brush. - virtual WXHBRUSH MSWGetCustomBgBrush() { return 0; } + virtual WXHBRUSH MSWGetCustomBgBrush() { return NULL; } // this function should return the brush to paint the children controls // background or 0 if this window doesn't impose any particular background diff --git a/include/wx/object.h b/include/wx/object.h index 1dd57cd654..f210ec0faf 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -150,7 +150,7 @@ name##PluginSentinel m_pluginsentinel // The 'this' pointer is always true, so use this version // to cast the this pointer and avoid compiler warnings. #define wxDynamicCastThis(className) \ - (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0) + (IsKindOf(&className::ms_classInfo) ? (className*)this : NULL) template inline T *wxCheckCast(const void *ptr) diff --git a/include/wx/quantize.h b/include/wx/quantize.h index 366194f1f3..b3a722df8c 100644 --- a/include/wx/quantize.h +++ b/include/wx/quantize.h @@ -52,13 +52,13 @@ public: // If you pass a palette pointer, you must free the palette yourself. static bool Quantize(const wxImage& src, wxImage& dest, wxPalette** pPalette, int desiredNoColours = 236, - unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); // This version sets a palette in the destination image so you don't // have to manage it yourself. static bool Quantize(const wxImage& src, wxImage& dest, int desiredNoColours = 236, - unsigned char** eightBitData = 0, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); + unsigned char** eightBitData = NULL, int flags = wxQUANTIZE_INCLUDE_WINDOWS_COLOURS|wxQUANTIZE_FILL_DESTINATION_IMAGE|wxQUANTIZE_RETURN_8BIT_DATA); //// Helpers diff --git a/include/wx/rtti.h b/include/wx/rtti.h index 34d8d387bf..55deaf301a 100644 --- a/include/wx/rtti.h +++ b/include/wx/rtti.h @@ -62,7 +62,7 @@ public: ~wxClassInfo(); wxObject *CreateObject() const - { return m_objectConstructor ? (*m_objectConstructor)() : 0; } + { return m_objectConstructor ? (*m_objectConstructor)() : NULL; } bool IsDynamic() const { return (NULL != m_objectConstructor); } const wxChar *GetClassName() const { return m_className; } diff --git a/include/wx/thread.h b/include/wx/thread.h index 872609ca30..5e90bb63ab 100644 --- a/include/wx/thread.h +++ b/include/wx/thread.h @@ -598,7 +598,7 @@ public: protected: // exits from the current thread - can be called only from this thread - void Exit(ExitCode exitcode = 0); + void Exit(ExitCode exitcode = NULL); // entry point for the thread - called by Run() and executes in the context // of this thread. diff --git a/include/wx/translation.h b/include/wx/translation.h index 3d5d5b0b83..df43a6def8 100644 --- a/include/wx/translation.h +++ b/include/wx/translation.h @@ -247,7 +247,7 @@ protected: virtual wxString GetResourceType() const { return "MOFILE"; } // returns module to load resources from - virtual WXHINSTANCE GetModule() const { return 0; } + virtual WXHINSTANCE GetModule() const { return NULL; } }; #endif // __WINDOWS__ diff --git a/include/wx/utils.h b/include/wx/utils.h index 8e0996f24a..0a8e6371c6 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -840,7 +840,7 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); size_t *outLen, const wxString& resourceName, const wxChar* resourceType = wxUserResourceStr, - WXHINSTANCE module = 0); + WXHINSTANCE module = NULL); // This function allocates a new buffer and makes a copy of the resource // data, remember to delete[] the buffer. And avoid using it entirely if @@ -851,7 +851,7 @@ WXDLLIMPEXP_CORE bool wxYieldIfNeeded(); wxLoadUserResource(const wxString& resourceName, const wxChar* resourceType = wxUserResourceStr, int* pLen = NULL, - WXHINSTANCE module = 0); + WXHINSTANCE module = NULL); #endif // __WINDOWS__ #endif diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index d239f6cfeb..97686b0221 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -858,21 +858,20 @@ template<> struct wxStrtoxCharType template inline double wxStrtod(const wxString& nptr, T endptr) { - // Explicit comparison with 0 required when using T=nullptr with MSVS 2012. - if (endptr != 0) + if (!endptr) { - // note that it is important to use c_str() here and not mb_str() or - // wc_str(), because we store the pointer into (possibly converted) - // buffer in endptr and so it must be valid even when wxStrtod() returns - typedef typename wxStrtoxCharType::Type CharType; - return wxStrtod((CharType)nptr.c_str(), - wxStrtoxCharType::AsPointer(endptr)); + // when we don't care about endptr, use the string representation that + // doesn't require any conversion (it doesn't matter for this function + // even if its UTF-8): + wxStringCharType** p = NULL; + return wxStrtod(nptr.wx_str(), p); } - // when we don't care about endptr, use the string representation that - // doesn't require any conversion (it doesn't matter for this function - // even if its UTF-8): - wxStringCharType** p = NULL; - return wxStrtod(nptr.wx_str(), p); + // note that it is important to use c_str() here and not mb_str() or + // wc_str(), because we store the pointer into (possibly converted) + // buffer in endptr and so it must be valid even when wxStrtod() returns + typedef typename wxStrtoxCharType::Type CharType; + return wxStrtod((CharType)nptr.c_str(), + wxStrtoxCharType::AsPointer(endptr)); } template inline double wxStrtod(const wxCStrData& nptr, T endptr) @@ -891,15 +890,15 @@ inline double wxStrtod(const wxCStrData& nptr, T endptr) template \ inline rettype name(const wxString& nptr, T endptr, int base) \ { \ - if (endptr) \ + if (!endptr) \ { \ - typedef typename wxStrtoxCharType::Type CharType; \ - return name((CharType)nptr.c_str(), \ - wxStrtoxCharType::AsPointer(endptr), \ - base); \ + wxStringCharType** p = NULL; \ + return name(nptr.wx_str(), p, base); \ } \ - wxStringCharType** p = NULL; \ - return name(nptr.wx_str(), p, base); \ + typedef typename wxStrtoxCharType::Type CharType; \ + return name((CharType)nptr.c_str(), \ + wxStrtoxCharType::AsPointer(endptr), \ + base); \ } \ template \ inline rettype name(const wxCStrData& nptr, T endptr, int base) \ From 0ca45d1a59a51e6798b99eaa0e7fdbbcc33c3992 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 2 Feb 2020 23:51:39 -0800 Subject: [PATCH 028/329] Remove redundant checks for NULL before calling delete --- include/wx/dataview.h | 2 +- include/wx/dnd.h | 2 +- include/wx/encconv.h | 2 +- src/common/clntdata.cpp | 4 +--- src/common/cmndata.cpp | 3 +-- src/common/ctrlsub.cpp | 3 +-- src/common/datavcmn.cpp | 3 +-- src/common/event.cpp | 3 +-- src/common/fmapbase.cpp | 3 +-- src/common/fswatchercmn.cpp | 5 +---- src/common/gbsizer.cpp | 24 +++++++++--------------- src/common/mediactrlcmn.cpp | 3 +-- src/common/mimecmn.cpp | 6 ++---- src/common/prntbase.cpp | 13 ++++--------- src/common/wincmn.cpp | 13 +++---------- src/generic/dirctrlg.cpp | 2 +- src/generic/dragimgg.cpp | 5 +---- src/generic/printps.cpp | 2 +- src/gtk/window.cpp | 2 +- src/html/helpwnd.cpp | 6 +++--- src/html/m_image.cpp | 3 +-- src/unix/dialup.cpp | 2 +- src/unix/fswatcher_inotify.cpp | 3 +-- 23 files changed, 39 insertions(+), 75 deletions(-) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 61ce45e2de..99b620d84d 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -1213,7 +1213,7 @@ public: const wxIcon &GetIcon() const { return m_icon; } void SetData( wxClientData *data ) - { if (m_data) delete m_data; m_data = data; } + { delete m_data; m_data = data; } wxClientData *GetData() const { return m_data; } diff --git a/include/wx/dnd.h b/include/wx/dnd.h index 2f3f333329..cb158927d2 100644 --- a/include/wx/dnd.h +++ b/include/wx/dnd.h @@ -144,7 +144,7 @@ public: wxDataObject *GetDataObject() const { return m_dataObject; } void SetDataObject(wxDataObject *dataObject) - { if (m_dataObject) delete m_dataObject; + { delete m_dataObject; m_dataObject = dataObject; } // these functions are called when data is moved over position (x, y) and diff --git a/include/wx/encconv.h b/include/wx/encconv.h index 7c49465f51..cf1360ec07 100644 --- a/include/wx/encconv.h +++ b/include/wx/encconv.h @@ -53,7 +53,7 @@ class WXDLLIMPEXP_BASE wxEncodingConverter : public wxObject public: wxEncodingConverter(); - virtual ~wxEncodingConverter() { if (m_Table) delete[] m_Table; } + virtual ~wxEncodingConverter() { delete[] m_Table; } // Initialize conversion. Both output or input encoding may // be wxFONTENCODING_UNICODE. diff --git a/src/common/clntdata.cpp b/src/common/clntdata.cpp index 1cb5595785..8ecddc2241 100644 --- a/src/common/clntdata.cpp +++ b/src/common/clntdata.cpp @@ -40,9 +40,7 @@ void wxClientDataContainer::DoSetClientObject( wxClientData *data ) wxASSERT_MSG( m_clientDataType != wxClientData_Void, wxT("can't have both object and void client data") ); - if ( m_clientObject ) - delete m_clientObject; - + delete m_clientObject; m_clientObject = data; m_clientDataType = wxClientData_Object; } diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 92b8ba4633..3361c17d04 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -107,8 +107,7 @@ wxPrintData::~wxPrintData() if (m_nativeData->m_ref == 0) delete m_nativeData; - if (m_privData) - delete [] m_privData; + delete[] m_privData; } void wxPrintData::ConvertToNative() diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index 03435b7056..d680c3c1ca 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -170,8 +170,7 @@ void wxItemContainer::SetClientObject(unsigned int n, wxClientData *data) { wxClientData * clientDataOld = static_cast(DoGetItemClientData(n)); - if ( clientDataOld ) - delete clientDataOld; + delete clientDataOld; } else // didn't have any client data so far { diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 1099b653a6..76073485e1 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -2485,8 +2485,7 @@ wxDataViewTreeStoreNode::wxDataViewTreeStoreNode( wxDataViewTreeStoreNode::~wxDataViewTreeStoreNode() { - if (m_data) - delete m_data; + delete m_data; } wxDataViewTreeStoreContainerNode::wxDataViewTreeStoreContainerNode( diff --git a/src/common/event.cpp b/src/common/event.cpp index 83820b54b4..e453b9694e 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -1919,8 +1919,7 @@ void wxEvtHandler::DoSetClientObject( wxClientData *data ) wxASSERT_MSG( m_clientDataType != wxClientData_Void, wxT("can't have both object and void client data") ); - if ( m_clientObject ) - delete m_clientObject; + delete m_clientObject; m_clientObject = data; m_clientDataType = wxClientData_Object; diff --git a/src/common/fmapbase.cpp b/src/common/fmapbase.cpp index 0c434aef67..1fafeb4234 100644 --- a/src/common/fmapbase.cpp +++ b/src/common/fmapbase.cpp @@ -407,8 +407,7 @@ wxFontMapperBase::wxFontMapperBase() wxFontMapperBase::~wxFontMapperBase() { #if wxUSE_CONFIG && wxUSE_FILECONFIG - if ( m_configDummy ) - delete m_configDummy; + delete m_configDummy; #endif // wxUSE_CONFIG } diff --git a/src/common/fswatchercmn.cpp b/src/common/fswatchercmn.cpp index 133aaa5a2d..f54acd467c 100644 --- a/src/common/fswatchercmn.cpp +++ b/src/common/fswatchercmn.cpp @@ -87,10 +87,7 @@ wxFileSystemWatcherBase::wxFileSystemWatcherBase() : wxFileSystemWatcherBase::~wxFileSystemWatcherBase() { RemoveAll(); - if (m_service) - { - delete m_service; - } + delete m_service; } bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events) diff --git a/src/common/gbsizer.cpp b/src/common/gbsizer.cpp index 1f4e7d25cf..1d43e408e0 100644 --- a/src/common/gbsizer.cpp +++ b/src/common/gbsizer.cpp @@ -182,11 +182,9 @@ wxSizerItem* wxGridBagSizer::Add( wxWindow *window, wxGBSizerItem* item = new wxGBSizerItem(window, pos, span, flag, border, userData); if ( Add(item) ) return item; - else - { - delete item; - return NULL; - } + + delete item; + return NULL; } wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, @@ -196,11 +194,9 @@ wxSizerItem* wxGridBagSizer::Add( wxSizer *sizer, wxGBSizerItem* item = new wxGBSizerItem(sizer, pos, span, flag, border, userData); if ( Add(item) ) return item; - else - { - delete item; - return NULL; - } + + delete item; + return NULL; } wxSizerItem* wxGridBagSizer::Add( int width, int height, @@ -210,11 +206,9 @@ wxSizerItem* wxGridBagSizer::Add( int width, int height, wxGBSizerItem* item = new wxGBSizerItem(width, height, pos, span, flag, border, userData); if ( Add(item) ) return item; - else - { - delete item; - return NULL; - } + + delete item; + return NULL; } wxSizerItem* wxGridBagSizer::Add( wxGBSizerItem *item ) diff --git a/src/common/mediactrlcmn.cpp b/src/common/mediactrlcmn.cpp index 1b272d3948..13b2f503d8 100644 --- a/src/common/mediactrlcmn.cpp +++ b/src/common/mediactrlcmn.cpp @@ -269,8 +269,7 @@ const wxClassInfo* wxMediaCtrl::NextBackend(wxClassInfo::const_iterator* it) //--------------------------------------------------------------------------- wxMediaCtrl::~wxMediaCtrl() { - if (m_imp) - delete m_imp; + delete m_imp; } //--------------------------------------------------------------------------- diff --git a/src/common/mimecmn.cpp b/src/common/mimecmn.cpp index 175fcb205e..a57e657a33 100644 --- a/src/common/mimecmn.cpp +++ b/src/common/mimecmn.cpp @@ -290,8 +290,7 @@ wxFileType::wxFileType() wxFileType::~wxFileType() { - if ( m_impl ) - delete m_impl; + delete m_impl; } bool wxFileType::GetExtensions(wxArrayString& extensions) @@ -589,8 +588,7 @@ wxMimeTypesManager::wxMimeTypesManager() wxMimeTypesManager::~wxMimeTypesManager() { - if ( m_impl ) - delete m_impl; + delete m_impl; } bool wxMimeTypesManager::Unassociate(wxFileType *ft) diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 8794308d95..2ec82bc0c0 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -85,9 +85,7 @@ wxPrintFactory *wxPrintFactory::m_factory = NULL; void wxPrintFactory::SetPrintFactory( wxPrintFactory *factory ) { - if (wxPrintFactory::m_factory) - delete wxPrintFactory::m_factory; - + delete wxPrintFactory::m_factory; wxPrintFactory::m_factory = factory; } @@ -1873,12 +1871,9 @@ void wxPrintPreviewBase::Init(wxPrintout *printout, wxPrintPreviewBase::~wxPrintPreviewBase() { - if (m_previewPrintout) - delete m_previewPrintout; - if (m_previewBitmap) - delete m_previewBitmap; - if (m_printPrintout) - delete m_printPrintout; + delete m_previewPrintout; + delete m_previewBitmap; + delete m_printPrintout; } bool wxPrintPreviewBase::SetCurrentPage(int pageNum) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 9f65f2799b..5d4730ec47 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -1782,11 +1782,7 @@ wxWindow *wxWindowBase::GetAncestorWithCustomPalette() const #if wxUSE_CARET void wxWindowBase::SetCaret(wxCaret *caret) { - if ( m_caret ) - { - delete m_caret; - } - + delete m_caret; m_caret = caret; if ( m_caret ) @@ -1804,8 +1800,7 @@ void wxWindowBase::SetCaret(wxCaret *caret) void wxWindowBase::SetValidator(const wxValidator& validator) { - if ( m_windowValidator ) - delete m_windowValidator; + delete m_windowValidator; m_windowValidator = static_cast(validator.Clone()); @@ -2321,9 +2316,7 @@ void wxWindowBase::DoSetToolTip(wxToolTip *tooltip) { if ( m_tooltip != tooltip ) { - if ( m_tooltip ) - delete m_tooltip; - + delete m_tooltip; m_tooltip = tooltip; } } diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index f5cc1e418d..ef73d79dd2 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -1454,7 +1454,7 @@ wxFileIconsTable::~wxFileIconsTable() WX_CLEAR_HASH_TABLE(*m_HashTable); delete m_HashTable; } - if (m_smallImageList) delete m_smallImageList; + delete m_smallImageList; } // delayed initialization - wait until first use (wxArtProv not created yet) diff --git a/src/generic/dragimgg.cpp b/src/generic/dragimgg.cpp index 9de2d1c401..df9c1b66a5 100644 --- a/src/generic/dragimgg.cpp +++ b/src/generic/dragimgg.cpp @@ -58,10 +58,7 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxGenericDragImage, wxObject); wxGenericDragImage::~wxGenericDragImage() { - if (m_windowDC) - { - delete m_windowDC; - } + delete m_windowDC; } void wxGenericDragImage::Init() diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index efcdb879b6..d7284268d9 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -100,7 +100,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro // May have pressed cancel. if (!dc || !dc->IsOk()) { - if (dc) delete dc; + delete dc; sm_lastError = wxPRINTER_ERROR; return false; } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index f771bbad11..6cde78417e 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -5777,7 +5777,7 @@ void wxWindowGTK::SetDropTarget( wxDropTarget *dropTarget ) if (m_dropTarget) m_dropTarget->GtkUnregisterWidget( dnd_widget ); - if (m_dropTarget) delete m_dropTarget; + delete m_dropTarget; m_dropTarget = dropTarget; if (m_dropTarget) m_dropTarget->GtkRegisterWidget( dnd_widget ); diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index 1a896be108..d03c710764 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -605,15 +605,15 @@ wxHtmlHelpWindow::~wxHtmlHelpWindow() // PopEventHandler(); // wxhtmlhelpcontroller (not any more!) if (m_DataCreated) delete m_Data; - if (m_NormalFonts) delete m_NormalFonts; - if (m_FixedFonts) delete m_FixedFonts; + delete m_NormalFonts; + delete m_FixedFonts; if (m_PagesHash) { WX_CLEAR_HASH_TABLE(*m_PagesHash); delete m_PagesHash; } #if wxUSE_PRINTING_ARCHITECTURE - if (m_Printer) delete m_Printer; + delete m_Printer; #endif } diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 2d67921074..edef506fd1 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -757,8 +757,7 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA") cel->SetId(tag.GetParam(wxT("id"))); // may be empty cel->SetAlt(tag.GetParam(wxT("alt"))); m_WParser->GetContainer()->InsertCell(cel); - if (str) - delete str; + delete str; } } if (tag.GetName() == wxT("MAP")) diff --git a/src/unix/dialup.cpp b/src/unix/dialup.cpp index 277c4ff9f9..3bce0e2211 100644 --- a/src/unix/dialup.cpp +++ b/src/unix/dialup.cpp @@ -304,7 +304,7 @@ wxDialUpManagerImpl::wxDialUpManagerImpl() wxDialUpManagerImpl::~wxDialUpManagerImpl() { - if(m_timer) delete m_timer; + delete m_timer; if(m_DialProcess) { m_DialProcess->Disconnect(); diff --git a/src/unix/fswatcher_inotify.cpp b/src/unix/fswatcher_inotify.cpp index 1571eb51f5..cbfeae3d56 100644 --- a/src/unix/fswatcher_inotify.cpp +++ b/src/unix/fswatcher_inotify.cpp @@ -703,8 +703,7 @@ wxInotifyFileSystemWatcher::wxInotifyFileSystemWatcher(const wxFileName& path, { if (!Init()) { - if (m_service) - delete m_service; + delete m_service; return; } From ad7dfba12475a6cae99d2eb48d1024eebd0fcc2a Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 3 Feb 2020 08:59:22 -0800 Subject: [PATCH 029/329] STL build fix after 948ddc6e0f --- src/common/wincmn.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 5d4730ec47..0ea559aab3 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -3493,7 +3493,7 @@ wxWindow *wxWindowBase::DoGetSibling(WindowOrder order) const wxT("GetPrev/NextSibling() don't work for TLWs!") ); wxWindowList& siblings = GetParent()->GetChildren(); - wxWindowList::compatibility_iterator i = siblings.Find(this); + wxWindowList::compatibility_iterator i = siblings.Find(static_cast(this)); wxCHECK_MSG( i, NULL, wxT("window not a child of its parent?") ); if ( order == OrderBefore ) From f4299c3c01991b2dbba59d194397b33791bd5cb1 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 3 Feb 2020 09:02:14 -0800 Subject: [PATCH 030/329] Eliminate a couple more -Wcast-qual warnings --- include/wx/list.h | 2 +- src/stc/gen_iface.py | 2 +- src/stc/stc.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/list.h b/include/wx/list.h index 40f5b79341..ee55b58e9c 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -71,7 +71,7 @@ class wxList_SortFunction public: wxList_SortFunction(wxSortCompareFunction f) : m_f(f) { } bool operator()(const T& i1, const T& i2) - { return m_f((T*)&i1, (T*)&i2) < 0; } + { return m_f(&i1, &i2) < 0; } private: wxSortCompareFunction m_f; }; diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 04ff317485..6e976fded1 100755 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -552,7 +552,7 @@ methodOverrideMap = { ft.chrg.cpMin = minPos; ft.chrg.cpMax = maxPos; const wxWX2MBbuf buf = wx2stc(text); - ft.lpstrText = (char*)(const char*)buf; + ft.lpstrText = buf; int pos = SendMsg(%s, flags, (sptr_t)&ft); if (findEnd) *findEnd=(pos==-1?wxSTC_INVALID_POSITION:ft.chrgText.cpMax); diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index df2bd96efb..561379d7d3 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -1702,7 +1702,7 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos, const wxString& text, ft.chrg.cpMin = minPos; ft.chrg.cpMax = maxPos; const wxWX2MBbuf buf = wx2stc(text); - ft.lpstrText = (char*)(const char*)buf; + ft.lpstrText = buf; int pos = SendMsg(SCI_FINDTEXT, flags, (sptr_t)&ft); if (findEnd) *findEnd=(pos==-1?wxSTC_INVALID_POSITION:ft.chrgText.cpMax); From 1a9da25c3376efd617a532ef369e984c99f0b84b Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 3 Feb 2020 09:33:09 -0800 Subject: [PATCH 031/329] STL build fix for MSVS after 948ddc6e0f --- include/wx/dynarray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index 23be3289be..67dc5e6f5e 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -391,7 +391,7 @@ public: void Insert(const T* pItem, size_t uiIndex) { - base::insert(this->begin() + uiIndex, pItem); + base::insert(this->begin() + uiIndex, const_cast(pItem)); } void Empty() { DoEmpty(); base::clear(); } From 6e52a705829a45b7009cefac94d54215fedc9ec3 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 3 Feb 2020 09:34:01 -0800 Subject: [PATCH 032/329] Build fix after 948ddc6e0f --- samples/dragimag/dragimag.cpp | 2 +- samples/dragimag/dragimag.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index a39554653c..4f12f85ef9 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -429,7 +429,7 @@ int MyApp::OnExit() return 0; } -bool MyApp::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap) +bool MyApp::TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap) { int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); diff --git a/samples/dragimag/dragimag.h b/samples/dragimag/dragimag.h index 53036676e1..4cea6af06b 100644 --- a/samples/dragimag/dragimag.h +++ b/samples/dragimag/dragimag.h @@ -50,7 +50,7 @@ public: //// Operations // Tile the bitmap - bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap); + bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); //// Accessors const wxBitmap& GetBackgroundBitmap() const { return m_background; } From 72824bc2691c4e2ec43854c24e31dfa33f96ee5d Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Wed, 29 Jan 2020 05:06:03 +0700 Subject: [PATCH 033/329] Fix text cropping when using ellipsization in wxGrid A text is cropped for cells with ellipsization enabled when width of the cell nearly equal to width of the text because wxGrid::DrawTextRectangle function variant with the parameter of type wxArrayString adds the offset before actually drawing the text using dc.DrawText or dc.DrawRotatedText. --- src/generic/grid.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 047c6f95f2..3b48669133 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6831,13 +6831,16 @@ void wxGrid::DrawTextRectangle(wxDC& dc, { attr.GetNonDefaultAlignment(&hAlign, &vAlign); + // The text will be displaced in final wxGrid::DrawTextRectangle function. + const int textMargin = 2; + // This does nothing if there is no need to ellipsize. const wxString& ellipsizedText = wxControl::Ellipsize ( text, dc, attr.GetFitMode().GetEllipsizeMode(), - rect.GetWidth(), + rect.GetWidth() - textMargin, wxELLIPSIZE_FLAGS_NONE ); From 45839843e6926c698fad746ba998a694733efe98 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Tue, 4 Feb 2020 00:08:09 +0700 Subject: [PATCH 034/329] Use a constant for the wxGrid text margin Use a constant instead of a hardcoded value for the text margin. --- src/generic/grid.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 3b48669133..ab9bafec1b 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -114,6 +114,9 @@ const int DRAG_SENSITIVITY = 3; // the space between the cell edge and the checkbox mark const int GRID_CELL_CHECKBOX_MARGIN = 2; +// the margin between a cell vertical line and a cell text +const int GRID_TEXT_MARGIN = 1; + } // anonymous namespace #include "wx/arrimpl.cpp" @@ -6747,9 +6750,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc, { case wxALIGN_BOTTOM: if ( textOrientation == wxHORIZONTAL ) - y = rect.y + (rect.height - textHeight - 1); + y = rect.y + (rect.height - textHeight - GRID_TEXT_MARGIN); else - x = rect.x + rect.width - textWidth; + x = rect.x + (rect.width - textWidth - GRID_TEXT_MARGIN); break; case wxALIGN_CENTRE: @@ -6762,9 +6765,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc, case wxALIGN_TOP: default: if ( textOrientation == wxHORIZONTAL ) - y = rect.y + 1; + y = rect.y + GRID_TEXT_MARGIN; else - x = rect.x + 1; + x = rect.x + GRID_TEXT_MARGIN; break; } @@ -6788,9 +6791,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc, { case wxALIGN_RIGHT: if ( textOrientation == wxHORIZONTAL ) - x = rect.x + (rect.width - lineWidth - 1); + x = rect.x + (rect.width - lineWidth - GRID_TEXT_MARGIN); else - y = rect.y + lineWidth + 1; + y = rect.y + lineWidth + GRID_TEXT_MARGIN; break; case wxALIGN_CENTRE: @@ -6803,9 +6806,9 @@ void wxGrid::DrawTextRectangle(wxDC& dc, case wxALIGN_LEFT: default: if ( textOrientation == wxHORIZONTAL ) - x = rect.x + 1; + x = rect.x + GRID_TEXT_MARGIN; else - y = rect.y + rect.height - 1; + y = rect.y + rect.height - GRID_TEXT_MARGIN; break; } @@ -6831,16 +6834,13 @@ void wxGrid::DrawTextRectangle(wxDC& dc, { attr.GetNonDefaultAlignment(&hAlign, &vAlign); - // The text will be displaced in final wxGrid::DrawTextRectangle function. - const int textMargin = 2; - // This does nothing if there is no need to ellipsize. const wxString& ellipsizedText = wxControl::Ellipsize ( text, dc, attr.GetFitMode().GetEllipsizeMode(), - rect.GetWidth() - textMargin, + rect.GetWidth() - 2 * GRID_TEXT_MARGIN, wxELLIPSIZE_FLAGS_NONE ); From 360bbbc4531b07b55daeef4c582f3ab2c1a3dcf4 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 4 Feb 2020 00:14:19 -0800 Subject: [PATCH 035/329] Fix a wxVariant ctor argument type after 948ddc6e0f 'const void*' won't match 'void*' parameter, gets converted to bool instead --- src/msw/ole/activex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index a707456c3f..74abdc50cf 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -768,7 +768,7 @@ namespace const int invalid_entry_marker = 0; } -wxVariant wxActiveXEvents::ms_invalidEntryMarker(static_cast(&invalid_entry_marker)); +wxVariant wxActiveXEvents::ms_invalidEntryMarker(const_cast(static_cast(&invalid_entry_marker))); size_t wxActiveXEvent::ParamCount() const { From 0c9a9dc126a4f7ce03bdce53ed2680aabd40d1c4 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Mon, 3 Feb 2020 18:09:47 +0700 Subject: [PATCH 036/329] Fix wrong wxGrid::RefreshBlock calling for an empty grid There is no cells to select if the grid is empty (no rows or no columns). So check for the columns count in SelectRow and check for the rows count in SelectCol and call RefreshBlock only if it necessary. Fix https://trac.wxwidgets.org/ticket/18659 Fix https://trac.wxwidgets.org/ticket/18660 --- src/generic/gridsel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generic/gridsel.cpp b/src/generic/gridsel.cpp index 8497a17af6..0bda0caa44 100644 --- a/src/generic/gridsel.cpp +++ b/src/generic/gridsel.cpp @@ -257,7 +257,7 @@ void wxGridSelection::SelectRow(int row, const wxKeyboardState& kbd) } // Update View: - if ( !m_grid->GetBatchCount() ) + if ( !m_grid->GetBatchCount() && m_grid->GetNumberCols() != 0 ) { m_grid->RefreshBlock(row, 0, row, m_grid->GetNumberCols() - 1); } @@ -349,7 +349,7 @@ void wxGridSelection::SelectCol(int col, const wxKeyboardState& kbd) } // Update View: - if ( !m_grid->GetBatchCount() ) + if ( !m_grid->GetBatchCount() && m_grid->GetNumberRows() != 0 ) { m_grid->RefreshBlock(0, col, m_grid->GetNumberRows() - 1, col); } From 8cf3554399bbfe8b6b2882f6ed1b80bfb0d339b2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 4 Feb 2020 22:59:31 +0100 Subject: [PATCH 037/329] Update png submodule to avoid -Wundef warnings during build No real changes. --- src/png | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/png b/src/png index 5668fc8fd6..8cb5f8f158 160000 --- a/src/png +++ b/src/png @@ -1 +1 @@ -Subproject commit 5668fc8fd6cceb79cfd8dd3cdec24a4f998cfcea +Subproject commit 8cb5f8f1587b95a0e86fa8c2becea0cef8ee0a8b From 217349d772ba4f047e1c603ce2feb08309b08434 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Mon, 3 Feb 2020 19:15:32 +0700 Subject: [PATCH 038/329] Test wxGrid RefreshBlock function when a grid is empty SelectCol and SelectRow should not fail an assertion if a grid has no rows or columns. --- tests/controls/gridtest.cpp | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 6d88a72d3c..f7eb5257df 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -73,6 +73,7 @@ private: WXUISIM_TEST( RangeSelect ); CPPUNIT_TEST( Cursor ); CPPUNIT_TEST( Selection ); + CPPUNIT_TEST( SelectEmptyGrid ); CPPUNIT_TEST( ScrollWhenSelect ); WXUISIM_TEST( MoveGridCursorUsingEndKey ); WXUISIM_TEST( SelectUsingEndKey ); @@ -117,6 +118,7 @@ private: void RangeSelect(); void Cursor(); void Selection(); + void SelectEmptyGrid(); void ScrollWhenSelect(); void MoveGridCursorUsingEndKey(); void SelectUsingEndKey(); @@ -600,6 +602,46 @@ void GridTestCase::Selection() CPPUNIT_ASSERT(!m_grid->IsInSelection(3, 0)); } +void GridTestCase::SelectEmptyGrid() +{ + SECTION("Delete rows/columns") + { + SECTION("No rows") + { + m_grid->DeleteRows(0, 10); + REQUIRE( m_grid->GetNumberRows() == 0 ); + } + SECTION("No columns") + { + m_grid->DeleteCols(0, 2); + REQUIRE( m_grid->GetNumberCols() == 0 ); + } + } + + SECTION("Select") + { + SECTION("Move right") + { + m_grid->MoveCursorRight(true); + } + SECTION("Move down") + { + m_grid->MoveCursorDown(true); + } + SECTION("Select row") + { + m_grid->SelectRow(1); + } + SECTION("Select column") + { + m_grid->SelectCol(1); + } + } + + CHECK( m_grid->GetSelectionBlockTopLeft().Count() == 0 ); + CHECK( m_grid->GetSelectionBlockBottomRight().Count() == 0 ); +} + void GridTestCase::ScrollWhenSelect() { m_grid->AppendCols(10); From 1650ea70309358c80bb5a65dc230ef108eb22d96 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 03:40:24 +0100 Subject: [PATCH 039/329] Don't use RPC_WSTR absent from older MinGW headers Fix compilation with MinGW 5.3 after the changes of 948ddc6e0f76fb69ddc17859c29a821290a7969f --- src/msw/ole/uuid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/msw/ole/uuid.cpp b/src/msw/ole/uuid.cpp index 6c08eb4540..7cc0c34d0e 100644 --- a/src/msw/ole/uuid.cpp +++ b/src/msw/ole/uuid.cpp @@ -138,7 +138,7 @@ bool Uuid::Set(const wxChar *pc) { // get UUID from string #ifdef _UNICODE - if (UuidFromString(reinterpret_cast(const_cast(pc)), &m_uuid) != RPC_S_OK) + if ( UuidFromString(reinterpret_cast(const_cast(pc)), &m_uuid) != RPC_S_OK ) #else if ( UuidFromString((wxUChar *)pc, &m_uuid) != RPC_S_OK) #endif From 00cdab77c50b454e42d5e1f956d55d1bfebfa271 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 03:52:51 +0100 Subject: [PATCH 040/329] Define wxStrtox() overloads taking nullptr Instead of specializing wxStrtoxCharType and then testing whether endptr is null, just define separate, and simpler, overloads of wxStrtox() functions taking nullptr_t -- we can avoid the unnecessary test completely in this case, as nullptr is, by definition, always null anyhow. Also add a test of using wxStrtol() with nullptr too. This should fix the build with older gcc and MSVS versions. --- include/wx/wxcrt.h | 32 +++++++++++++++++++++----------- tests/strings/crt.cpp | 12 +++++++++++- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index 97686b0221..ab9752db22 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -844,16 +844,6 @@ template<> struct wxStrtoxCharType return NULL; } }; -#ifdef wxHAS_NULLPTR_T -template<> struct wxStrtoxCharType -{ - typedef const char* Type; - static char** AsPointer(std::nullptr_t) - { - return nullptr; - } -}; -#endif template inline double wxStrtod(const wxString& nptr, T endptr) @@ -877,6 +867,25 @@ template inline double wxStrtod(const wxCStrData& nptr, T endptr) { return wxStrtod(nptr.AsString(), endptr); } +#ifdef wxHAS_NULLPTR_T + +inline double wxStrtod(const wxString& nptr, nullptr_t) + { return wxStrtod(nptr.wx_str(), static_cast(NULL)); }; +inline double wxStrtod(const wxCStrData& nptr, nullptr_t) + { return wxStrtod(nptr.AsString(), static_cast(NULL)); }; + +#define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) \ + inline rettype name(const wxString& nptr, nullptr_t, int base) \ + { return name(nptr.wx_str(), static_cast(NULL), \ + base); }; \ + inline rettype name(const wxCStrData& nptr, nullptr_t, int base) \ + { return name(nptr.AsString(), static_cast(NULL), \ + base); }; + +#else // !wxHAS_NULLPTR_T +#define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) +#endif // wxHAS_NULLPTR_T/!wxHAS_NULLPTR_T + #define WX_STRTOX_FUNC(rettype, name, implA, implW) \ /* see wxStrtod() above for explanation of this code: */ \ @@ -902,7 +911,8 @@ inline double wxStrtod(const wxCStrData& nptr, T endptr) } \ template \ inline rettype name(const wxCStrData& nptr, T endptr, int base) \ - { return name(nptr.AsString(), endptr, base); } + { return name(nptr.AsString(), endptr, base); } \ + WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) WX_STRTOX_FUNC(long, wxStrtol, wxCRT_StrtolA, wxCRT_StrtolW) WX_STRTOX_FUNC(unsigned long, wxStrtoul, wxCRT_StrtoulA, wxCRT_StrtoulW) diff --git a/tests/strings/crt.cpp b/tests/strings/crt.cpp index 6d728f3cb8..170159b130 100644 --- a/tests/strings/crt.cpp +++ b/tests/strings/crt.cpp @@ -234,10 +234,11 @@ TEST_CASE("CRT::Strnlen", "[crt][strnlen]") CHECK( wxStrnlen(L"1234" L"\0" L"5678", 12) == 4 ); } -TEST_CASE("CRT::Strtod", "[crt][strtod]") +TEST_CASE("CRT::Strtox", "[crt][strtod][strtol]") { const wxString s = "123@"; const double d = 123.0; + const long l = 123; SECTION("char") { @@ -245,6 +246,10 @@ TEST_CASE("CRT::Strtod", "[crt][strtod]") CHECK( wxStrtod(s, &end) == d ); REQUIRE( end ); CHECK( *end == '@' ); + + CHECK( wxStrtol(s, &end, 10) == l ); + REQUIRE( end ); + CHECK( *end == '@' ); } SECTION("wchar_t") @@ -253,6 +258,10 @@ TEST_CASE("CRT::Strtod", "[crt][strtod]") CHECK( wxStrtod(s, &end) == d ); REQUIRE( end ); CHECK( *end == L'@' ); + + CHECK( wxStrtol(s, &end, 10) == l ); + REQUIRE( end ); + CHECK( *end == L'@' ); } SECTION("other") @@ -260,6 +269,7 @@ TEST_CASE("CRT::Strtod", "[crt][strtod]") CHECK( wxStrtod(s, 0) == d ); #ifdef wxHAS_NULLPTR_T CHECK( wxStrtod(s, nullptr) == d ); + CHECK( wxStrtol(s, nullptr, 10) == l ); #endif } } From 3f499420519d9f8699ec3833d8e9672f17eaec9c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 15:19:33 +0100 Subject: [PATCH 041/329] Fully qualify std::nullptr_t Fix a stupid mistake from 00cdab77c50b454e42d5e1f956d55d1bfebfa271 --- include/wx/wxcrt.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index ab9752db22..4fe0ba9650 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -869,16 +869,16 @@ inline double wxStrtod(const wxCStrData& nptr, T endptr) #ifdef wxHAS_NULLPTR_T -inline double wxStrtod(const wxString& nptr, nullptr_t) +inline double wxStrtod(const wxString& nptr, std::nullptr_t) { return wxStrtod(nptr.wx_str(), static_cast(NULL)); }; -inline double wxStrtod(const wxCStrData& nptr, nullptr_t) +inline double wxStrtod(const wxCStrData& nptr, std::nullptr_t) { return wxStrtod(nptr.AsString(), static_cast(NULL)); }; #define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) \ - inline rettype name(const wxString& nptr, nullptr_t, int base) \ + inline rettype name(const wxString& nptr, std::nullptr_t, int base) \ { return name(nptr.wx_str(), static_cast(NULL), \ base); }; \ - inline rettype name(const wxCStrData& nptr, nullptr_t, int base) \ + inline rettype name(const wxCStrData& nptr, std::nullptr_t, int base) \ { return name(nptr.AsString(), static_cast(NULL), \ base); }; From 4526765f8ff382db8ffd61be992fcbcb219dda97 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 15:20:26 +0100 Subject: [PATCH 042/329] Remove extra semicolons to avoid gcc -Wpedantic warnings Another fix after 00cdab77c50b454e42d5e1f956d55d1bfebfa271 --- include/wx/wxcrt.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index 4fe0ba9650..d15458cd85 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -870,17 +870,17 @@ inline double wxStrtod(const wxCStrData& nptr, T endptr) #ifdef wxHAS_NULLPTR_T inline double wxStrtod(const wxString& nptr, std::nullptr_t) - { return wxStrtod(nptr.wx_str(), static_cast(NULL)); }; + { return wxStrtod(nptr.wx_str(), static_cast(NULL)); } inline double wxStrtod(const wxCStrData& nptr, std::nullptr_t) - { return wxStrtod(nptr.AsString(), static_cast(NULL)); }; + { return wxStrtod(nptr.AsString(), static_cast(NULL)); } #define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) \ inline rettype name(const wxString& nptr, std::nullptr_t, int base) \ { return name(nptr.wx_str(), static_cast(NULL), \ - base); }; \ + base); } \ inline rettype name(const wxCStrData& nptr, std::nullptr_t, int base) \ { return name(nptr.AsString(), static_cast(NULL), \ - base); }; + base); } #else // !wxHAS_NULLPTR_T #define WX_STRTOX_DEFINE_NULLPTR_OVERLOADS(rettype, name) From 24c56a413b03002be3677d09b454ea03303345f9 Mon Sep 17 00:00:00 2001 From: nns52k <58716684+nns52k@users.noreply.github.com> Date: Tue, 10 Dec 2019 20:31:38 +0800 Subject: [PATCH 043/329] Fix string escaping in JS code in wxWebView For example, a newline was escaped to be a backslash followed by a newline, but it actually shall be a backslash followed by a character 'n'. It seemed okay with most of codes until in the case that C++ style comments, i.e. single line comments, in the JavaScript codes. If the newline characters are not escaped correctly, the JavaScript interpreter will ignore everything that goes after the single line comments because the interpreter obviously cannot find the newline where it's supposed to stop treating codes as comments. --- include/wx/private/jsscriptwrapper.h | 35 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/include/wx/private/jsscriptwrapper.h b/include/wx/private/jsscriptwrapper.h index e60070fc1e..8dcd329ff4 100644 --- a/include/wx/private/jsscriptwrapper.h +++ b/include/wx/private/jsscriptwrapper.h @@ -36,10 +36,37 @@ public: // avoid any possible conflict between different calls. m_outputVarName = wxString::Format("__wxOut%i", (*runScriptCount)++); - // Adds one escape level if there is a single quote, double quotes or - // escape characters - wxRegEx escapeDoubleQuotes("(\\\\*)([\\'\"\n\r\v\t\b\f])"); - escapeDoubleQuotes.Replace(&m_escapedCode,"\\1\\1\\\\\\2"); + // Adds one escape level. + const char *s_szCharsNeededToBeEscaped = "\\\"\n\r\v\t\b\f"; + for ( + size_t pos = m_escapedCode.find_first_of(s_szCharsNeededToBeEscaped, 0); + pos != wxString::npos; + pos = m_escapedCode.find_first_of(s_szCharsNeededToBeEscaped, pos) + ) { + switch (m_escapedCode[pos].GetValue()) + { + case 0x0A: // '\n' + m_escapedCode[pos] = 'n'; + break; + case 0x0D: // '\r' + m_escapedCode[pos] = 'r'; + break; + case 0x0B: // '\v' + m_escapedCode[pos] = 'v'; + break; + case 0x09: // '\t' + m_escapedCode[pos] = 't'; + break; + case 0x08: // '\b' + m_escapedCode[pos] = 'b'; + break; + case 0x0C: // '\f' + m_escapedCode[pos] = 'f'; + break; + } + m_escapedCode.insert(pos, '\\'); + pos += 2; + } } // Get the code to execute, its returned value will be either boolean true, From b7547dbd2730489ccad0d1f6c8df82426ea0708d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 15:37:27 +0100 Subject: [PATCH 044/329] Don't use Hungarian notation for variables Rename a variable to remove the ugly "sz" prefix. Also don't use "s_" prefix for non-static variables. --- include/wx/private/jsscriptwrapper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/private/jsscriptwrapper.h b/include/wx/private/jsscriptwrapper.h index 8dcd329ff4..e235ea46d3 100644 --- a/include/wx/private/jsscriptwrapper.h +++ b/include/wx/private/jsscriptwrapper.h @@ -37,11 +37,11 @@ public: m_outputVarName = wxString::Format("__wxOut%i", (*runScriptCount)++); // Adds one escape level. - const char *s_szCharsNeededToBeEscaped = "\\\"\n\r\v\t\b\f"; + const char *charsNeededToBeEscaped = "\\\"\n\r\v\t\b\f"; for ( - size_t pos = m_escapedCode.find_first_of(s_szCharsNeededToBeEscaped, 0); + size_t pos = m_escapedCode.find_first_of(charsNeededToBeEscaped, 0); pos != wxString::npos; - pos = m_escapedCode.find_first_of(s_szCharsNeededToBeEscaped, pos) + pos = m_escapedCode.find_first_of(charsNeededToBeEscaped, pos) ) { switch (m_escapedCode[pos].GetValue()) { From a26e81ccb1c773fb692ee94b7c8aa8b28bd1cf85 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 15:40:27 +0100 Subject: [PATCH 045/329] Remove test for \v escaping in wxWebView::RunScript() This escape character doesn't seem to be handled by IE in the default emulation mode and it's not worth complicating the test code just to test for it, so simply remove it from the test. --- tests/controls/webtest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp index 19a5bc6349..4bcb3ada68 100644 --- a/tests/controls/webtest.cpp +++ b/tests/controls/webtest.cpp @@ -291,8 +291,8 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]") CHECK(m_browser->RunScript("function f(a){return a;}f('Hello World!');", &result)); CHECK(result == _("Hello World!")); - CHECK(m_browser->RunScript("function f(a){return a;}f('a\\\'aa\\n\\rb\vb\\tb\\\\ccc\\\"ddd\\b\\fx');", &result)); - CHECK(result == _("a\'aa\n\rb\vb\tb\\ccc\"ddd\b\fx")); + CHECK(m_browser->RunScript("function f(a){return a;}f('a\\\'aa\\n\\rb\\tb\\\\ccc\\\"ddd\\b\\fx');", &result)); + CHECK(result == _("a\'aa\n\rb\tb\\ccc\"ddd\b\fx")); CHECK(m_browser->RunScript("function f(a){return a;}f(123);", &result)); CHECK(wxAtoi(result) == 123); From f21c7f2d492e909609be9e0f7ba708dc8769a574 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 5 Feb 2020 15:45:26 +0100 Subject: [PATCH 046/329] Add a test for C++ comments in code passed to RunScript() This used to be broken, check that it does work now. --- tests/controls/webtest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/controls/webtest.cpp b/tests/controls/webtest.cpp index 4bcb3ada68..82b5859786 100644 --- a/tests/controls/webtest.cpp +++ b/tests/controls/webtest.cpp @@ -338,6 +338,13 @@ TEST_CASE_METHOD(WebViewTestCase, "WebView", "[wxWebView]") &result)); CHECK(result == "\"2016-10-08T21:30:40.000Z\""); + // Check for C++-style comments which used to be broken. + CHECK(m_browser->RunScript("function f() {\n" + " // A C++ style comment\n" + " return 17;\n" + "}f();", &result)); + CHECK(result == "17"); + // Check for errors too. CHECK(!m_browser->RunScript("syntax(error")); CHECK(!m_browser->RunScript("syntax(error", &result)); From 5663157674c31ea01186d3748f033d5152c23689 Mon Sep 17 00:00:00 2001 From: Kvaz1r Date: Tue, 4 Feb 2020 19:36:53 +0200 Subject: [PATCH 047/329] Fix link between flags and buttons in wxAuiManager Don't store the buttons used by a pane separately, but take them directly from the flags, as this ensures that updating the pane flags, e.g. by calling CloseButton(false), really removes the corresponding button. This also makes wxAuiPaneButton helper completely unnecessary, so just remove it to simplify the code. Closes https://github.com/wxWidgets/wxWidgets/pull/1723 Closes #18223. --- docs/changes.txt | 3 + include/wx/aui/framemanager.h | 14 +---- interface/wx/aui/framemanager.h | 13 +---- src/aui/framemanager.cpp | 97 +++++++++++++++------------------ 4 files changed, 49 insertions(+), 78 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 7d8621447f..63a155fcbc 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -148,6 +148,9 @@ Changes in behaviour which may result in build errors - wxGridCellAttr ctor taking wxGridCellAttr pointer is now explicit. +- wxAuiPaneButton doesn't exist any more, it was never supposed to be used + outside of the library, but if you did use, just use "int" button instead. + 3.1.4: (released ????-??-??) ---------------------------- diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index 17c9a84153..08f058300d 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -123,7 +123,6 @@ enum wxAuiPaneInsertLevel // forwards and array declarations class wxAuiDockUIPart; -class wxAuiPaneButton; class wxAuiPaneInfo; class wxAuiDockInfo; class wxAuiDockArt; @@ -132,7 +131,6 @@ class wxAuiManagerEvent; #ifndef SWIG WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockInfo, wxAuiDockInfoArray, WXDLLIMPEXP_AUI); WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiDockUIPart, wxAuiDockUIPartArray, WXDLLIMPEXP_AUI); -WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneButton, wxAuiPaneButtonArray, WXDLLIMPEXP_AUI); WX_DECLARE_USER_EXPORTED_OBJARRAY(wxAuiPaneInfo, wxAuiPaneInfoArray, WXDLLIMPEXP_AUI); WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiPaneInfo*, wxAuiPaneInfoPtrArray, class WXDLLIMPEXP_AUI); WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxAuiDockInfo*, wxAuiDockInfoPtrArray, class WXDLLIMPEXP_AUI); @@ -176,7 +174,6 @@ public: // unsafe bits of "dest" source.window = window; source.frame = frame; - source.buttons = buttons; wxCHECK_RET(source.IsValid(), "window settings and pane settings are incompatible"); // now assign @@ -393,9 +390,6 @@ public: wxSize floating_size; // size while floating int dock_proportion; // proportion while docked - wxAuiPaneButtonArray buttons; // buttons on the pane - - wxRect rect; // current rectangle (populated by wxAUI) bool IsValid() const; @@ -730,19 +724,13 @@ public: int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL) wxAuiDockInfo* dock; // which dock the item is associated with wxAuiPaneInfo* pane; // which pane the item is associated with - wxAuiPaneButton* button; // which pane button the item is associated with + int button; // which pane button the item is associated with wxSizer* cont_sizer; // the part's containing sizer wxSizerItem* sizer_item; // the sizer item of the part wxRect rect; // client coord rectangle of the part itself }; -class WXDLLIMPEXP_AUI wxAuiPaneButton -{ -public: - int button_id; // id of the button (e.g. buttonClose) -}; - #ifndef SWIG diff --git a/interface/wx/aui/framemanager.h b/interface/wx/aui/framemanager.h index 645337db3d..295a7f381a 100644 --- a/interface/wx/aui/framemanager.h +++ b/interface/wx/aui/framemanager.h @@ -1004,9 +1004,6 @@ public: /// proportion while docked int dock_proportion; - /// buttons on the pane - wxAuiPaneButtonArray buttons; - /// current rectangle (populated by wxAUI) wxRect rect; @@ -1175,16 +1172,8 @@ public: int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL) wxAuiDockInfo* dock; // which dock the item is associated with wxAuiPaneInfo* pane; // which pane the item is associated with - wxAuiPaneButton* button; // which pane button the item is associated with + int button; // which pane button the item is associated with wxSizer* cont_sizer; // the part's containing sizer wxSizerItem* sizer_item; // the sizer item of the part wxRect rect; // client coord rectangle of the part itself }; - - - -class wxAuiPaneButton -{ -public: - int button_id; // id of the button (e.g. buttonClose) -}; diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 47a7e035e2..db9a88ef5a 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -49,7 +49,6 @@ WX_DECLARE_OBJARRAY(wxRect, wxAuiRectArray); WX_DEFINE_OBJARRAY(wxAuiRectArray) WX_DEFINE_OBJARRAY(wxAuiDockUIPartArray) WX_DEFINE_OBJARRAY(wxAuiDockInfoArray) -WX_DEFINE_OBJARRAY(wxAuiPaneButtonArray) WX_DEFINE_OBJARRAY(wxAuiPaneInfoArray) wxAuiPaneInfo wxAuiNullPaneInfo; @@ -1071,27 +1070,6 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo) if (pinfo.dock_proportion == 0) pinfo.dock_proportion = 100000; - if (pinfo.HasMaximizeButton()) - { - wxAuiPaneButton button; - button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE; - pinfo.buttons.Add(button); - } - - if (pinfo.HasPinButton()) - { - wxAuiPaneButton button; - button.button_id = wxAUI_BUTTON_PIN; - pinfo.buttons.Add(button); - } - - if (pinfo.HasCloseButton()) - { - wxAuiPaneButton button; - button.button_id = wxAUI_BUTTON_CLOSE; - pinfo.buttons.Add(button); - } - if (pinfo.HasGripper()) { if (wxDynamicCast(pinfo.window, wxAuiToolBar)) @@ -1790,7 +1768,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, part.type = wxAuiDockUIPart::typeGripper; part.dock = &dock; part.pane = &pane; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = horz_pane_sizer; part.sizer_item = sizer_item; @@ -1807,7 +1785,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, part.type = wxAuiDockUIPart::typeCaption; part.dock = &dock; part.pane = &pane; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = vert_pane_sizer; part.sizer_item = sizer_item; @@ -1815,24 +1793,37 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, uiparts.Add(part); // add pane buttons to the caption - int i, button_count; - for (i = 0, button_count = pane.buttons.GetCount(); - i < button_count; ++i) + int button_count = 0; + const int NUM_SUPPORTED_BUTTONS = 3; + wxAuiButtonId buttons[NUM_SUPPORTED_BUTTONS] = { + wxAUI_BUTTON_MAXIMIZE_RESTORE, + wxAUI_BUTTON_PIN, + wxAUI_BUTTON_CLOSE + }; + int flags[NUM_SUPPORTED_BUTTONS] = { + wxAuiPaneInfo::buttonMaximize, + wxAuiPaneInfo::buttonPin, + wxAuiPaneInfo::buttonClose + }; + + for (int i = 0; i < NUM_SUPPORTED_BUTTONS; ++i) { - wxAuiPaneButton& button = pane.buttons.Item(i); + if (pane.HasFlag(flags[i])) + { + sizer_item = caption_sizer->Add(pane_button_size, + caption_size, + 0, wxEXPAND); - sizer_item = caption_sizer->Add(pane_button_size, - caption_size, - 0, wxEXPAND); - - part.type = wxAuiDockUIPart::typePaneButton; - part.dock = &dock; - part.pane = &pane; - part.button = &button; - part.orientation = orientation; - part.cont_sizer = caption_sizer; - part.sizer_item = sizer_item; - uiparts.Add(part); + part.type = wxAuiDockUIPart::typePaneButton; + part.dock = &dock; + part.pane = &pane; + part.button = buttons[i]; + part.orientation = orientation; + part.cont_sizer = caption_sizer; + part.sizer_item = sizer_item; + uiparts.Add(part); + button_count++; + } } // if we have buttons, add a little space to the right @@ -1865,7 +1856,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, part.type = wxAuiDockUIPart::typePane; part.dock = &dock; part.pane = &pane; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = vert_pane_sizer; part.sizer_item = sizer_item; @@ -1909,7 +1900,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont, part.type = wxAuiDockUIPart::typePaneBorder; part.dock = &dock; part.pane = &pane; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = cont; part.sizer_item = sizer_item; @@ -1942,7 +1933,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.orientation = orientation; part.dock = &dock; part.pane = NULL; - part.button = NULL; + part.button = 0; part.cont_sizer = cont; part.sizer_item = sizer_item; uiparts.Add(part); @@ -1984,7 +1975,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeBackground; part.dock = &dock; part.pane = NULL; - part.button = NULL; + part.button = 0; part.orientation = (orientation==wxHORIZONTAL) ? wxVERTICAL:wxHORIZONTAL; part.cont_sizer = dock_sizer; part.sizer_item = sizer_item; @@ -2004,7 +1995,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeBackground; part.dock = &dock; part.pane = NULL; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = dock_sizer; part.sizer_item = sizer_item; @@ -2028,7 +2019,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typePaneSizer; part.dock = &dock; part.pane = dock.panes.Item(pane_i-1); - part.button = NULL; + part.button = 0; part.orientation = (orientation==wxHORIZONTAL) ? wxVERTICAL:wxHORIZONTAL; part.cont_sizer = dock_sizer; part.sizer_item = sizer_item; @@ -2047,7 +2038,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeDock; part.dock = &dock; part.pane = NULL; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = cont; part.sizer_item = sizer_item; @@ -2069,7 +2060,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont, part.type = wxAuiDockUIPart::typeDockSizer; part.dock = &dock; part.pane = NULL; - part.button = NULL; + part.button = 0; part.orientation = orientation; part.cont_sizer = cont; part.sizer_item = sizer_item; @@ -2408,7 +2399,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, part.type = wxAuiDockUIPart::typeBackground; part.pane = NULL; part.dock = NULL; - part.button = NULL; + part.button = 0; part.cont_sizer = middle; part.sizer_item = sizer_item; uiparts.Add(part); @@ -2454,7 +2445,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, part.type = wxAuiDockUIPart::typeBackground; part.pane = NULL; part.dock = NULL; - part.button = NULL; + part.button = 0; part.cont_sizer = middle; part.sizer_item = sizer_item; uiparts.Add(part); @@ -3878,7 +3869,7 @@ void wxAuiManager::OnRender(wxAuiManagerEvent& evt) m_art->DrawBorder(*dc, m_frame, part.rect, *part.pane); break; case wxAuiDockUIPart::typePaneButton: - m_art->DrawPaneButton(*dc, m_frame, part.button->button_id, + m_art->DrawPaneButton(*dc, m_frame, part.button, wxAUI_BUTTON_STATE_NORMAL, part.rect, *part.pane); break; } @@ -4071,7 +4062,7 @@ void wxAuiManager::UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part, if (hit_test->pane) { m_art->DrawPaneButton(cdc, m_frame, - button_ui_part->button->button_id, + button_ui_part->button, state, button_ui_part->rect, *hit_test->pane); @@ -4472,7 +4463,7 @@ void wxAuiManager::OnLeftUp(wxMouseEvent& event) wxAuiManagerEvent e(wxEVT_AUI_PANE_BUTTON); e.SetManager(this); e.SetPane(m_actionPart->pane); - e.SetButton(m_actionPart->button->button_id); + e.SetButton(m_actionPart->button); ProcessMgrEvent(e); } } From a2b39f782bea8a40471d47ad573596acd383fc7b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 6 Feb 2020 15:59:45 +0100 Subject: [PATCH 048/329] Don't call gtk_disable_setlocale() more than once This is useless and just results in GTK warnings. --- src/gtk/app.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 4721bcd85b..a13b90f959 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -356,7 +356,15 @@ bool wxApp::Initialize(int& argc_, wxChar **argv_) // Prevent gtk_init_check() from changing the locale automatically for // consistency with the other ports that don't do it. If necessary, // wxApp::SetCLocale() may be explicitly called. - gtk_disable_setlocale(); + // + // Note that this function generates a warning if it's called more than + // once, so avoid them. + static bool s_gtkLocalDisabled = false; + if ( !s_gtkLocalDisabled ) + { + s_gtkLocalDisabled = true; + gtk_disable_setlocale(); + } #ifdef __WXGPE__ init_result = true; // is there a _check() version of this? From 249e5add7e1ba69fd0e569c4b6da2ae3d56df77d Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Thu, 6 Feb 2020 22:00:55 +0700 Subject: [PATCH 049/329] Redraw overflowed wxGrid cells to update the background Before drawing the overflowing text we need to redraw the cells it overflows into to avoid visual artefacts, that could appear even just due to drawing new text over the same existing text due to anti-aliasing. E.g. the text in the cell B2 in the grid sample visibly changed appearance when repeatedly switching the current cell from A1 to A2 and back again, just due to redrawing A2 contents. Closes https://github.com/wxWidgets/wxWidgets/pull/1729 --- src/generic/gridctrl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index 9a3a728696..0efd1b499a 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -650,6 +650,10 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, col_end = grid.GetNumberCols() - 1; for (int i = col + cell_cols; i <= col_end; i++) { + // redraw the cell to update the background + wxGridCellCoords coords(row, i); + grid.DrawCell(dc, coords); + clip.width = grid.GetColSize(i) - 1; wxDCClipper clipper(dc, clip); From 23ebbb139d712a0e59c295397c4710b1b4819d1a Mon Sep 17 00:00:00 2001 From: wxBen Date: Fri, 7 Feb 2020 17:25:34 +0100 Subject: [PATCH 050/329] Optionally support using wxImageList in wxRibbonBar This allows to avoid consuming too many bitmap resources. Closes #18657. --- include/wx/ribbon/bar.h | 13 ++++++ include/wx/ribbon/buttonbar.h | 1 + interface/wx/ribbon/bar.h | 22 +++++++++ src/ribbon/bar.cpp | 35 ++++++++++++++ src/ribbon/buttonbar.cpp | 86 ++++++++++++++++++++++++++++++----- 5 files changed, 146 insertions(+), 11 deletions(-) diff --git a/include/wx/ribbon/bar.h b/include/wx/ribbon/bar.h index 78c272a488..9dcbb04488 100644 --- a/include/wx/ribbon/bar.h +++ b/include/wx/ribbon/bar.h @@ -15,6 +15,8 @@ #if wxUSE_RIBBON +class wxImageList; + #include "wx/ribbon/control.h" #include "wx/ribbon/page.h" @@ -152,6 +154,13 @@ public: void HideIfExpanded(); + void UseImageList(bool useImageList = true) { m_useImageList = useImageList; } + bool UsesImageList() const { return m_useImageList; } + // Implementation only. + wxImageList* GetButtonImageList(wxSize* isize = NULL); + // Implementation only. + wxImageList* GetButtonSmallImageList(wxSize* isize = NULL); + protected: friend class wxRibbonPage; @@ -208,6 +217,10 @@ protected: wxRibbonDisplayMode m_ribbon_state; + bool m_useImageList; + wxImageList* m_buttonImageList; + wxImageList* m_buttonSmallImageList; + #ifndef SWIG wxDECLARE_CLASS(wxRibbonBar); wxDECLARE_EVENT_TABLE(); diff --git a/include/wx/ribbon/buttonbar.h b/include/wx/ribbon/buttonbar.h index bc54379261..e4bccc185f 100644 --- a/include/wx/ribbon/buttonbar.h +++ b/include/wx/ribbon/buttonbar.h @@ -213,6 +213,7 @@ protected: bool m_layouts_valid; bool m_lock_active_state; bool m_show_tooltips_for_disabled; + wxRibbonBar* m_ownerRibbonBar; #ifndef SWIG wxDECLARE_CLASS(wxRibbonButtonBar); diff --git a/interface/wx/ribbon/bar.h b/interface/wx/ribbon/bar.h index 615d07e30b..acd040998a 100644 --- a/interface/wx/ribbon/bar.h +++ b/interface/wx/ribbon/bar.h @@ -453,4 +453,26 @@ public: Also calls wxRibbonPage::Realize() on each child page. */ virtual bool Realize(); + + /** + If the ribbon bar has many buttons, wxImageList can be used to reduce + bitmap resources. Call SetUseImageList after creating the ribbon bar, + and any subsequent AddButton or InsertButton calls will have their + images stored in an image list instead. Note that the conversion might + cause some images created from icons with alpha layers to have a black + background. Such images need to be edited before use. + + @since 3.1.4 + */ + void UseImageList(bool useImageList = true); + + /** + Returns whether a wxImageList is being used for buttons. + + @see SetUseImageList() + + @since 3.1.4 + */ + bool UsesImageList() const; + }; diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index bb53511cf5..8ed66a313f 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -30,6 +30,7 @@ #endif #include "wx/arrimpl.cpp" +#include "wx/imaglist.h" WX_DEFINE_USER_EXPORTED_OBJARRAY(wxRibbonPageTabInfoArray) @@ -735,6 +736,10 @@ wxRibbonBar::wxRibbonBar() m_tab_scroll_buttons_shown = false; m_arePanelsShown = true; m_help_button_hovered = false; + m_useImageList = false; + m_buttonImageList = NULL; + m_buttonSmallImageList = NULL; + } wxRibbonBar::wxRibbonBar(wxWindow* parent, @@ -750,6 +755,14 @@ wxRibbonBar::wxRibbonBar(wxWindow* parent, wxRibbonBar::~wxRibbonBar() { SetArtProvider(NULL); + if (m_buttonImageList) + { + delete m_buttonImageList; m_buttonImageList = NULL; + } + if (m_buttonSmallImageList) + { + delete m_buttonSmallImageList; m_buttonSmallImageList = NULL; + } } bool wxRibbonBar::Create(wxWindow* parent, @@ -798,6 +811,28 @@ void wxRibbonBar::CommonInit(long style) m_bar_hovered = false; m_ribbon_state = wxRIBBON_BAR_PINNED; + + m_useImageList = false; + m_buttonImageList = NULL; + m_buttonSmallImageList = NULL; +} + +wxImageList* wxRibbonBar::GetButtonImageList(wxSize* isize) +{ + if (m_useImageList && m_buttonImageList == NULL) + { + m_buttonImageList = new wxImageList(isize->GetWidth(), isize->GetHeight(), /*mask*/false); + } + return m_buttonImageList; +} + +wxImageList* wxRibbonBar::GetButtonSmallImageList(wxSize* isize) +{ + if (m_useImageList && m_buttonSmallImageList == NULL) + { + m_buttonSmallImageList = new wxImageList(isize->GetWidth(), isize->GetHeight(), /*mask*/false); + } + return m_buttonSmallImageList; } void wxRibbonBar::SetArtProvider(wxRibbonArtProvider* art) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 17cbd00827..d4946a1aee 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -20,6 +20,7 @@ #include "wx/ribbon/buttonbar.h" #include "wx/ribbon/art.h" #include "wx/dcbuffer.h" +#include "wx/imaglist.h" #ifndef WX_PRECOMP #endif @@ -127,6 +128,8 @@ public: wxBitmap bitmap_small; wxBitmap bitmap_small_disabled; wxCoord text_min_width[3]; + wxCoord barButtonImageListPos; + int barButtonSmallImageListPos; wxRibbonButtonBarButtonSizeInfo sizes[3]; wxRibbonButtonBarButtonState min_size_class; wxRibbonButtonBarButtonState max_size_class; @@ -345,6 +348,31 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( base->min_size_class = wxRIBBON_BUTTONBAR_BUTTON_SMALL; base->max_size_class = wxRIBBON_BUTTONBAR_BUTTON_LARGE; + wxImageList* buttonImageList = NULL; + wxImageList* buttonSmallImageList = NULL; + if (m_ownerRibbonBar) + { + buttonImageList = m_ownerRibbonBar->GetButtonImageList(&m_bitmap_size_large); + buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(&m_bitmap_size_small); + } + if (base->bitmap_large.IsOk() && buttonImageList) + { + base->barButtonImageListPos = buttonImageList->Add(base->bitmap_large); + base->bitmap_large = wxNullBitmap; + buttonImageList->Add(base->bitmap_large_disabled); + base->bitmap_large_disabled = wxNullBitmap; + + base->barButtonSmallImageListPos = buttonSmallImageList->Add(base->bitmap_small); + base->bitmap_small = wxNullBitmap; + buttonSmallImageList->Add(base->bitmap_small_disabled); + base->bitmap_small_disabled = wxNullBitmap; + } + else + { + base->barButtonImageListPos = -1; + base->barButtonSmallImageListPos = -1; + } + wxClientDC temp_dc(this); FetchButtonSizeInfo(base, wxRIBBON_BUTTONBAR_BUTTON_SMALL, temp_dc); FetchButtonSizeInfo(base, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, temp_dc); @@ -851,19 +879,41 @@ void wxRibbonButtonBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxRibbonButtonBarButtonInstance& button = layout->buttons.Item(btn_i); wxRibbonButtonBarButtonBase* base = button.base; - - wxBitmap* bitmap = &base->bitmap_large; - wxBitmap* bitmap_small = &base->bitmap_small; - if(base->state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) - { - bitmap = &base->bitmap_large_disabled; - bitmap_small = &base->bitmap_small_disabled; - } wxRect rect(button.position + m_layout_offset, base->sizes[button.size].size); + if (base->barButtonImageListPos != -1 && m_ownerRibbonBar) + { + wxImageList* buttonImageList = m_ownerRibbonBar->GetButtonImageList(); + wxImageList* buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(); - m_art->DrawButtonBarButton(dc, this, rect, base->kind, - base->state | button.size, base->label, *bitmap, *bitmap_small); - } + wxBitmap bitmap; + wxBitmap bitmap_small; + if (base->state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) + { + bitmap = buttonImageList->GetBitmap(base->barButtonImageListPos+1); + bitmap_small = buttonSmallImageList->GetBitmap(base->barButtonSmallImageListPos+1); + } + else + { + bitmap = buttonImageList->GetBitmap(base->barButtonImageListPos); + bitmap_small = buttonSmallImageList->GetBitmap(base->barButtonSmallImageListPos); + } + m_art->DrawButtonBarButton(dc, this, rect, base->kind, + base->state | button.size, base->label, bitmap, bitmap_small); + } + else + { + wxBitmap* bitmap = &base->bitmap_large; + wxBitmap* bitmap_small = &base->bitmap_small; + if(base->state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) + { + bitmap = &base->bitmap_large_disabled; + bitmap_small = &base->bitmap_small_disabled; + } + m_art->DrawButtonBarButton(dc, this, rect, base->kind, + base->state | button.size, base->label, *bitmap, *bitmap_small); + } + + } } void wxRibbonButtonBar::OnSize(wxSizeEvent& evt) @@ -889,6 +939,20 @@ void wxRibbonButtonBar::OnSize(wxSizeEvent& evt) void wxRibbonButtonBar::CommonInit(long WXUNUSED(style)) { + //Our ultimate parent MAY be a ribbon bar, in which case + //we can use its image list. + m_ownerRibbonBar = NULL; + wxWindow* pWin = GetParent(); + while (pWin) + { + m_ownerRibbonBar = dynamic_cast(pWin); + if (m_ownerRibbonBar) + { + break; + } + pWin = pWin->GetParent(); + } + m_bitmap_size_large = wxSize(32, 32); m_bitmap_size_small = wxSize(16, 16); From 714fefb3e542c158c6d0c1636497a40a6f4c8b7d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 17:30:28 +0100 Subject: [PATCH 051/329] Use DLL export macro in wxImageList forward declaration Do it if only for consistency. --- include/wx/ribbon/bar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/ribbon/bar.h b/include/wx/ribbon/bar.h index 9dcbb04488..76d36a31b7 100644 --- a/include/wx/ribbon/bar.h +++ b/include/wx/ribbon/bar.h @@ -15,7 +15,7 @@ #if wxUSE_RIBBON -class wxImageList; +class WXDLLIMPEXP_FWD_CORE wxImageList; #include "wx/ribbon/control.h" #include "wx/ribbon/page.h" From 884c3a2dc2912acdf5cf45b8d97f1c679b5635b3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 17:44:08 +0100 Subject: [PATCH 052/329] Use wxImageList in wxRibbonBar unconditionally There shouldn't be any reason not to do it other than possible bugs in wxImageList itself, that should be fixed there. --- include/wx/ribbon/bar.h | 8 ++------ interface/wx/ribbon/bar.h | 22 ---------------------- src/ribbon/bar.cpp | 27 +++++++++++---------------- src/ribbon/buttonbar.cpp | 8 ++++---- 4 files changed, 17 insertions(+), 48 deletions(-) diff --git a/include/wx/ribbon/bar.h b/include/wx/ribbon/bar.h index 76d36a31b7..db30dfcbe8 100644 --- a/include/wx/ribbon/bar.h +++ b/include/wx/ribbon/bar.h @@ -154,12 +154,9 @@ public: void HideIfExpanded(); - void UseImageList(bool useImageList = true) { m_useImageList = useImageList; } - bool UsesImageList() const { return m_useImageList; } // Implementation only. - wxImageList* GetButtonImageList(wxSize* isize = NULL); - // Implementation only. - wxImageList* GetButtonSmallImageList(wxSize* isize = NULL); + wxImageList* GetButtonImageList(wxSize size); + wxImageList* GetButtonSmallImageList(wxSize size); protected: friend class wxRibbonPage; @@ -217,7 +214,6 @@ protected: wxRibbonDisplayMode m_ribbon_state; - bool m_useImageList; wxImageList* m_buttonImageList; wxImageList* m_buttonSmallImageList; diff --git a/interface/wx/ribbon/bar.h b/interface/wx/ribbon/bar.h index acd040998a..615d07e30b 100644 --- a/interface/wx/ribbon/bar.h +++ b/interface/wx/ribbon/bar.h @@ -453,26 +453,4 @@ public: Also calls wxRibbonPage::Realize() on each child page. */ virtual bool Realize(); - - /** - If the ribbon bar has many buttons, wxImageList can be used to reduce - bitmap resources. Call SetUseImageList after creating the ribbon bar, - and any subsequent AddButton or InsertButton calls will have their - images stored in an image list instead. Note that the conversion might - cause some images created from icons with alpha layers to have a black - background. Such images need to be edited before use. - - @since 3.1.4 - */ - void UseImageList(bool useImageList = true); - - /** - Returns whether a wxImageList is being used for buttons. - - @see SetUseImageList() - - @since 3.1.4 - */ - bool UsesImageList() const; - }; diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index 8ed66a313f..fefcffdccd 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -736,7 +736,6 @@ wxRibbonBar::wxRibbonBar() m_tab_scroll_buttons_shown = false; m_arePanelsShown = true; m_help_button_hovered = false; - m_useImageList = false; m_buttonImageList = NULL; m_buttonSmallImageList = NULL; @@ -755,14 +754,9 @@ wxRibbonBar::wxRibbonBar(wxWindow* parent, wxRibbonBar::~wxRibbonBar() { SetArtProvider(NULL); - if (m_buttonImageList) - { - delete m_buttonImageList; m_buttonImageList = NULL; - } - if (m_buttonSmallImageList) - { - delete m_buttonSmallImageList; m_buttonSmallImageList = NULL; - } + + delete m_buttonImageList; + delete m_buttonSmallImageList; } bool wxRibbonBar::Create(wxWindow* parent, @@ -812,25 +806,26 @@ void wxRibbonBar::CommonInit(long style) m_ribbon_state = wxRIBBON_BAR_PINNED; - m_useImageList = false; m_buttonImageList = NULL; m_buttonSmallImageList = NULL; } -wxImageList* wxRibbonBar::GetButtonImageList(wxSize* isize) +wxImageList* wxRibbonBar::GetButtonImageList(wxSize size) { - if (m_useImageList && m_buttonImageList == NULL) + if ( !m_buttonImageList ) { - m_buttonImageList = new wxImageList(isize->GetWidth(), isize->GetHeight(), /*mask*/false); + m_buttonImageList = new wxImageList(size.GetWidth(), size.GetHeight(), + /*mask*/false); } return m_buttonImageList; } -wxImageList* wxRibbonBar::GetButtonSmallImageList(wxSize* isize) +wxImageList* wxRibbonBar::GetButtonSmallImageList(wxSize size) { - if (m_useImageList && m_buttonSmallImageList == NULL) + if ( !m_buttonSmallImageList ) { - m_buttonSmallImageList = new wxImageList(isize->GetWidth(), isize->GetHeight(), /*mask*/false); + m_buttonSmallImageList = new wxImageList(size.GetWidth(), size.GetHeight(), + /*mask*/false); } return m_buttonSmallImageList; } diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index d4946a1aee..201e467d50 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -352,8 +352,8 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( wxImageList* buttonSmallImageList = NULL; if (m_ownerRibbonBar) { - buttonImageList = m_ownerRibbonBar->GetButtonImageList(&m_bitmap_size_large); - buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(&m_bitmap_size_small); + buttonImageList = m_ownerRibbonBar->GetButtonImageList(m_bitmap_size_large); + buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(m_bitmap_size_small); } if (base->bitmap_large.IsOk() && buttonImageList) { @@ -882,8 +882,8 @@ void wxRibbonButtonBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) wxRect rect(button.position + m_layout_offset, base->sizes[button.size].size); if (base->barButtonImageListPos != -1 && m_ownerRibbonBar) { - wxImageList* buttonImageList = m_ownerRibbonBar->GetButtonImageList(); - wxImageList* buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(); + wxImageList* buttonImageList = m_ownerRibbonBar->GetButtonImageList(m_bitmap_size_large); + wxImageList* buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(m_bitmap_size_small); wxBitmap bitmap; wxBitmap bitmap_small; From 557843c5046ee8260730bb91259bd12508c2ad02 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 17:47:15 +0100 Subject: [PATCH 053/329] Remove wxRibbonButtonBar::m_ownerRibbonBar There is already a function returning the containing ribbon bar, so just use it instead. --- include/wx/ribbon/buttonbar.h | 1 - src/ribbon/buttonbar.cpp | 32 ++++++++++---------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/include/wx/ribbon/buttonbar.h b/include/wx/ribbon/buttonbar.h index e4bccc185f..bc54379261 100644 --- a/include/wx/ribbon/buttonbar.h +++ b/include/wx/ribbon/buttonbar.h @@ -213,7 +213,6 @@ protected: bool m_layouts_valid; bool m_lock_active_state; bool m_show_tooltips_for_disabled; - wxRibbonBar* m_ownerRibbonBar; #ifndef SWIG wxDECLARE_CLASS(wxRibbonButtonBar); diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 201e467d50..365b03bab5 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -350,11 +350,11 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( wxImageList* buttonImageList = NULL; wxImageList* buttonSmallImageList = NULL; - if (m_ownerRibbonBar) - { - buttonImageList = m_ownerRibbonBar->GetButtonImageList(m_bitmap_size_large); - buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(m_bitmap_size_small); - } + if ( wxRibbonBar* const ribbon = GetAncestorRibbonBar() ) + { + buttonImageList = ribbon->GetButtonImageList(m_bitmap_size_large); + buttonSmallImageList = ribbon->GetButtonSmallImageList(m_bitmap_size_small); + } if (base->bitmap_large.IsOk() && buttonImageList) { base->barButtonImageListPos = buttonImageList->Add(base->bitmap_large); @@ -880,10 +880,12 @@ void wxRibbonButtonBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) wxRibbonButtonBarButtonInstance& button = layout->buttons.Item(btn_i); wxRibbonButtonBarButtonBase* base = button.base; wxRect rect(button.position + m_layout_offset, base->sizes[button.size].size); - if (base->barButtonImageListPos != -1 && m_ownerRibbonBar) + + wxRibbonBar* const ribbon = GetAncestorRibbonBar(); + if ( base->barButtonImageListPos != -1 && ribbon ) { - wxImageList* buttonImageList = m_ownerRibbonBar->GetButtonImageList(m_bitmap_size_large); - wxImageList* buttonSmallImageList = m_ownerRibbonBar->GetButtonSmallImageList(m_bitmap_size_small); + wxImageList* buttonImageList = ribbon->GetButtonImageList(m_bitmap_size_large); + wxImageList* buttonSmallImageList = ribbon->GetButtonSmallImageList(m_bitmap_size_small); wxBitmap bitmap; wxBitmap bitmap_small; @@ -939,20 +941,6 @@ void wxRibbonButtonBar::OnSize(wxSizeEvent& evt) void wxRibbonButtonBar::CommonInit(long WXUNUSED(style)) { - //Our ultimate parent MAY be a ribbon bar, in which case - //we can use its image list. - m_ownerRibbonBar = NULL; - wxWindow* pWin = GetParent(); - while (pWin) - { - m_ownerRibbonBar = dynamic_cast(pWin); - if (m_ownerRibbonBar) - { - break; - } - pWin = pWin->GetParent(); - } - m_bitmap_size_large = wxSize(32, 32); m_bitmap_size_small = wxSize(16, 16); From d0fb1c973e008948fd3b59b31e09aa2d82612bc5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 17:49:41 +0100 Subject: [PATCH 054/329] Use correct type for image list position field It's just an int and not a coordinate. --- src/ribbon/buttonbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 365b03bab5..5c48cf4307 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -128,7 +128,7 @@ public: wxBitmap bitmap_small; wxBitmap bitmap_small_disabled; wxCoord text_min_width[3]; - wxCoord barButtonImageListPos; + int barButtonImageListPos; int barButtonSmallImageListPos; wxRibbonButtonBarButtonSizeInfo sizes[3]; wxRibbonButtonBarButtonState min_size_class; From bd90e484cbe3e3df5b5a803af4b6dc7fb17ea803 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 17:52:54 +0100 Subject: [PATCH 055/329] Initialize image list positions in ctor Also add a comment explaining how these indices work. --- src/ribbon/buttonbar.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 5c48cf4307..1be572a54e 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -67,6 +67,12 @@ public: class wxRibbonButtonBarButtonBase { public: + wxRibbonButtonBarButtonBase() + { + barButtonImageListPos = + barButtonSmallImageListPos = -1; + } + wxRibbonButtonBarButtonInstance NewInstance() { wxRibbonButtonBarButtonInstance i; @@ -128,8 +134,14 @@ public: wxBitmap bitmap_small; wxBitmap bitmap_small_disabled; wxCoord text_min_width[3]; + + // Index of the bitmap in the wxRibbonBar normal image list. Notice that + // the disabled bitmap is in the next position, so this one is always even. int barButtonImageListPos; + + // Same thing for the small bitmap index in the small image list. int barButtonSmallImageListPos; + wxRibbonButtonBarButtonSizeInfo sizes[3]; wxRibbonButtonBarButtonState min_size_class; wxRibbonButtonBarButtonState max_size_class; @@ -367,11 +379,6 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( buttonSmallImageList->Add(base->bitmap_small_disabled); base->bitmap_small_disabled = wxNullBitmap; } - else - { - base->barButtonImageListPos = -1; - base->barButtonSmallImageListPos = -1; - } wxClientDC temp_dc(this); FetchButtonSizeInfo(base, wxRIBBON_BUTTONBAR_BUTTON_SMALL, temp_dc); From 533fd61c5e57e7ec1a8b23c628920b9e49d055e8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 18:09:12 +0100 Subject: [PATCH 056/329] Rename wxRibbonButtonBarButtonBase members to use m_ prefix This will avoid conflict with the function parameters with the same names in the upcoming commits. No real changes yet. --- src/ribbon/buttonbar.cpp | 66 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 1be572a54e..6f960242bd 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -129,10 +129,10 @@ public: wxString label; wxString help_string; - wxBitmap bitmap_large; - wxBitmap bitmap_large_disabled; - wxBitmap bitmap_small; - wxBitmap bitmap_small_disabled; + wxBitmap m_bitmap_large; + wxBitmap m_bitmap_large_disabled; + wxBitmap m_bitmap_small; + wxBitmap m_bitmap_small_disabled; wxCoord text_min_width[3]; // Index of the bitmap in the wxRibbonBar normal image list. Notice that @@ -367,17 +367,17 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( buttonImageList = ribbon->GetButtonImageList(m_bitmap_size_large); buttonSmallImageList = ribbon->GetButtonSmallImageList(m_bitmap_size_small); } - if (base->bitmap_large.IsOk() && buttonImageList) + if (base->m_bitmap_large.IsOk() && buttonImageList) { - base->barButtonImageListPos = buttonImageList->Add(base->bitmap_large); - base->bitmap_large = wxNullBitmap; - buttonImageList->Add(base->bitmap_large_disabled); - base->bitmap_large_disabled = wxNullBitmap; + base->barButtonImageListPos = buttonImageList->Add(base->m_bitmap_large); + base->m_bitmap_large = wxNullBitmap; + buttonImageList->Add(base->m_bitmap_large_disabled); + base->m_bitmap_large_disabled = wxNullBitmap; - base->barButtonSmallImageListPos = buttonSmallImageList->Add(base->bitmap_small); - base->bitmap_small = wxNullBitmap; - buttonSmallImageList->Add(base->bitmap_small_disabled); - base->bitmap_small_disabled = wxNullBitmap; + base->barButtonSmallImageListPos = buttonSmallImageList->Add(base->m_bitmap_small); + base->m_bitmap_small = wxNullBitmap; + buttonSmallImageList->Add(base->m_bitmap_small_disabled); + base->m_bitmap_small_disabled = wxNullBitmap; } wxClientDC temp_dc(this); @@ -911,12 +911,12 @@ void wxRibbonButtonBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) } else { - wxBitmap* bitmap = &base->bitmap_large; - wxBitmap* bitmap_small = &base->bitmap_small; + wxBitmap* bitmap = &base->m_bitmap_large; + wxBitmap* bitmap_small = &base->m_bitmap_small; if(base->state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) { - bitmap = &base->bitmap_large_disabled; - bitmap_small = &base->bitmap_small_disabled; + bitmap = &base->m_bitmap_large_disabled; + bitmap_small = &base->m_bitmap_small_disabled; } m_art->DrawButtonBarButton(dc, this, rect, base->kind, base->state | button.size, base->label, *bitmap, *bitmap_small); @@ -1226,37 +1226,37 @@ void wxRibbonButtonBar::MakeBitmaps(wxRibbonButtonBarButtonBase* base, const wxBitmap& bitmap_small, const wxBitmap& bitmap_small_disabled) { - base->bitmap_large = bitmap_large; - if(!base->bitmap_large.IsOk()) + base->m_bitmap_large = bitmap_large; + if(!base->m_bitmap_large.IsOk()) { - base->bitmap_large = MakeResizedBitmap(base->bitmap_small, + base->m_bitmap_large = MakeResizedBitmap(base->m_bitmap_small, m_bitmap_size_large); } - else if(base->bitmap_large.GetScaledSize() != m_bitmap_size_large) + else if(base->m_bitmap_large.GetScaledSize() != m_bitmap_size_large) { - base->bitmap_large = MakeResizedBitmap(base->bitmap_large, + base->m_bitmap_large = MakeResizedBitmap(base->m_bitmap_large, m_bitmap_size_large); } - base->bitmap_small = bitmap_small; - if(!base->bitmap_small.IsOk()) + base->m_bitmap_small = bitmap_small; + if(!base->m_bitmap_small.IsOk()) { - base->bitmap_small = MakeResizedBitmap(base->bitmap_large, + base->m_bitmap_small = MakeResizedBitmap(base->m_bitmap_large, m_bitmap_size_small); } - else if(base->bitmap_small.GetScaledSize() != m_bitmap_size_small) + else if(base->m_bitmap_small.GetScaledSize() != m_bitmap_size_small) { - base->bitmap_small = MakeResizedBitmap(base->bitmap_small, + base->m_bitmap_small = MakeResizedBitmap(base->m_bitmap_small, m_bitmap_size_small); } - base->bitmap_large_disabled = bitmap_large_disabled; - if(!base->bitmap_large_disabled.IsOk()) + base->m_bitmap_large_disabled = bitmap_large_disabled; + if(!base->m_bitmap_large_disabled.IsOk()) { - base->bitmap_large_disabled = MakeDisabledBitmap(base->bitmap_large); + base->m_bitmap_large_disabled = MakeDisabledBitmap(base->m_bitmap_large); } - base->bitmap_small_disabled = bitmap_small_disabled; - if(!base->bitmap_small_disabled.IsOk()) + base->m_bitmap_small_disabled = bitmap_small_disabled; + if(!base->m_bitmap_small_disabled.IsOk()) { - base->bitmap_small_disabled = MakeDisabledBitmap(base->bitmap_small); + base->m_bitmap_small_disabled = MakeDisabledBitmap(base->m_bitmap_small); } } From 5a30886696b1ddaafc02a04bfb61c251ab896927 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 18:11:47 +0100 Subject: [PATCH 057/329] Move bitmap-related functions to wxRibbonButtonBarButtonBase Improve encapsulation by making the function setting the members of a class a member of the same class, instead of doing it outside of it. --- include/wx/ribbon/buttonbar.h | 7 -- src/ribbon/buttonbar.cpp | 128 ++++++++++++++++++---------------- 2 files changed, 67 insertions(+), 68 deletions(-) diff --git a/include/wx/ribbon/buttonbar.h b/include/wx/ribbon/buttonbar.h index bc54379261..a38d1fac07 100644 --- a/include/wx/ribbon/buttonbar.h +++ b/include/wx/ribbon/buttonbar.h @@ -190,13 +190,6 @@ protected: void TryCollapseLayout(wxRibbonButtonBarLayout* original, size_t first_btn, size_t* last_button, wxRibbonButtonBarButtonState target_size); - void MakeBitmaps(wxRibbonButtonBarButtonBase* base, - const wxBitmap& bitmap_large, - const wxBitmap& bitmap_large_disabled, - const wxBitmap& bitmap_small, - const wxBitmap& bitmap_small_disabled); - static wxBitmap MakeResizedBitmap(const wxBitmap& original, wxSize size); - static wxBitmap MakeDisabledBitmap(const wxBitmap& original); void FetchButtonSizeInfo(wxRibbonButtonBarButtonBase* button, wxRibbonButtonBarButtonState size, wxDC& dc); virtual void UpdateWindowUI(long flags) wxOVERRIDE; diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 6f960242bd..e7665295cc 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -64,6 +64,28 @@ public: wxRibbonButtonBarButtonState size; }; +namespace +{ + +wxBitmap MakeResizedBitmap(const wxBitmap& original, wxSize size) +{ + double scale = original.GetScaleFactor(); + if (scale > 1.0) + scale = 2.0; + + wxImage img(original.ConvertToImage()); + img.Rescale(scale * size.GetWidth(), scale * size.GetHeight(), wxIMAGE_QUALITY_HIGH); + return wxBitmap(img, -1, scale); +} + +wxBitmap MakeDisabledBitmap(const wxBitmap& original) +{ + wxImage img(original.ConvertToImage()); + return wxBitmap(img.ConvertToGreyscale(), -1, original.GetScaleFactor()); +} + +} // anonymous namespace + class wxRibbonButtonBarButtonBase { public: @@ -73,6 +95,47 @@ public: barButtonSmallImageListPos = -1; } + void SetBitmaps(wxSize bitmap_size_large, + wxSize bitmap_size_small, + const wxBitmap& bitmap_large, + const wxBitmap& bitmap_large_disabled, + const wxBitmap& bitmap_small, + const wxBitmap& bitmap_small_disabled) + { + m_bitmap_large = bitmap_large; + if(!m_bitmap_large.IsOk()) + { + m_bitmap_large = MakeResizedBitmap(m_bitmap_small, + bitmap_size_large); + } + else if(m_bitmap_large.GetScaledSize() != bitmap_size_large) + { + m_bitmap_large = MakeResizedBitmap(m_bitmap_large, + bitmap_size_large); + } + m_bitmap_small = bitmap_small; + if(!m_bitmap_small.IsOk()) + { + m_bitmap_small = MakeResizedBitmap(m_bitmap_large, + bitmap_size_small); + } + else if(m_bitmap_small.GetScaledSize() != bitmap_size_small) + { + m_bitmap_small = MakeResizedBitmap(m_bitmap_small, + bitmap_size_small); + } + m_bitmap_large_disabled = bitmap_large_disabled; + if(!m_bitmap_large_disabled.IsOk()) + { + m_bitmap_large_disabled = MakeDisabledBitmap(m_bitmap_large); + } + m_bitmap_small_disabled = bitmap_small_disabled; + if(!m_bitmap_small_disabled.IsOk()) + { + m_bitmap_small_disabled = MakeDisabledBitmap(m_bitmap_small); + } + } + wxRibbonButtonBarButtonInstance NewInstance() { wxRibbonButtonBarButtonInstance i; @@ -349,8 +412,8 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( wxRibbonButtonBarButtonBase* base = new wxRibbonButtonBarButtonBase; base->id = button_id; base->label = label; - MakeBitmaps(base, bitmap, bitmap_disabled, - bitmap_small, bitmap_small_disabled); + base->SetBitmaps(m_bitmap_size_large, m_bitmap_size_small, + bitmap, bitmap_disabled, bitmap_small, bitmap_small_disabled); base->kind = kind; base->help_string = help_string; base->state = 0; @@ -486,23 +549,6 @@ void wxRibbonButtonBar::FetchButtonSizeInfo(wxRibbonButtonBarButtonBase* button, info.is_supported = false; } -wxBitmap wxRibbonButtonBar::MakeResizedBitmap(const wxBitmap& original, wxSize size) -{ - double scale = original.GetScaleFactor(); - if (scale > 1.0) - scale = 2.0; - - wxImage img(original.ConvertToImage()); - img.Rescale(scale * size.GetWidth(), scale * size.GetHeight(), wxIMAGE_QUALITY_HIGH); - return wxBitmap(img, -1, scale); -} - -wxBitmap wxRibbonButtonBar::MakeDisabledBitmap(const wxBitmap& original) -{ - wxImage img(original.ConvertToImage()); - return wxBitmap(img.ConvertToGreyscale(), -1, original.GetScaleFactor()); -} - size_t wxRibbonButtonBar::GetButtonCount() const { return m_buttons.GetCount(); @@ -626,8 +672,8 @@ void wxRibbonButtonBar::SetButtonIcon( wxRibbonButtonBarButtonBase* base = GetItemById(button_id); if(base == NULL) return; - MakeBitmaps(base, bitmap, bitmap_small, - bitmap_disabled, bitmap_small_disabled); + base->SetBitmaps(m_bitmap_size_large, m_bitmap_size_small, + bitmap, bitmap_disabled, bitmap_small, bitmap_small_disabled); Refresh(); } @@ -1220,46 +1266,6 @@ void wxRibbonButtonBar::TryCollapseLayout(wxRibbonButtonBarLayout* original, m_layouts.Add(layout); } -void wxRibbonButtonBar::MakeBitmaps(wxRibbonButtonBarButtonBase* base, - const wxBitmap& bitmap_large, - const wxBitmap& bitmap_large_disabled, - const wxBitmap& bitmap_small, - const wxBitmap& bitmap_small_disabled) -{ - base->m_bitmap_large = bitmap_large; - if(!base->m_bitmap_large.IsOk()) - { - base->m_bitmap_large = MakeResizedBitmap(base->m_bitmap_small, - m_bitmap_size_large); - } - else if(base->m_bitmap_large.GetScaledSize() != m_bitmap_size_large) - { - base->m_bitmap_large = MakeResizedBitmap(base->m_bitmap_large, - m_bitmap_size_large); - } - base->m_bitmap_small = bitmap_small; - if(!base->m_bitmap_small.IsOk()) - { - base->m_bitmap_small = MakeResizedBitmap(base->m_bitmap_large, - m_bitmap_size_small); - } - else if(base->m_bitmap_small.GetScaledSize() != m_bitmap_size_small) - { - base->m_bitmap_small = MakeResizedBitmap(base->m_bitmap_small, - m_bitmap_size_small); - } - base->m_bitmap_large_disabled = bitmap_large_disabled; - if(!base->m_bitmap_large_disabled.IsOk()) - { - base->m_bitmap_large_disabled = MakeDisabledBitmap(base->m_bitmap_large); - } - base->m_bitmap_small_disabled = bitmap_small_disabled; - if(!base->m_bitmap_small_disabled.IsOk()) - { - base->m_bitmap_small_disabled = MakeDisabledBitmap(base->m_bitmap_small); - } -} - void wxRibbonButtonBar::OnMouseMove(wxMouseEvent& evt) { wxPoint cursor(evt.GetPosition()); From c6b3a6f2b45a4470d2b161f39ed00053abdcd2e5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 18:22:08 +0100 Subject: [PATCH 058/329] Handle image lists in wxRibbonButtonBarButtonBase too This makes more sense and also allows SetButtonIcon() to work with them. --- src/ribbon/buttonbar.cpp | 54 +++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index e7665295cc..07e5756e45 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -95,7 +95,8 @@ public: barButtonSmallImageListPos = -1; } - void SetBitmaps(wxSize bitmap_size_large, + void SetBitmaps(wxRibbonBar* ribbon, + wxSize bitmap_size_large, wxSize bitmap_size_small, const wxBitmap& bitmap_large, const wxBitmap& bitmap_large_disabled, @@ -103,16 +104,17 @@ public: const wxBitmap& bitmap_small_disabled) { m_bitmap_large = bitmap_large; - if(!m_bitmap_large.IsOk()) + if(!bitmap_large.IsOk()) { m_bitmap_large = MakeResizedBitmap(m_bitmap_small, bitmap_size_large); } - else if(m_bitmap_large.GetScaledSize() != bitmap_size_large) + else if(bitmap_large.GetScaledSize() != bitmap_size_large) { m_bitmap_large = MakeResizedBitmap(m_bitmap_large, bitmap_size_large); } + m_bitmap_small = bitmap_small; if(!m_bitmap_small.IsOk()) { @@ -134,6 +136,28 @@ public: { m_bitmap_small_disabled = MakeDisabledBitmap(m_bitmap_small); } + + if ( ribbon ) + { + if ( m_bitmap_large.IsOk() ) + { + wxImageList* const + buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); + + barButtonImageListPos = buttonImageList->Add(m_bitmap_large); + m_bitmap_large = wxNullBitmap; + buttonImageList->Add(m_bitmap_large_disabled); + m_bitmap_large_disabled = wxNullBitmap; + } + + wxImageList* const + buttonSmallImageList = ribbon->GetButtonSmallImageList(bitmap_size_small); + + barButtonSmallImageListPos = buttonSmallImageList->Add(m_bitmap_small); + m_bitmap_small = wxNullBitmap; + buttonSmallImageList->Add(m_bitmap_small_disabled); + m_bitmap_small_disabled = wxNullBitmap; + } } wxRibbonButtonBarButtonInstance NewInstance() @@ -412,7 +436,7 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( wxRibbonButtonBarButtonBase* base = new wxRibbonButtonBarButtonBase; base->id = button_id; base->label = label; - base->SetBitmaps(m_bitmap_size_large, m_bitmap_size_small, + base->SetBitmaps(GetAncestorRibbonBar(), m_bitmap_size_large, m_bitmap_size_small, bitmap, bitmap_disabled, bitmap_small, bitmap_small_disabled); base->kind = kind; base->help_string = help_string; @@ -423,26 +447,6 @@ wxRibbonButtonBarButtonBase* wxRibbonButtonBar::InsertButton( base->min_size_class = wxRIBBON_BUTTONBAR_BUTTON_SMALL; base->max_size_class = wxRIBBON_BUTTONBAR_BUTTON_LARGE; - wxImageList* buttonImageList = NULL; - wxImageList* buttonSmallImageList = NULL; - if ( wxRibbonBar* const ribbon = GetAncestorRibbonBar() ) - { - buttonImageList = ribbon->GetButtonImageList(m_bitmap_size_large); - buttonSmallImageList = ribbon->GetButtonSmallImageList(m_bitmap_size_small); - } - if (base->m_bitmap_large.IsOk() && buttonImageList) - { - base->barButtonImageListPos = buttonImageList->Add(base->m_bitmap_large); - base->m_bitmap_large = wxNullBitmap; - buttonImageList->Add(base->m_bitmap_large_disabled); - base->m_bitmap_large_disabled = wxNullBitmap; - - base->barButtonSmallImageListPos = buttonSmallImageList->Add(base->m_bitmap_small); - base->m_bitmap_small = wxNullBitmap; - buttonSmallImageList->Add(base->m_bitmap_small_disabled); - base->m_bitmap_small_disabled = wxNullBitmap; - } - wxClientDC temp_dc(this); FetchButtonSizeInfo(base, wxRIBBON_BUTTONBAR_BUTTON_SMALL, temp_dc); FetchButtonSizeInfo(base, wxRIBBON_BUTTONBAR_BUTTON_MEDIUM, temp_dc); @@ -672,7 +676,7 @@ void wxRibbonButtonBar::SetButtonIcon( wxRibbonButtonBarButtonBase* base = GetItemById(button_id); if(base == NULL) return; - base->SetBitmaps(m_bitmap_size_large, m_bitmap_size_small, + base->SetBitmaps(GetAncestorRibbonBar(), m_bitmap_size_large, m_bitmap_size_small, bitmap, bitmap_disabled, bitmap_small, bitmap_small_disabled); Refresh(); } From 18e8a68c1b85444d2947a2a69d266d8ad4f12813 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 19:02:24 +0100 Subject: [PATCH 059/329] Move code accessing bitmaps to wxRibbonButtonBarButtonBase too This also improves encapsulation and allows to avoid duplicating calls to DrawButtonBarButton(). --- src/ribbon/buttonbar.cpp | 81 +++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 07e5756e45..643f4cfbea 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -160,6 +160,45 @@ public: } } + void GetBitmaps(wxRibbonBar* ribbon, + wxSize bitmap_size_large, + wxSize bitmap_size_small, + wxBitmap& bitmap, + wxBitmap bitmap_small) const + { + if ( barButtonImageListPos != -1 && ribbon ) + { + wxImageList* buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); + wxImageList* buttonSmallImageList = ribbon->GetButtonSmallImageList(bitmap_size_small); + + int pos = barButtonImageListPos; + int pos_small = barButtonSmallImageListPos; + + if (state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) + { + // Disabled buttons are stored after the normal ones. + pos++; + pos_small++; + } + + bitmap = buttonImageList->GetBitmap(pos); + bitmap_small = buttonSmallImageList->GetBitmap(pos_small); + } + else + { + if(state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) + { + bitmap = m_bitmap_large_disabled; + bitmap_small = m_bitmap_small_disabled; + } + else + { + bitmap = m_bitmap_large; + bitmap_small = m_bitmap_small; + } + } + } + wxRibbonButtonBarButtonInstance NewInstance() { wxRibbonButtonBarButtonInstance i; @@ -930,6 +969,8 @@ void wxRibbonButtonBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) wxRibbonButtonBarLayout* layout = m_layouts.Item(m_current_layout); + wxRibbonBar* const ribbon = GetAncestorRibbonBar(); + size_t btn_count = layout->buttons.Count(); size_t btn_i; for(btn_i = 0; btn_i < btn_count; ++btn_i) @@ -938,40 +979,12 @@ void wxRibbonButtonBar::OnPaint(wxPaintEvent& WXUNUSED(evt)) wxRibbonButtonBarButtonBase* base = button.base; wxRect rect(button.position + m_layout_offset, base->sizes[button.size].size); - wxRibbonBar* const ribbon = GetAncestorRibbonBar(); - if ( base->barButtonImageListPos != -1 && ribbon ) - { - wxImageList* buttonImageList = ribbon->GetButtonImageList(m_bitmap_size_large); - wxImageList* buttonSmallImageList = ribbon->GetButtonSmallImageList(m_bitmap_size_small); - - wxBitmap bitmap; - wxBitmap bitmap_small; - if (base->state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) - { - bitmap = buttonImageList->GetBitmap(base->barButtonImageListPos+1); - bitmap_small = buttonSmallImageList->GetBitmap(base->barButtonSmallImageListPos+1); - } - else - { - bitmap = buttonImageList->GetBitmap(base->barButtonImageListPos); - bitmap_small = buttonSmallImageList->GetBitmap(base->barButtonSmallImageListPos); - } - m_art->DrawButtonBarButton(dc, this, rect, base->kind, - base->state | button.size, base->label, bitmap, bitmap_small); - } - else - { - wxBitmap* bitmap = &base->m_bitmap_large; - wxBitmap* bitmap_small = &base->m_bitmap_small; - if(base->state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) - { - bitmap = &base->m_bitmap_large_disabled; - bitmap_small = &base->m_bitmap_small_disabled; - } - m_art->DrawButtonBarButton(dc, this, rect, base->kind, - base->state | button.size, base->label, *bitmap, *bitmap_small); - } - + wxBitmap bitmap, bitmap_small; + base->GetBitmaps(ribbon, + m_bitmap_size_large, m_bitmap_size_small, bitmap, + bitmap_small); + m_art->DrawButtonBarButton(dc, this, rect, base->kind, + base->state | button.size, base->label, bitmap, bitmap_small); } } From 10c49631a3b4801b209986295de1025bcd4b6113 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 19:21:33 +0100 Subject: [PATCH 060/329] Store any number of image lists in wxRibbonBar, not just two The same wxRibbonBar can use multiple button bars with different icon sizes, so 2 image lists are not enough. But OTOH there is no need to distinguish between small and large images neither, so 2 may be also 1 too many. Instead, use however many image lists we need, depending on the size. For now, just store them in a vector and use linear search in it, instead of using a map or, maybe, sorted vector, as we suppose there are never going to be more than a couple of elements in this vector anyhow. --- include/wx/ribbon/bar.h | 9 +++++---- src/ribbon/bar.cpp | 32 ++++++++++++-------------------- src/ribbon/buttonbar.cpp | 6 +++--- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/include/wx/ribbon/bar.h b/include/wx/ribbon/bar.h index db30dfcbe8..142e1bab3b 100644 --- a/include/wx/ribbon/bar.h +++ b/include/wx/ribbon/bar.h @@ -20,6 +20,8 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; #include "wx/ribbon/control.h" #include "wx/ribbon/page.h" +#include "wx/vector.h" + enum wxRibbonBarOption { wxRIBBON_BAR_SHOW_PAGE_LABELS = 1 << 0, @@ -154,9 +156,9 @@ public: void HideIfExpanded(); - // Implementation only. + // Return the image list containing images of the given size, creating it + // if necessary. wxImageList* GetButtonImageList(wxSize size); - wxImageList* GetButtonSmallImageList(wxSize size); protected: friend class wxRibbonPage; @@ -214,8 +216,7 @@ protected: wxRibbonDisplayMode m_ribbon_state; - wxImageList* m_buttonImageList; - wxImageList* m_buttonSmallImageList; + wxVector m_image_lists; #ifndef SWIG wxDECLARE_CLASS(wxRibbonBar); diff --git a/src/ribbon/bar.cpp b/src/ribbon/bar.cpp index fefcffdccd..df2d57e1e8 100644 --- a/src/ribbon/bar.cpp +++ b/src/ribbon/bar.cpp @@ -736,8 +736,6 @@ wxRibbonBar::wxRibbonBar() m_tab_scroll_buttons_shown = false; m_arePanelsShown = true; m_help_button_hovered = false; - m_buttonImageList = NULL; - m_buttonSmallImageList = NULL; } @@ -755,8 +753,10 @@ wxRibbonBar::~wxRibbonBar() { SetArtProvider(NULL); - delete m_buttonImageList; - delete m_buttonSmallImageList; + for ( size_t n = 0; n < m_image_lists.size(); ++n ) + { + delete m_image_lists[n]; + } } bool wxRibbonBar::Create(wxWindow* parent, @@ -805,29 +805,21 @@ void wxRibbonBar::CommonInit(long style) m_bar_hovered = false; m_ribbon_state = wxRIBBON_BAR_PINNED; - - m_buttonImageList = NULL; - m_buttonSmallImageList = NULL; } wxImageList* wxRibbonBar::GetButtonImageList(wxSize size) { - if ( !m_buttonImageList ) + for ( size_t n = 0; n < m_image_lists.size(); ++n ) { - m_buttonImageList = new wxImageList(size.GetWidth(), size.GetHeight(), - /*mask*/false); + if ( m_image_lists[n]->GetSize() == size ) + return m_image_lists[n]; } - return m_buttonImageList; -} -wxImageList* wxRibbonBar::GetButtonSmallImageList(wxSize size) -{ - if ( !m_buttonSmallImageList ) - { - m_buttonSmallImageList = new wxImageList(size.GetWidth(), size.GetHeight(), - /*mask*/false); - } - return m_buttonSmallImageList; + wxImageList* const + il = new wxImageList(size.GetWidth(), size.GetHeight(), /*mask*/false); + m_image_lists.push_back(il); + + return il; } void wxRibbonBar::SetArtProvider(wxRibbonArtProvider* art) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 643f4cfbea..6ef786c656 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -151,7 +151,7 @@ public: } wxImageList* const - buttonSmallImageList = ribbon->GetButtonSmallImageList(bitmap_size_small); + buttonSmallImageList = ribbon->GetButtonImageList(bitmap_size_small); barButtonSmallImageListPos = buttonSmallImageList->Add(m_bitmap_small); m_bitmap_small = wxNullBitmap; @@ -164,12 +164,12 @@ public: wxSize bitmap_size_large, wxSize bitmap_size_small, wxBitmap& bitmap, - wxBitmap bitmap_small) const + wxBitmap& bitmap_small) const { if ( barButtonImageListPos != -1 && ribbon ) { wxImageList* buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); - wxImageList* buttonSmallImageList = ribbon->GetButtonSmallImageList(bitmap_size_small); + wxImageList* buttonSmallImageList = ribbon->GetButtonImageList(bitmap_size_small); int pos = barButtonImageListPos; int pos_small = barButtonSmallImageListPos; From ad552d211768daf961d95233e7ec1a4bbe7f7fa2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Feb 2020 19:29:04 +0100 Subject: [PATCH 061/329] Always use wxRibbonBar image lists in wxRibbonButtonBar Assume that we can always rely on being a child of wxRibbonBar, and always use its image lists. --- src/ribbon/buttonbar.cpp | 115 ++++++++++++++------------------------- 1 file changed, 41 insertions(+), 74 deletions(-) diff --git a/src/ribbon/buttonbar.cpp b/src/ribbon/buttonbar.cpp index 6ef786c656..f4648c6a87 100644 --- a/src/ribbon/buttonbar.cpp +++ b/src/ribbon/buttonbar.cpp @@ -98,66 +98,53 @@ public: void SetBitmaps(wxRibbonBar* ribbon, wxSize bitmap_size_large, wxSize bitmap_size_small, - const wxBitmap& bitmap_large, - const wxBitmap& bitmap_large_disabled, - const wxBitmap& bitmap_small, - const wxBitmap& bitmap_small_disabled) + wxBitmap bitmap_large, + wxBitmap bitmap_large_disabled, + wxBitmap bitmap_small, + wxBitmap bitmap_small_disabled) { - m_bitmap_large = bitmap_large; if(!bitmap_large.IsOk()) { - m_bitmap_large = MakeResizedBitmap(m_bitmap_small, - bitmap_size_large); + bitmap_large = MakeResizedBitmap(bitmap_small, bitmap_size_large); } else if(bitmap_large.GetScaledSize() != bitmap_size_large) { - m_bitmap_large = MakeResizedBitmap(m_bitmap_large, - bitmap_size_large); + bitmap_large = MakeResizedBitmap(bitmap_large, bitmap_size_large); } - m_bitmap_small = bitmap_small; - if(!m_bitmap_small.IsOk()) + if(!bitmap_small.IsOk()) { - m_bitmap_small = MakeResizedBitmap(m_bitmap_large, - bitmap_size_small); + bitmap_small = MakeResizedBitmap(bitmap_large, bitmap_size_small); } - else if(m_bitmap_small.GetScaledSize() != bitmap_size_small) + else if(bitmap_small.GetScaledSize() != bitmap_size_small) { - m_bitmap_small = MakeResizedBitmap(m_bitmap_small, - bitmap_size_small); - } - m_bitmap_large_disabled = bitmap_large_disabled; - if(!m_bitmap_large_disabled.IsOk()) - { - m_bitmap_large_disabled = MakeDisabledBitmap(m_bitmap_large); - } - m_bitmap_small_disabled = bitmap_small_disabled; - if(!m_bitmap_small_disabled.IsOk()) - { - m_bitmap_small_disabled = MakeDisabledBitmap(m_bitmap_small); + bitmap_small = MakeResizedBitmap(bitmap_small, bitmap_size_small); } - if ( ribbon ) + if(!bitmap_large_disabled.IsOk()) { - if ( m_bitmap_large.IsOk() ) - { - wxImageList* const - buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); + bitmap_large_disabled = MakeDisabledBitmap(bitmap_large); + } - barButtonImageListPos = buttonImageList->Add(m_bitmap_large); - m_bitmap_large = wxNullBitmap; - buttonImageList->Add(m_bitmap_large_disabled); - m_bitmap_large_disabled = wxNullBitmap; - } + if(!bitmap_small_disabled.IsOk()) + { + bitmap_small_disabled = MakeDisabledBitmap(bitmap_small); + } + if ( bitmap_large.IsOk() ) + { wxImageList* const - buttonSmallImageList = ribbon->GetButtonImageList(bitmap_size_small); + buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); - barButtonSmallImageListPos = buttonSmallImageList->Add(m_bitmap_small); - m_bitmap_small = wxNullBitmap; - buttonSmallImageList->Add(m_bitmap_small_disabled); - m_bitmap_small_disabled = wxNullBitmap; + barButtonImageListPos = buttonImageList->Add(bitmap_large); + buttonImageList->Add(bitmap_large_disabled); } + + wxImageList* const + buttonSmallImageList = ribbon->GetButtonImageList(bitmap_size_small); + + barButtonSmallImageListPos = buttonSmallImageList->Add(bitmap_small); + buttonSmallImageList->Add(bitmap_small_disabled); } void GetBitmaps(wxRibbonBar* ribbon, @@ -166,37 +153,21 @@ public: wxBitmap& bitmap, wxBitmap& bitmap_small) const { - if ( barButtonImageListPos != -1 && ribbon ) + wxImageList* buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); + wxImageList* buttonSmallImageList = ribbon->GetButtonImageList(bitmap_size_small); + + int pos = barButtonImageListPos; + int pos_small = barButtonSmallImageListPos; + + if (state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) { - wxImageList* buttonImageList = ribbon->GetButtonImageList(bitmap_size_large); - wxImageList* buttonSmallImageList = ribbon->GetButtonImageList(bitmap_size_small); - - int pos = barButtonImageListPos; - int pos_small = barButtonSmallImageListPos; - - if (state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) - { - // Disabled buttons are stored after the normal ones. - pos++; - pos_small++; - } - - bitmap = buttonImageList->GetBitmap(pos); - bitmap_small = buttonSmallImageList->GetBitmap(pos_small); - } - else - { - if(state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED) - { - bitmap = m_bitmap_large_disabled; - bitmap_small = m_bitmap_small_disabled; - } - else - { - bitmap = m_bitmap_large; - bitmap_small = m_bitmap_small; - } + // Disabled buttons are stored after the normal ones. + pos++; + pos_small++; } + + bitmap = buttonImageList->GetBitmap(pos); + bitmap_small = buttonSmallImageList->GetBitmap(pos_small); } wxRibbonButtonBarButtonInstance NewInstance() @@ -255,10 +226,6 @@ public: wxString label; wxString help_string; - wxBitmap m_bitmap_large; - wxBitmap m_bitmap_large_disabled; - wxBitmap m_bitmap_small; - wxBitmap m_bitmap_small_disabled; wxCoord text_min_width[3]; // Index of the bitmap in the wxRibbonBar normal image list. Notice that From a40acbb28e8b2947b6f8981a3a8a92765e47cdfc Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Thu, 6 Feb 2020 23:45:32 +0700 Subject: [PATCH 062/329] Add CanOverflow function to wxGridCellAttr Add function to determine whether the cell will draw the overflowed text to neighbour cells. Note that only left aligned cells currently can overflow. --- include/wx/generic/grid.h | 3 +++ interface/wx/grid.h | 12 ++++++++++++ src/generic/grid.cpp | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index d753161100..21184f9c17 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -570,6 +570,9 @@ public: void GetSize(int *num_rows, int *num_cols) const; wxGridFitMode GetFitMode() const; bool GetOverflow() const { return GetFitMode().IsOverflow(); } + // whether the cell will draw the overflowed text to neighbour cells + // currently only left aligned cells can overflow + bool CanOverflow() const; wxGridCellRenderer *GetRenderer(const wxGrid* grid, int row, int col) const; wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const; diff --git a/interface/wx/grid.h b/interface/wx/grid.h index ffba02af79..77319ed411 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -1234,6 +1234,18 @@ public: */ bool GetOverflow() const; + /** + Returns @true if the cell will draw an overflowed text into the + neighbouring cells. + + Note that only left aligned cells currenty can overflow. It means that + GetFitMode().IsOverflow() should returns true and GetAlignment should + returns wxALIGN_LEFT for hAlign parameter. + + @since 3.1.4 + */ + bool CanOverflow() const; + wxAttrKind GetKind(); diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index d3fed3f57d..ed11e6c7e0 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -645,6 +645,13 @@ wxGridFitMode wxGridCellAttr::GetFitMode() const } } +bool wxGridCellAttr::CanOverflow() const +{ + int hAlign; + GetAlignment(&hAlign, NULL); + return GetOverflow() && (hAlign == wxALIGN_LEFT); +} + // GetRenderer and GetEditor use a slightly different decision path about // which attribute to use. If a non-default attr object has one then it is // used, otherwise the default editor or renderer is fetched from the grid and From e0c09c84386c74c70dc8427ee6e9022f017528c5 Mon Sep 17 00:00:00 2001 From: Ilya Sinitsyn Date: Wed, 5 Feb 2020 00:48:52 +0700 Subject: [PATCH 063/329] Only overflow left-aligned cells in wxGrid Doing it for cells using a different alignment doesn't work correctly and it's not clear whether it really makes sense, so just don't do it at all for now. Closes https://github.com/wxWidgets/wxWidgets/pull/1726 --- src/generic/grid.cpp | 6 +++++- src/generic/gridctrl.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index ed11e6c7e0..09c4fde9d5 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6086,7 +6086,11 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells ) { if (!m_table->IsEmptyCell(row + l, j)) { - if (GetCellOverflow(row + l, j)) + wxGridCellAttr *attr = GetCellAttr(row + l, j); + const bool canOverflow = attr->CanOverflow(); + attr->DecRef(); + + if ( canOverflow ) { wxGridCellCoords cell(row + l, j); bool marked = false; diff --git a/src/generic/gridctrl.cpp b/src/generic/gridctrl.cpp index 0efd1b499a..0d04d89e34 100644 --- a/src/generic/gridctrl.cpp +++ b/src/generic/gridctrl.cpp @@ -591,7 +591,7 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid, // erase only this cells background, overflow cells should have been erased wxGridCellRenderer::Draw(grid, attr, dc, rectCell, row, col, isSelected); - if (attr.GetOverflow()) + if ( attr.CanOverflow() ) { int hAlign, vAlign; attr.GetAlignment(&hAlign, &vAlign); From 5f34b1749e6413f4a18ae91e8d3b64af6de2aaa1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 8 Feb 2020 14:42:50 +0100 Subject: [PATCH 064/329] Use wxGridCellAttrPtr instead of manual DecRef() calls Provide GetAttrPtr() and GetCellAttrPtr() convenience functions that can be used instead of the original Ptr-less versions to avoid the need to manually call DecRef() on the returned wxGridCellAttr pointers. No real changes, just simplify the code and make it safer. --- include/wx/generic/grid.h | 30 ++++++++ interface/wx/grid.h | 59 +++++++++++++- src/generic/grid.cpp | 156 ++++++++++---------------------------- 3 files changed, 128 insertions(+), 117 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 21184f9c17..ff744330d7 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -628,6 +628,9 @@ private: friend class wxGridCellAttrDummyFriend; }; +// Smart pointer to wxGridCellAttr, calling DecRef() on it automatically. +typedef wxObjectDataPtr wxGridCellAttrPtr; + // ---------------------------------------------------------------------------- // wxGridCellAttrProvider: class used by wxGridTableBase to retrieve/store the // cell attributes. @@ -650,6 +653,13 @@ public: virtual wxGridCellAttr *GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind ) const; + // Helper returning smart pointer calling DecRef() automatically. + wxGridCellAttrPtr GetAttrPtr(int row, int col, + wxGridCellAttr::wxAttrKind kind ) const + { + return wxGridCellAttrPtr(GetAttr(row, col, kind)); + } + // all these functions take ownership of the pointer, don't call DecRef() // on it virtual void SetAttr(wxGridCellAttr *attr, int row, int col); @@ -824,6 +834,11 @@ public: virtual wxGridCellAttr *GetAttr( int row, int col, wxGridCellAttr::wxAttrKind kind ); + wxGridCellAttrPtr GetAttrPtr(int row, int col, + wxGridCellAttr::wxAttrKind kind) + { + return wxGridCellAttrPtr(GetAttr(row, col, kind)); + } // these functions take ownership of the pointer virtual void SetAttr(wxGridCellAttr* attr, int row, int col); @@ -1478,6 +1493,11 @@ public: // DecRef() must be called on the returned pointer, as usual wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; + wxGridCellAttrPtr GetOrCreateCellAttrPtr(int row, int col) const + { + return wxGridCellAttrPtr(GetOrCreateCellAttr(row, col)); + } + // shortcuts for setting the column parameters @@ -2196,6 +2216,16 @@ protected: wxGridCellAttr *GetCellAttr(const wxGridCellCoords& coords ) const { return GetCellAttr( coords.GetRow(), coords.GetCol() ); } + wxGridCellAttrPtr GetCellAttrPtr(int row, int col) const + { + return wxGridCellAttrPtr(GetCellAttr(row, col)); + } + wxGridCellAttrPtr GetCellAttrPtr(const wxGridCellCoords& coords) const + { + return wxGridCellAttrPtr(GetCellAttr(coords)); + } + + // the default cell attr object for cells that don't have their own wxGridCellAttr* m_defaultCellAttr; diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 77319ed411..612d936ed9 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -976,6 +976,10 @@ public: changing their attributes from the defaults. An object of this class may be returned by wxGridTableBase::GetAttr(). + Note that objects of this class are reference-counted and it's recommended + to use wxGridCellAttrPtr smart pointer class when working with them to + avoid memory leaks. + @library{wxcore} @category{grid} */ @@ -1257,6 +1261,20 @@ protected: virtual ~wxGridCellAttr(); }; +/** + Smart pointer wrapping wxGridCellAttr. + + wxGridCellAttrPtr takes ownership of wxGridCellAttr passed to it on + construction and calls DecRef() on it automatically when it is destroyed. + It also provides transparent access to wxGridCellAttr methods by allowing + to use objects of this class as if they were wxGridCellAttr pointers. + + @since 3.1.4 + + @category{grid} +*/ +typedef wxObjectDataPtr wxGridCellAttrPtr; + /** Base class for header cells renderers. @@ -1459,7 +1477,7 @@ public: the cell attribute having the highest precedence. Notice that the caller must call DecRef() on the returned pointer if it - is non-@NULL. + is non-@NULL. GetAttrPtr() method can be used to do this automatically. @param row The row of the cell. @@ -1474,6 +1492,17 @@ public: virtual wxGridCellAttr *GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind) const; + /** + Get the attribute to use for the specified cell. + + This method is identical to GetAttr(), but returns a smart pointer, + which frees the caller from the need to call DecRef() manually. + + @since 3.1.4 + */ + wxGridCellAttrPtr GetAttrPtr(int row, int col, + wxGridCellAttr::wxAttrKind kind) const; + /*! @name Setting attributes. @@ -2121,10 +2150,24 @@ public: By default this function is simply forwarded to wxGridCellAttrProvider::GetAttr() but it may be overridden to handle attributes directly in the table. + + Prefer to use GetAttrPtr() to avoid the need to call DecRef() on the + returned pointer manually. */ virtual wxGridCellAttr *GetAttr(int row, int col, wxGridCellAttr::wxAttrKind kind); + /** + Return the attribute for the given cell. + + This method is identical to GetAttr(), but returns a smart pointer, + which frees the caller from the need to call DecRef() manually. + + @since 3.1.4 + */ + wxGridCellAttrPtr GetAttrPtr(int row, int col, + wxGridCellAttr::wxAttrKind kind); + /** Set attribute of the specified cell. @@ -4939,10 +4982,24 @@ public: attribute is created, associated with the cell and returned. In any case the caller must call DecRef() on the returned pointer. + Prefer to use GetOrCreateCellAttrPtr() to avoid the need to call + DecRef() on the returned pointer. + This function may only be called if CanHaveAttributes() returns @true. */ wxGridCellAttr *GetOrCreateCellAttr(int row, int col) const; + /** + Returns the attribute for the given cell creating one if necessary. + + This method is identical to GetOrCreateCellAttr(), but returns a smart + pointer, which frees the caller from the need to call DecRef() + manually. + + @since 3.1.4 + */ + wxGridCellAttrPtr GetOrCreateCellAttrPtr(int row, int col) const; + /** Returns a base pointer to the current table object. diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 09c4fde9d5..c0aff5fc4c 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2837,7 +2837,7 @@ void wxGrid::CalcDimensions() int y = GetRowTop(r); // how big is the editor - wxGridCellAttr* attr = GetCellAttr(r, c); + wxGridCellAttrPtr attr = GetCellAttrPtr(r, c); wxGridCellEditor* editor = attr->GetEditor(this, r, c); editor->GetWindow()->GetSize(&w2, &h2); w2 += x; @@ -2847,7 +2847,6 @@ void wxGrid::CalcDimensions() if ( h2 > h ) h = h2; editor->DecRef(); - attr->DecRef(); } wxPoint offset = GetGridWindowOffset(m_gridWin); @@ -4484,11 +4483,10 @@ wxGrid::DoGridCellLeftUp(wxMouseEvent& event, ClearSelection(); EnableCellEditControl(); - wxGridCellAttr *attr = GetCellAttr(coords); + wxGridCellAttrPtr attr = GetCellAttrPtr(coords); wxGridCellEditor *editor = attr->GetEditor(this, coords.GetRow(), coords.GetCol()); editor->StartingClick(); editor->DecRef(); - attr->DecRef(); m_waitForSlowClick = false; } @@ -5729,7 +5727,7 @@ void wxGrid::OnChar( wxKeyEvent& event ) // yes, now check whether the cells editor accepts the key int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - wxGridCellAttr *attr = GetCellAttr(row, col); + wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); wxGridCellEditor *editor = attr->GetEditor(this, row, col); // is special and will always start editing, for @@ -5754,7 +5752,6 @@ void wxGrid::OnChar( wxKeyEvent& event ) } editor->DecRef(); - attr->DecRef(); } else { @@ -5885,11 +5882,10 @@ bool wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) #if !defined(__WXMAC__) if ( !GetBatchCount() ) { - wxGridCellAttr *attr = GetCellAttr( coords ); + wxGridCellAttrPtr attr = GetCellAttrPtr( coords ); wxClientDC dc( currentGridWindow ); PrepareDCFor(dc, currentGridWindow); - DrawCellHighlight( dc, attr ); - attr->DecRef(); + DrawCellHighlight( dc, attr.get() ); } #endif @@ -6086,11 +6082,7 @@ void wxGrid::DrawGridCellArea( wxDC& dc, const wxGridCellCoordsArray& cells ) { if (!m_table->IsEmptyCell(row + l, j)) { - wxGridCellAttr *attr = GetCellAttr(row + l, j); - const bool canOverflow = attr->CanOverflow(); - attr->DecRef(); - - if ( canOverflow ) + if ( GetCellAttrPtr(row + l, j)->CanOverflow() ) { wxGridCellCoords cell(row + l, j); bool marked = false; @@ -6177,7 +6169,7 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) return; // we draw the cell border ourselves - wxGridCellAttr* attr = GetCellAttr(row, col); + wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); bool isCurrent = coords == m_currentCellCoords; @@ -6198,8 +6190,6 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) renderer->Draw(*this, *attr, dc, rect, row, col, IsInSelection(coords)); renderer->DecRef(); } - - attr->DecRef(); } void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr ) @@ -6326,9 +6316,8 @@ void wxGrid::DrawHighlight(wxDC& dc, const wxGridCellCoordsArray& cells) if ( cell == m_currentCellCoords ) { - wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords); - DrawCellHighlight(dc, attr); - attr->DecRef(); + wxGridCellAttrPtr attr = GetCellAttrPtr(m_currentCellCoords); + DrawCellHighlight(dc, attr.get()); break; } @@ -7070,12 +7059,8 @@ void wxGrid::EnableCellEditControl( bool enable ) bool wxGrid::IsCurrentCellReadOnly() const { - wxGridCellAttr* - attr = const_cast(this)->GetCellAttr(m_currentCellCoords); - bool readonly = attr->IsReadOnly(); - attr->DecRef(); - - return readonly; + return const_cast(this)-> + GetCellAttrPtr(m_currentCellCoords)->IsReadOnly(); } bool wxGrid::CanEnableCellControl() const @@ -7099,9 +7084,7 @@ bool wxGrid::IsCellEditControlShown() const { int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - wxGridCellAttr* attr = GetCellAttr(row, col); - wxGridCellEditor* editor = attr->GetEditor(this, row, col); - attr->DecRef(); + wxGridCellEditor* editor = GetCellAttrPtr(row, col)->GetEditor(this, row, col); if ( editor ) { @@ -7149,7 +7132,7 @@ void wxGrid::ShowCellEditControl() // might not cover the entire cell wxClientDC dc( gridWindow ); PrepareDCFor(dc, gridWindow); - wxGridCellAttr* attr = GetCellAttr(row, col); + wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); dc.SetBrush(wxBrush(attr->GetBackgroundColour())); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rect); @@ -7238,13 +7221,13 @@ void wxGrid::ShowCellEditControl() rect.SetRight( client_right - 1 ); } - editor->SetCellAttr( attr ); + editor->SetCellAttr( attr.get() ); editor->SetSize( rect ); if (nXMove != 0) editor->GetWindow()->Move( editor->GetWindow()->GetPosition().x + nXMove, editor->GetWindow()->GetPosition().y ); - editor->Show( true, attr ); + editor->Show( true, attr.get() ); // recalc dimensions in case we need to // expand the scrolled window to account for editor @@ -7254,7 +7237,6 @@ void wxGrid::ShowCellEditControl() editor->SetCellAttr(NULL); editor->DecRef(); - attr->DecRef(); } } } @@ -7266,7 +7248,7 @@ void wxGrid::HideCellEditControl() int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - wxGridCellAttr *attr = GetCellAttr(row, col); + wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); wxGridCellEditor *editor = attr->GetEditor(this, row, col); const bool editorHadFocus = editor->GetWindow()->IsDescendant(FindFocus()); @@ -7275,7 +7257,6 @@ void wxGrid::HideCellEditControl() editor->Show( false ); editor->DecRef(); - attr->DecRef(); wxGridWindow *gridWindow = CellToGridWindow(row, col); // return the focus to the grid itself if the editor had it @@ -7330,7 +7311,7 @@ void wxGrid::DoSaveEditControlValue() wxString oldval = GetCellValue(row, col); - wxGridCellAttr* attr = GetCellAttr(row, col); + wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); wxGridCellEditor* editor = attr->GetEditor(this, row, col); wxString newval; @@ -7351,7 +7332,6 @@ void wxGrid::DoSaveEditControlValue() } editor->DecRef(); - attr->DecRef(); } void wxGrid::OnHideEditor(wxCommandEvent& WXUNUSED(event)) @@ -8383,9 +8363,8 @@ void wxGrid::SetCellHighlightColour( const wxColour& colour ) wxClientDC dc( gridWindow ); PrepareDCFor( dc, gridWindow ); - wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords); - DrawCellHighlight(dc, attr); - attr->DecRef(); + wxGridCellAttrPtr attr = GetCellAttrPtr(m_currentCellCoords); + DrawCellHighlight(dc, attr.get()); } } @@ -8629,53 +8608,33 @@ wxGridCellEditor *wxGrid::GetDefaultEditor() const wxColour wxGrid::GetCellBackgroundColour(int row, int col) const { - wxGridCellAttr *attr = GetCellAttr(row, col); - wxColour colour = attr->GetBackgroundColour(); - attr->DecRef(); - - return colour; + return GetCellAttrPtr(row, col)->GetBackgroundColour(); } wxColour wxGrid::GetCellTextColour( int row, int col ) const { - wxGridCellAttr *attr = GetCellAttr(row, col); - wxColour colour = attr->GetTextColour(); - attr->DecRef(); - - return colour; + return GetCellAttrPtr(row, col)->GetTextColour(); } wxFont wxGrid::GetCellFont( int row, int col ) const { - wxGridCellAttr *attr = GetCellAttr(row, col); - wxFont font = attr->GetFont(); - attr->DecRef(); - - return font; + return GetCellAttrPtr(row, col)->GetFont(); } void wxGrid::GetCellAlignment( int row, int col, int *horiz, int *vert ) const { - wxGridCellAttr *attr = GetCellAttr(row, col); - attr->GetAlignment(horiz, vert); - attr->DecRef(); + return GetCellAttrPtr(row, col)->GetAlignment(horiz, vert); } wxGridFitMode wxGrid::GetCellFitMode( int row, int col ) const { - wxGridCellAttr *attr = GetCellAttr(row, col); - wxGridFitMode fitMode = attr->GetFitMode(); - attr->DecRef(); - - return fitMode; + return GetCellAttrPtr(row, col)->GetFitMode(); } wxGrid::CellSpan wxGrid::GetCellSize( int row, int col, int *num_rows, int *num_cols ) const { - wxGridCellAttr *attr = GetCellAttr(row, col); - attr->GetSize( num_rows, num_cols ); - attr->DecRef(); + GetCellAttrPtr(row, col)->GetSize( num_rows, num_cols ); if ( *num_rows == 1 && *num_cols == 1 ) return CellSpan_None; // just a normal cell @@ -8689,29 +8648,17 @@ wxGrid::GetCellSize( int row, int col, int *num_rows, int *num_cols ) const wxGridCellRenderer* wxGrid::GetCellRenderer(int row, int col) const { - wxGridCellAttr* attr = GetCellAttr(row, col); - wxGridCellRenderer* renderer = attr->GetRenderer(this, row, col); - attr->DecRef(); - - return renderer; + return GetCellAttrPtr(row, col)->GetRenderer(this, row, col); } wxGridCellEditor* wxGrid::GetCellEditor(int row, int col) const { - wxGridCellAttr* attr = GetCellAttr(row, col); - wxGridCellEditor* editor = attr->GetEditor(this, row, col); - attr->DecRef(); - - return editor; + return GetCellAttrPtr(row, col)->GetEditor(this, row, col); } bool wxGrid::IsReadOnly(int row, int col) const { - wxGridCellAttr* attr = GetCellAttr(row, col); - bool isReadOnly = attr->IsReadOnly(); - attr->DecRef(); - - return isReadOnly; + return GetCellAttrPtr(row, col)->IsReadOnly(); } // ---------------------------------------------------------------------------- @@ -8932,9 +8879,7 @@ void wxGrid::SetCellBackgroundColour( int row, int col, const wxColour& colour ) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetBackgroundColour(colour); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetBackgroundColour(colour); } } @@ -8942,9 +8887,7 @@ void wxGrid::SetCellTextColour( int row, int col, const wxColour& colour ) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetTextColour(colour); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetTextColour(colour); } } @@ -8952,9 +8895,7 @@ void wxGrid::SetCellFont( int row, int col, const wxFont& font ) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetFont(font); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetFont(font); } } @@ -8962,9 +8903,7 @@ void wxGrid::SetCellAlignment( int row, int col, int horiz, int vert ) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetAlignment(horiz, vert); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetAlignment(horiz, vert); } } @@ -8972,9 +8911,7 @@ void wxGrid::SetCellFitMode( int row, int col, wxGridFitMode fitMode ) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetFitMode(fitMode); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetFitMode(fitMode); } } @@ -8984,10 +8921,9 @@ void wxGrid::SetCellSize( int row, int col, int num_rows, int num_cols ) { int cell_rows, cell_cols; - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); + wxGridCellAttrPtr attr = GetOrCreateCellAttrPtr(row, col); attr->GetSize(&cell_rows, &cell_cols); attr->SetSize(num_rows, num_cols); - attr->DecRef(); // Cannot set the size of a cell to 0 or negative values // While it is perfectly legal to do that, this function cannot @@ -9008,9 +8944,7 @@ void wxGrid::SetCellSize( int row, int col, int num_rows, int num_cols ) { if ((i != col) || (j != row)) { - wxGridCellAttr *attr_stub = GetOrCreateCellAttr(j, i); - attr_stub->SetSize( 1, 1 ); - attr_stub->DecRef(); + GetOrCreateCellAttrPtr(j, i)->SetSize( 1, 1 ); } } } @@ -9027,9 +8961,7 @@ void wxGrid::SetCellSize( int row, int col, int num_rows, int num_cols ) { if ((i != col) || (j != row)) { - wxGridCellAttr *attr_stub = GetOrCreateCellAttr(j, i); - attr_stub->SetSize( row - j, col - i ); - attr_stub->DecRef(); + GetOrCreateCellAttrPtr(j, i)->SetSize( row - j, col - i ); } } } @@ -9041,9 +8973,7 @@ void wxGrid::SetCellRenderer(int row, int col, wxGridCellRenderer *renderer) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetRenderer(renderer); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetRenderer(renderer); } } @@ -9051,9 +8981,7 @@ void wxGrid::SetCellEditor(int row, int col, wxGridCellEditor* editor) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetEditor(editor); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetEditor(editor); } } @@ -9061,9 +8989,7 @@ void wxGrid::SetReadOnly(int row, int col, bool isReadOnly) { if ( CanHaveAttributes() ) { - wxGridCellAttr *attr = GetOrCreateCellAttr(row, col); - attr->SetReadOnly(isReadOnly); - attr->DecRef(); + GetOrCreateCellAttrPtr(row, col)->SetReadOnly(isReadOnly); } } @@ -9548,7 +9474,7 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) } // get cell ( main cell if CellSpan_Inside ) renderer best size - wxGridCellAttr *attr = GetCellAttr(row, col); + wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); wxGridCellRenderer *renderer = attr->GetRenderer(this, row, col); if ( renderer ) { @@ -9575,8 +9501,6 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) renderer->DecRef(); } - - attr->DecRef(); } // now also compare with the column label extent From 2e64ba6d6e61b58a9a7d33e632a6126cc76691ef Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 8 Feb 2020 15:14:24 +0100 Subject: [PATCH 065/329] Also add wxGridCellEditorPtr and wxGridCellRendererPtr This is similar to the previous commit and replaces manual calls to DecRef() on the renderers/editors with the use of smart pointers for them too. --- include/wx/generic/grid.h | 16 ++++++++++++ interface/wx/grid.h | 54 +++++++++++++++++++++++++++++++++++++++ src/generic/grid.cpp | 53 ++++++++++++-------------------------- 3 files changed, 86 insertions(+), 37 deletions(-) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index ff744330d7..345bf6adcb 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -206,6 +206,9 @@ public: virtual wxGridCellRenderer *Clone() const = 0; }; +// Smart pointer to wxGridCellRenderer, calling DecRef() on it automatically. +typedef wxObjectDataPtr wxGridCellRendererPtr; + // ---------------------------------------------------------------------------- // wxGridCellEditor: This class is responsible for providing and manipulating // the in-place edit controls for the grid. Instances of wxGridCellEditor @@ -333,6 +336,9 @@ protected: wxDECLARE_NO_COPY_CLASS(wxGridCellEditor); }; +// Smart pointer to wxGridCellEditor, calling DecRef() on it automatically. +typedef wxObjectDataPtr wxGridCellEditorPtr; + // ---------------------------------------------------------------------------- // wxGridHeaderRenderer and company: like wxGridCellRenderer but for headers // ---------------------------------------------------------------------------- @@ -573,8 +579,18 @@ public: // whether the cell will draw the overflowed text to neighbour cells // currently only left aligned cells can overflow bool CanOverflow() const; + wxGridCellRenderer *GetRenderer(const wxGrid* grid, int row, int col) const; + wxGridCellRendererPtr GetRendererPtr(const wxGrid* grid, int row, int col) const + { + return wxGridCellRendererPtr(GetRenderer(grid, row, col)); + } + wxGridCellEditor *GetEditor(const wxGrid* grid, int row, int col) const; + wxGridCellEditorPtr GetEditorPtr(const wxGrid* grid, int row, int col) const + { + return wxGridCellEditorPtr(GetEditor(grid, row, col)); + } bool IsReadOnly() const { return m_isReadOnly == wxGridCellAttr::ReadOnly; } diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 612d936ed9..3030c3da86 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -95,6 +95,20 @@ protected: virtual ~wxGridCellRenderer(); }; +/** + Smart pointer wrapping wxGridCellRenderer. + + wxGridCellRendererPtr takes ownership of wxGridCellRenderer passed to it on + construction and calls DecRef() on it automatically when it is destroyed. + It also provides transparent access to wxGridCellRenderer methods by allowing + to use objects of this class as if they were wxGridCellRenderer pointers. + + @since 3.1.4 + + @category{grid} +*/ +typedef wxObjectDataPtr wxGridCellRendererPtr; + /** @class wxGridCellAutoWrapStringRenderer @@ -591,6 +605,20 @@ protected: virtual ~wxGridCellEditor(); }; +/** + Smart pointer wrapping wxGridCellEditor. + + wxGridCellEditorPtr takes ownership of wxGridCellEditor passed to it on + construction and calls DecRef() on it automatically when it is destroyed. + It also provides transparent access to wxGridCellEditor methods by allowing + to use objects of this class as if they were wxGridCellEditor pointers. + + @since 3.1.4 + + @category{grid} +*/ +typedef wxObjectDataPtr wxGridCellEditorPtr; + /** @class wxGridCellAutoWrapStringEditor @@ -1058,9 +1086,22 @@ public: /** Returns the cell editor. + + The caller is responsible for calling DecRef() on the returned pointer, + use GetEditorPtr() to do it automatically. */ wxGridCellEditor* GetEditor(const wxGrid* grid, int row, int col) const; + /** + Returns the cell editor. + + This method is identical to GetEditor(), but returns a smart pointer, + which frees the caller from the need to call DecRef() manually. + + @since 3.1.4 + */ + wxGridCellEditorPtr GetEditorPtr(const wxGrid* grid, int row, int col) const; + /** Returns the font. */ @@ -1091,9 +1132,22 @@ public: /** Returns the cell renderer. + + The caller is responsible for calling DecRef() on the returned pointer, + use GetRendererPtr() to do it automatically. */ wxGridCellRenderer* GetRenderer(const wxGrid* grid, int row, int col) const; + /** + Returns the cell editor. + + This method is identical to GetRenderer(), but returns a smart pointer, + which frees the caller from the need to call DecRef() manually. + + @since 3.1.4 + */ + wxGridCellRendererPtr GetRendererPtr(const wxGrid* grid, int row, int col) const; + /** Returns the text colour. */ diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index c0aff5fc4c..54259e898b 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -2838,7 +2838,7 @@ void wxGrid::CalcDimensions() // how big is the editor wxGridCellAttrPtr attr = GetCellAttrPtr(r, c); - wxGridCellEditor* editor = attr->GetEditor(this, r, c); + wxGridCellEditorPtr editor = attr->GetEditorPtr(this, r, c); editor->GetWindow()->GetSize(&w2, &h2); w2 += x; h2 += y; @@ -2846,7 +2846,6 @@ void wxGrid::CalcDimensions() w = w2; if ( h2 > h ) h = h2; - editor->DecRef(); } wxPoint offset = GetGridWindowOffset(m_gridWin); @@ -4484,9 +4483,8 @@ wxGrid::DoGridCellLeftUp(wxMouseEvent& event, EnableCellEditControl(); wxGridCellAttrPtr attr = GetCellAttrPtr(coords); - wxGridCellEditor *editor = attr->GetEditor(this, coords.GetRow(), coords.GetCol()); + wxGridCellEditorPtr editor = attr->GetEditorPtr(this, coords.GetRow(), coords.GetCol()); editor->StartingClick(); - editor->DecRef(); m_waitForSlowClick = false; } @@ -5728,7 +5726,7 @@ void wxGrid::OnChar( wxKeyEvent& event ) int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); - wxGridCellEditor *editor = attr->GetEditor(this, row, col); + wxGridCellEditorPtr editor = attr->GetEditorPtr(this, row, col); // is special and will always start editing, for // other keys - ask the editor itself @@ -5750,8 +5748,6 @@ void wxGrid::OnChar( wxKeyEvent& event ) { event.Skip(); } - - editor->DecRef(); } else { @@ -6179,16 +6175,13 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& coords ) // Note: However, only if it is really _shown_, i.e. not hidden! if ( isCurrent && IsCellEditControlShown() ) { - wxGridCellEditor *editor = attr->GetEditor(this, row, col); - editor->PaintBackground(dc, rect, *attr); - editor->DecRef(); + attr->GetEditorPtr(this, row, col)->PaintBackground(dc, rect, *attr); } else { // but all the rest is drawn by the cell renderer and hence may be customized - wxGridCellRenderer *renderer = attr->GetRenderer(this, row, col); - renderer->Draw(*this, *attr, dc, rect, row, col, IsInSelection(coords)); - renderer->DecRef(); + attr->GetRendererPtr(this, row, col) + ->Draw(*this, *attr, dc, rect, row, col, IsInSelection(coords)); } } @@ -7084,16 +7077,13 @@ bool wxGrid::IsCellEditControlShown() const { int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - wxGridCellEditor* editor = GetCellAttrPtr(row, col)->GetEditor(this, row, col); - + wxGridCellEditorPtr editor = GetCellAttrPtr(row, col)->GetEditorPtr(this, row, col); if ( editor ) { if ( editor->IsCreated() ) { isShown = editor->GetWindow()->IsShown(); } - - editor->DecRef(); } } @@ -7153,11 +7143,11 @@ void wxGrid::ShowCellEditControl() rect.Deflate(1, 1); #endif - wxGridCellEditor* editor = attr->GetEditor(this, row, col); + wxGridCellEditorPtr editor = attr->GetEditorPtr(this, row, col); if ( !editor->IsCreated() ) { editor->Create(gridWindow, wxID_ANY, - new wxGridCellEditorEvtHandler(this, editor)); + new wxGridCellEditorEvtHandler(this, editor.get())); // Ensure the editor window has wxWANTS_CHARS flag, so that it // gets Tab, Enter and Esc keys, which need to be processed @@ -7235,8 +7225,6 @@ void wxGrid::ShowCellEditControl() editor->BeginEdit(row, col, this); editor->SetCellAttr(NULL); - - editor->DecRef(); } } } @@ -7249,14 +7237,13 @@ void wxGrid::HideCellEditControl() int col = m_currentCellCoords.GetCol(); wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); - wxGridCellEditor *editor = attr->GetEditor(this, row, col); + wxGridCellEditorPtr editor = attr->GetEditorPtr(this, row, col); const bool editorHadFocus = editor->GetWindow()->IsDescendant(FindFocus()); if ( editor->GetWindow()->GetParent() != m_gridWin ) editor->GetWindow()->Reparent(m_gridWin); editor->Show( false ); - editor->DecRef(); wxGridWindow *gridWindow = CellToGridWindow(row, col); // return the focus to the grid itself if the editor had it @@ -7312,7 +7299,7 @@ void wxGrid::DoSaveEditControlValue() wxString oldval = GetCellValue(row, col); wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); - wxGridCellEditor* editor = attr->GetEditor(this, row, col); + wxGridCellEditorPtr editor = attr->GetEditorPtr(this, row, col); wxString newval; bool changed = editor->EndEdit(row, col, this, oldval, &newval); @@ -7330,8 +7317,6 @@ void wxGrid::DoSaveEditControlValue() SetCellValue(row, col, oldval); } } - - editor->DecRef(); } void wxGrid::OnHideEditor(wxCommandEvent& WXUNUSED(event)) @@ -9475,7 +9460,7 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) // get cell ( main cell if CellSpan_Inside ) renderer best size wxGridCellAttrPtr attr = GetCellAttrPtr(row, col); - wxGridCellRenderer *renderer = attr->GetRenderer(this, row, col); + wxGridCellRendererPtr renderer = attr->GetRendererPtr(this, row, col); if ( renderer ) { extent = column @@ -9498,8 +9483,6 @@ wxGrid::AutoSizeColOrRow(int colOrRow, bool setAsMin, wxGridDirection direction) if ( extent > extentMax ) extentMax = extent; - - renderer->DecRef(); } } @@ -10396,15 +10379,11 @@ int wxGridTypeRegistry::FindOrCloneDataType(const wxString& typeName) return wxNOT_FOUND; } - wxGridCellRenderer *renderer = GetRenderer(index); - wxGridCellRenderer *rendererOld = renderer; - renderer = renderer->Clone(); - rendererOld->DecRef(); + wxGridCellRenderer* const + renderer = wxGridCellRendererPtr(GetRenderer(index))->Clone(); - wxGridCellEditor *editor = GetEditor(index); - wxGridCellEditor *editorOld = editor; - editor = editor->Clone(); - editorOld->DecRef(); + wxGridCellEditor* const + editor = wxGridCellEditorPtr(GetEditor(index))->Clone(); // do it even if there are no parameters to reset them to defaults wxString params = typeName.AfterFirst(wxT(':')); From edc47d8fed9994c5766038e7ae4481a14aeb0b82 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 9 Feb 2020 08:13:01 -0800 Subject: [PATCH 066/329] Fix appearance of GTK3 single-line wxTextCtrl with non-default background ...and more text than will fit. See #18663 --- src/gtk/window.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 6cde78417e..c85fe9fbb1 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -5535,6 +5535,13 @@ void wxWindowGTK::GTKApplyWidgetStyle(bool forceStyle) g_string_append_printf(css, "%s{color:%s;background:%s}", s, wxGtkString(gdk_rgba_to_string(fg_sel)).c_str(), wxGtkString(gdk_rgba_to_string(bg_sel)).c_str()); + + if (isBg) + { + // make "undershoot" node background transparent, + // keeps expected look of GtkEntry with default theme + g_string_append(css, "* undershoot{background:transparent}"); + } } if (m_styleProvider == NULL && (isFg || isBg || isFont)) From f2f9cbe619601fd71f2c5c0dc29796267144322d Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 20:18:56 +0100 Subject: [PATCH 067/329] Get rid of unused wxPGWindowList ctor There is no use case for wxPGWindowList initialiazed with NULL data. --- include/wx/propgrid/editors.h | 5 ----- interface/wx/propgrid/editors.h | 1 - 2 files changed, 6 deletions(-) diff --git a/include/wx/propgrid/editors.h b/include/wx/propgrid/editors.h index 01f0a0a5e9..9746bbc01a 100644 --- a/include/wx/propgrid/editors.h +++ b/include/wx/propgrid/editors.h @@ -27,11 +27,6 @@ class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid; class wxPGWindowList { public: - wxPGWindowList() - { - m_primary = m_secondary = NULL; - } - void SetSecondary( wxWindow* secondary ) { m_secondary = secondary; } wxWindow* m_primary; diff --git a/interface/wx/propgrid/editors.h b/interface/wx/propgrid/editors.h index d31e794116..25629fd2b4 100644 --- a/interface/wx/propgrid/editors.h +++ b/interface/wx/propgrid/editors.h @@ -14,7 +14,6 @@ class wxPGWindowList { public: - wxPGWindowList(); void SetSecondary( wxWindow* secondary ); wxWindow* m_primary; From 9dbd3b4946990c8b7d4c13e78d34f14ff42c2793 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 20:31:58 +0100 Subject: [PATCH 068/329] Use ctor with default argument instead of providing specialized ctor We can use 2-parameter ctor with default NULL value for second parameter instead of providing a special 1-paramater ctor. --- include/wx/propgrid/editors.h | 19 +++++++------------ interface/wx/propgrid/editors.h | 8 ++------ 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/include/wx/propgrid/editors.h b/include/wx/propgrid/editors.h index 9746bbc01a..83e21b8da1 100644 --- a/include/wx/propgrid/editors.h +++ b/include/wx/propgrid/editors.h @@ -27,21 +27,16 @@ class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid; class wxPGWindowList { public: - void SetSecondary( wxWindow* secondary ) { m_secondary = secondary; } + wxPGWindowList(wxWindow* primary, wxWindow* secondary = NULL) + : m_primary(primary) + , m_secondary(secondary) + { + } + + void SetSecondary(wxWindow* secondary) { m_secondary = secondary; } wxWindow* m_primary; wxWindow* m_secondary; - - wxPGWindowList( wxWindow* a ) - { - m_primary = a; - m_secondary = NULL; - } - wxPGWindowList( wxWindow* a, wxWindow* b ) - { - m_primary = a; - m_secondary = b; - } }; // ----------------------------------------------------------------------- diff --git a/interface/wx/propgrid/editors.h b/interface/wx/propgrid/editors.h index 25629fd2b4..269a8961bf 100644 --- a/interface/wx/propgrid/editors.h +++ b/interface/wx/propgrid/editors.h @@ -14,13 +14,9 @@ class wxPGWindowList { public: - void SetSecondary( wxWindow* secondary ); + wxPGWindowList(wxWindow* primary, wxWindow* secondary = NULL); - wxWindow* m_primary; - wxWindow* m_secondary; - - wxPGWindowList( wxWindow* a ); - wxPGWindowList( wxWindow* a, wxWindow* b ); + void SetSecondary(wxWindow* secondary); }; From 687f679705053eff973082751032b95b3a89515e Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 20:34:09 +0100 Subject: [PATCH 069/329] Fix creating wxPGChoiceAndButtonEditor controls Since wxPGChoiceAndButtonEditor derives from wxPGChoiceEditor so making a call to the base class virtual function CreateControls() from the child CreateControls() is legitimate and more clean than calling to this function in the another instance of the base class wxPGChoiceEditor (which may not exists). --- src/propgrid/editors.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 4bf316f028..b2fec5f475 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -1318,7 +1318,7 @@ wxPGWindowList wxPGChoiceAndButtonEditor::CreateControls( wxPropertyGrid* propGr ch_sz.x -= wxPG_TEXTCTRL_AND_BUTTON_SPACING; #endif - wxWindow* ch = wxPGEditor_Choice->CreateControls(propGrid,property, + wxWindow* ch = wxPGChoiceEditor::CreateControls(propGrid,property, pos,ch_sz).m_primary; #ifdef __WXMSW__ From 0b7f1e7e91bd30b44a8b508d1f00fdd3fd849864 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 20:38:07 +0100 Subject: [PATCH 070/329] Always show label of unspecified value item while drawing popup menu The label of "unspecified value" shouldn't be displayed in the edit field but it should always be shown on the popup menu list. --- src/propgrid/editors.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index b2fec5f475..08649e66fd 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -719,11 +719,10 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, int comValIndex = -1; const int choiceCount = choices.IsOk()? choices.GetCount(): 0; - if ( item >= choiceCount && p->GetDisplayedCommonValueCount() > 0 ) { comValIndex = item - choiceCount; - if ( !p->IsValueUnspecified() ) + if ( !p->IsValueUnspecified() || !(flags & wxODCB_PAINTING_CONTROL) ) { const wxPGCommonValue* cv = GetCommonValue(comValIndex); text = cv->GetLabel(); @@ -747,7 +746,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, const wxBitmap* itemBitmap = NULL; - if ( choices.IsOk() && choices.Item(item).GetBitmap().IsOk() && comValIndex == -1 ) + if ( comValIndex == -1 && choices.IsOk() && choices.Item(item).GetBitmap().IsOk() ) itemBitmap = &choices.Item(item).GetBitmap(); // From c7c3f337c2991ac754e806b50e2133e7ff18c458 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 20:39:06 +0100 Subject: [PATCH 071/329] Check index value with CHECK_MSG to avoid crashes --- include/wx/propgrid/propgrid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 0e9daa0ad7..b7768fd2df 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1155,6 +1155,7 @@ public: const wxPGCommonValue* GetCommonValue( unsigned int i ) const { + wxCHECK_MSG( i < m_commonValues.size(), NULL, "Invalid item index" ); return m_commonValues[i]; } @@ -1167,7 +1168,7 @@ public: // Returns label of given common value. wxString GetCommonValueLabel( unsigned int i ) const { - wxASSERT( GetCommonValue(i) ); + wxCHECK_MSG( i < m_commonValues.size(), wxString(), "Invalid item index" ); return GetCommonValue(i)->GetLabel(); } From 55daa7103e928a4aa03305598c8eca762625e9d0 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 20:46:40 +0100 Subject: [PATCH 072/329] Implement wxD2DGradientStopsHelper as a wxD2DResourceHolder There is a dedicated template class wxD2DResourceHolder to support managing backend D2D resources and wxD2DGradientStopsHelper should be derived from wxD2DResourceHolder for the sake of consistency with other D2D resource holders. --- src/msw/graphicsd2d.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 11df206206..9f4cd3ecf9 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -2314,33 +2314,32 @@ wxD2DBitmapData* wxGetD2DBitmapData(const wxGraphicsBitmap& bitmap) } // Helper class used to create and safely release a ID2D1GradientStopCollection from wxGraphicsGradientStops -class wxD2DGradientStopsHelper +class wxD2DGradientStopsHelper : public wxD2DResourceHolder { public: - wxD2DGradientStopsHelper(const wxGraphicsGradientStops& gradientStops, ID2D1RenderTarget* renderTarget) + wxD2DGradientStopsHelper(const wxGraphicsGradientStops& gradientStops) { - int stopCount = gradientStops.GetCount(); - - D2D1_GRADIENT_STOP* gradientStopArray = new D2D1_GRADIENT_STOP[stopCount]; - - for (int i = 0; i < stopCount; ++i) + const int stopCount = gradientStops.GetCount(); + m_gradientStops.reserve(stopCount); + for ( int i = 0; i < stopCount; ++i ) { - gradientStopArray[i].color = wxD2DConvertColour(gradientStops.Item(i).GetColour()); - gradientStopArray[i].position = gradientStops.Item(i).GetPosition(); + D2D1_GRADIENT_STOP stop; + stop.position = gradientStops.Item(i).GetPosition(); + stop.color = wxD2DConvertColour(gradientStops.Item(i).GetColour()); + m_gradientStops.push_back(stop); } - - renderTarget->CreateGradientStopCollection(gradientStopArray, stopCount, D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, &m_gradientStopCollection); - - delete[] gradientStopArray; } - ID2D1GradientStopCollection* GetGradientStopCollection() +protected: + void DoAcquireResource() wxOVERRIDE { - return m_gradientStopCollection; + HRESULT hr = GetContext()->CreateGradientStopCollection(m_gradientStops.data(), + m_gradientStops.size(), D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, &m_nativeResource); + wxCHECK_HRESULT_RET(hr); } private: - wxCOMPtr m_gradientStopCollection; + wxVector m_gradientStops; }; template @@ -2443,13 +2442,14 @@ public: protected: void DoAcquireResource() wxOVERRIDE { - wxD2DGradientStopsHelper helper(m_linearGradientInfo.stops, GetContext()); + wxD2DGradientStopsHelper helper(m_linearGradientInfo.stops); + helper.Bind(GetManager()); HRESULT hr = GetContext()->CreateLinearGradientBrush( D2D1::LinearGradientBrushProperties( D2D1::Point2F(m_linearGradientInfo.x1, m_linearGradientInfo.y1), D2D1::Point2F(m_linearGradientInfo.x2, m_linearGradientInfo.y2)), - helper.GetGradientStopCollection(), + helper.GetD2DResource(), &m_nativeResource); wxCHECK_HRESULT_RET(hr); @@ -2494,7 +2494,8 @@ public: protected: void DoAcquireResource() wxOVERRIDE { - wxD2DGradientStopsHelper helper(m_radialGradientInfo.stops, GetContext()); + wxD2DGradientStopsHelper helper(m_radialGradientInfo.stops); + helper.Bind(GetManager()); wxDouble xo = m_radialGradientInfo.x1 - m_radialGradientInfo.x2; wxDouble yo = m_radialGradientInfo.y1 - m_radialGradientInfo.y2; @@ -2504,7 +2505,7 @@ protected: D2D1::Point2F(m_radialGradientInfo.x1, m_radialGradientInfo.y1), D2D1::Point2F(xo, yo), m_radialGradientInfo.radius, m_radialGradientInfo.radius), - helper.GetGradientStopCollection(), + helper.GetD2DResource(), &m_nativeResource); wxCHECK_HRESULT_RET(hr); From 5fb7f89b146810ba698899fc9ec1753a26385c94 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 9 Feb 2020 23:11:27 +0100 Subject: [PATCH 073/329] Don't use vestor::data() to get access to the raw vector data This method is available since C++ 11 so it can't be used currently. --- src/msw/graphicsd2d.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 9f4cd3ecf9..37c4e8db8a 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -2333,7 +2333,9 @@ public: protected: void DoAcquireResource() wxOVERRIDE { - HRESULT hr = GetContext()->CreateGradientStopCollection(m_gradientStops.data(), + wxCHECK_RET(!m_gradientStops.empty(), "No gradient stops provided"); + + HRESULT hr = GetContext()->CreateGradientStopCollection(&m_gradientStops[0], m_gradientStops.size(), D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, &m_nativeResource); wxCHECK_HRESULT_RET(hr); } From f6158bc3431ea9b431ca7b1367eb5ae4f5195308 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 13:14:08 +0100 Subject: [PATCH 074/329] Remove wxHAS_PAINT_DEBUG and code guarded by it This doesn't seem to actually be doing anything useful, as it only checks that wxPaintDCImpl is not created without creating wxPaintDC which is impossible to do accidentally anyhow. This will be replaced by a more useful check in the next commit. --- include/wx/event.h | 26 +------------------------- src/msw/dcclient.cpp | 21 --------------------- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/include/wx/event.h b/include/wx/event.h index 482758b7a2..293211aae3 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -2335,39 +2335,15 @@ private: wxEVT_NC_PAINT */ -#if wxDEBUG_LEVEL && defined(__WXMSW__) - #define wxHAS_PAINT_DEBUG - - // see comments in src/msw/dcclient.cpp where g_isPainting is defined - extern WXDLLIMPEXP_CORE int g_isPainting; -#endif // debug - class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent { public: wxPaintEvent(int Id = 0) : wxEvent(Id, wxEVT_PAINT) { -#ifdef wxHAS_PAINT_DEBUG - // set the internal flag for the duration of redrawing - g_isPainting++; -#endif // debug } - // default copy ctor and dtor are normally fine, we only need them to keep - // g_isPainting updated in debug build -#ifdef wxHAS_PAINT_DEBUG - wxPaintEvent(const wxPaintEvent& event) - : wxEvent(event) - { - g_isPainting++; - } - - virtual ~wxPaintEvent() - { - g_isPainting--; - } -#endif // debug + // default copy ctor and dtor are fine virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); } diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index ed6fcf3e9e..2b628ef97d 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -138,18 +138,6 @@ PaintDCInfos gs_PaintDCInfos; } // anonymous namespace -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -#ifdef wxHAS_PAINT_DEBUG - // a global variable which we check to verify that wxPaintDC are only - // created in response to WM_PAINT message - doing this from elsewhere is a - // common programming error among wxWidgets programmers and might lead to - // very subtle and difficult to debug refresh/repaint bugs. - int g_isPainting = 0; -#endif // wxHAS_PAINT_DEBUG - // =========================================================================== // implementation // =========================================================================== @@ -269,15 +257,6 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : { wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") ); -#ifdef wxHAS_PAINT_DEBUG - if ( g_isPainting <= 0 ) - { - wxFAIL_MSG( wxT("wxPaintDCImpl may be created only in EVT_PAINT handler!") ); - - return; - } -#endif // wxHAS_PAINT_DEBUG - // see comments in src/msw/window.cpp where this is defined extern wxStack wxDidCreatePaintDC; From 452c8dcfa3c8864edaa594520c6f1a1780014072 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 13:39:08 +0100 Subject: [PATCH 075/329] Check that wxPaintDC is created correctly in code using wxMSW Creating wxPaintDC for a window outside of any wxEVT_PAINT handler already resulted in assert failures and crash due to using the empty wxDidCreatePaintDC stack, but the assert message was not really clear, so improve it by stating explicitly that wxPaintDC can only be created from wxEVT_PAINT handlers. Also check that wxPaintDC is being created for the correct window: this wasn't detected at all before, but could still result in a lot of grief, so check for this too. Finally, create a new private header with the paint data stack variable declaration instead of using "extern" to declare it manually in wxDC code. --- include/wx/msw/private/paint.h | 39 ++++++++++++++++++++++++++++++++++ src/msw/dcclient.cpp | 11 ++++++---- src/msw/window.cpp | 20 +++++++++-------- 3 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 include/wx/msw/private/paint.h diff --git a/include/wx/msw/private/paint.h b/include/wx/msw/private/paint.h new file mode 100644 index 0000000000..abd0c44cd1 --- /dev/null +++ b/include/wx/msw/private/paint.h @@ -0,0 +1,39 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/msw/private/paint.h +// Purpose: Helpers for handling repainting +// Author: Vadim Zeitlin +// Created: 2020-02-10 +// Copyright: (c) 2020 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_MSW_PRIVATE_PAINT_H_ +#define _WX_MSW_PRIVATE_PAINT_H_ + +#include "wx/stack.h" + +namespace wxMSWImpl +{ + +// Data used by WM_PAINT handler +struct PaintData +{ + explicit PaintData(wxWindowMSW* window_) + : window(window_), + createdPaintDC(false) + { + } + + // The window being repainted (never null). + wxWindowMSW* const window; + + // True if the user-defined paint handler created wxPaintDC. + bool createdPaintDC; +}; + +// Stack storing data for the possibly nested WM_PAINT handlers. +extern wxStack paintStack; + +} // namespace wxMSWImpl + +#endif // _WX_MSW_PRIVATE_PAINT_H_ diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 2b628ef97d..d178e0e7ed 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -36,6 +36,7 @@ #include "wx/stack.h" #include "wx/msw/private.h" +#include "wx/msw/private/paint.h" // ---------------------------------------------------------------------------- // local data structures @@ -257,11 +258,13 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : { wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") ); - // see comments in src/msw/window.cpp where this is defined - extern wxStack wxDidCreatePaintDC; - - wxDidCreatePaintDC.top() = true; + using namespace wxMSWImpl; + wxCHECK_RET( !paintStack.empty(), + "wxPaintDC can't be created outside wxEVT_PAINT handler" ); + wxCHECK_RET( paintStack.top().window == window, + "wxPaintDC must be associated with the window being repainted" ); + paintStack.top().createdPaintDC = true; m_window = window; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index f207a8afd7..0d06fcf9a5 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -63,7 +63,6 @@ #include "wx/popupwin.h" #include "wx/power.h" #include "wx/scopeguard.h" -#include "wx/stack.h" #include "wx/sysopt.h" #if wxUSE_DRAG_AND_DROP @@ -81,6 +80,7 @@ #include "wx/msw/private.h" #include "wx/msw/private/keyboard.h" +#include "wx/msw/private/paint.h" #include "wx/msw/private/winstyle.h" #include "wx/msw/dcclient.h" #include "wx/msw/seh.h" @@ -5240,8 +5240,7 @@ wxColour wxWindowMSW::MSWGetThemeColour(const wchar_t *themeName, // endless stream of WM_PAINT messages for this window resulting in a lot of // difficult to debug problems (e.g. impossibility to repaint other windows, // lack of timer and idle events and so on) -extern wxStack wxDidCreatePaintDC; -wxStack wxDidCreatePaintDC; +wxStack wxMSWImpl::paintStack; bool wxWindowMSW::HandlePaint() { @@ -5257,14 +5256,17 @@ bool wxWindowMSW::HandlePaint() m_updateRegion = wxRegion((WXHRGN) hRegion); - wxDidCreatePaintDC.push(false); + using namespace wxMSWImpl; + + paintStack.push(PaintData(this)); wxPaintEvent event(m_windowId); event.SetEventObject(this); bool processed = HandleWindowEvent(event); - if ( wxDidCreatePaintDC.top() && !processed ) + const bool createdPaintDC = paintStack.top().createdPaintDC; + if ( createdPaintDC && !processed ) { // Event handler did paint something as wxPaintDC object was created // but then it must have skipped the event to indicate that default @@ -5288,16 +5290,16 @@ bool wxWindowMSW::HandlePaint() wxPaintDCImpl::EndPaint((wxWindow *)this); + paintStack.pop(); + // It doesn't matter whether the event was actually processed or not here, // what matters is whether we already painted, and hence validated, the // window or not. If we did, either the event was processed or we called // OnPaint() above, so we should return true. If we did not, even the event // was processed, we must still call MSWDefWindowProc() to ensure that the // window is validated, i.e. to avoid the problem described in the comment - // before wxDidCreatePaintDC definition above. - const bool ret = wxDidCreatePaintDC.top(); - wxDidCreatePaintDC.pop(); - return ret; + // before paintStack definition above. + return createdPaintDC; } // Can be called from an application's OnPaint handler From b680ba9596ace0f8e7e486a276975d4e92edea5c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 13:42:03 +0100 Subject: [PATCH 076/329] Explicitly document that wxPaintEvent ctor must not be used Objects of this type are only supposed to be created by wxWidgets itself and not by user code. --- interface/wx/event.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/wx/event.h b/interface/wx/event.h index c02abdff1c..35b97325df 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -2215,7 +2215,12 @@ class wxPaintEvent : public wxEvent { public: /** - Constructor. + Constructor for exclusive use of wxWidgets itself. + + Note that the objects of this class can @em not be created from + application code, they're only created by the library itself. If you + need a window to be repainted, use wxWindow::Refresh() instead of + trying to manually create an event of this class. */ wxPaintEvent(int id = 0); }; From fd84892e621677f27ab7605e0e1f06ce7af08b28 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 18:01:09 +0100 Subject: [PATCH 077/329] Use secret_service_clear_sync() in wxSecretStore There doesn't seem to be any reason to use secret_service_xxx() functions for Save() and Load(), but use simple API function secret_password_clearv_sync() for Delete(). Use the equivalent function from the same API layer for it too instead. --- src/unix/secretstore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/unix/secretstore.cpp b/src/unix/secretstore.cpp index e72ce36248..fba321a6c2 100644 --- a/src/unix/secretstore.cpp +++ b/src/unix/secretstore.cpp @@ -209,8 +209,9 @@ public: wxString& errmsg) wxOVERRIDE { wxGtkError error; - if ( !secret_password_clearv_sync + if ( !secret_service_clear_sync ( + NULL, // Default service GetSchema(), BuildAttributes(service), NULL, // Can't be cancelled From 5a454d373b6cf03ddef2714ac8fbc84f4949d5d4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 18:23:59 +0100 Subject: [PATCH 078/329] Optionally return error message from wxSecretStore::IsOk() This allows to give at least some explanation about why the secrets can't be stored to the user, e.g. they could search for a message such as The name org.freedesktop.secrets was not provided by any .service files to find out that gnome-keyring package needs to be installed on their system. Note that this change means that under Unix an attempt to connect to the secret service is now made when wxSecretStore is constructed and not just when it's used for the first time, as before. --- include/wx/private/secretstore.h | 2 + include/wx/secretstore.h | 5 +- interface/wx/secretstore.h | 14 +++-- samples/secretstore/secretstore.cpp | 6 +- src/common/secretstore.cpp | 13 ++++ src/unix/secretstore.cpp | 93 +++++++++++++++++++++++++++-- 6 files changed, 120 insertions(+), 13 deletions(-) diff --git a/include/wx/private/secretstore.h b/include/wx/private/secretstore.h index 4cb52bc91f..443273d627 100644 --- a/include/wx/private/secretstore.h +++ b/include/wx/private/secretstore.h @@ -78,6 +78,8 @@ private: class wxSecretStoreImpl : public wxRefCounter { public: + virtual bool IsOk(wxString* WXUNUSED(errmsg)) const { return true; } + virtual bool Save(const wxString& service, const wxString& username, const wxSecretValueImpl& password, diff --git a/include/wx/secretstore.h b/include/wx/secretstore.h index a81f125501..71c0c4cc64 100644 --- a/include/wx/secretstore.h +++ b/include/wx/secretstore.h @@ -126,8 +126,9 @@ public: ~wxSecretStore(); - // Check if this object is valid. - bool IsOk() const { return m_impl != NULL; } + // Check if this object is valid, i.e. can be used, and optionally fill in + // the provided error message string if it isn't. + bool IsOk(wxString* errmsg = NULL) const; // Store a username/password combination. diff --git a/interface/wx/secretstore.h b/interface/wx/secretstore.h index d301e63585..0af7958bb4 100644 --- a/interface/wx/secretstore.h +++ b/interface/wx/secretstore.h @@ -166,14 +166,16 @@ public: Example of storing credentials using this class: @code wxSecretStore store = wxSecretStore::GetDefault(); - if ( store.IsOk() ) + wxString errmsg; + if ( store.IsOk(&errmsg) ) { if ( !store.Save("MyApp/MyService", username, password) ) wxLogWarning("Failed to save credentials to the system secret store."); } else { - wxLogWarning("This system doesn't support storing passwords securely."); + wxLogWarning("This system doesn't support storing passwords securely " + "(%s).", errmsg); } @endcode @@ -205,9 +207,13 @@ public: static wxSecretStore GetDefault(); /** - Check if this object is valid. + Check if this object can actually be used. + + @param errmsg If not @NULL, this parameter is filled with a + user-readable error message explaining why the secret store can't + be used (this argument is new since wxWidgets 3.1.4) */ - bool IsOk() const; + bool IsOk(wxString* errmsg = NULL) const; /** Store a username/password combination. diff --git a/samples/secretstore/secretstore.cpp b/samples/secretstore/secretstore.cpp index 490be687f3..c9c453ae4d 100644 --- a/samples/secretstore/secretstore.cpp +++ b/samples/secretstore/secretstore.cpp @@ -196,9 +196,11 @@ int main(int argc, char **argv) } wxSecretStore store = wxSecretStore::GetDefault(); - if ( !store.IsOk() ) + wxString errmsg; + if ( !store.IsOk(&errmsg) ) { - wxFprintf(stderr, "Failed to create default secret store.\n"); + wxFprintf(stderr, "Failed to create default secret store (%s)\n", + errmsg); return EXIT_FAILURE; } diff --git a/src/common/secretstore.cpp b/src/common/secretstore.cpp index f00dc3dd26..672fdd17fe 100644 --- a/src/common/secretstore.cpp +++ b/src/common/secretstore.cpp @@ -162,6 +162,19 @@ wxSecretStore::~wxSecretStore() // Methods forwarded to wxSecretStoreImpl // ---------------------------------------------------------------------------- +bool +wxSecretStore::IsOk(wxString* errmsg) const +{ + if ( !m_impl ) + { + if ( errmsg ) + *errmsg = _("Not available for this platform"); + return false; + } + + return m_impl->IsOk(errmsg); +} + bool wxSecretStore::Save(const wxString& service, const wxString& user, diff --git a/src/unix/secretstore.cpp b/src/unix/secretstore.cpp index fba321a6c2..e72bc081c5 100644 --- a/src/unix/secretstore.cpp +++ b/src/unix/secretstore.cpp @@ -119,6 +119,52 @@ private: SecretValue* const m_value; }; +// Dummy implementation used when secret service is not available. +class wxSecretStoreNotAvailableImpl : public wxSecretStoreImpl +{ +public: + explicit wxSecretStoreNotAvailableImpl(const wxString& error) + : m_error(error) + { + } + + virtual bool IsOk(wxString* errmsg) const wxOVERRIDE + { + if ( errmsg ) + *errmsg = m_error; + + return false; + } + + virtual bool Save(const wxString& WXUNUSED(service), + const wxString& WXUNUSED(user), + const wxSecretValueImpl& WXUNUSED(secret), + wxString& errmsg) wxOVERRIDE + { + errmsg = m_error; + return false; + } + + virtual bool Load(const wxString& WXUNUSED(service), + wxString* WXUNUSED(user), + wxSecretValueImpl** WXUNUSED(secret), + wxString& errmsg) const wxOVERRIDE + { + errmsg = m_error; + return false; + } + + virtual bool Delete(const wxString& WXUNUSED(service), + wxString& errmsg) wxOVERRIDE + { + errmsg = m_error; + return false; + } + +private: + const wxString m_error; +}; + // This implementation uses synchronous libsecret functions which is supposed // to be a bad idea, but doesn't seem to be a big deal in practice and as there // is no simple way to implement asynchronous API under the other platforms, it @@ -127,6 +173,25 @@ private: class wxSecretStoreLibSecretImpl : public wxSecretStoreImpl { public: + static wxSecretStoreLibSecretImpl* Create(wxString& errmsg) + { + wxGtkError error; + SecretService* const service = secret_service_get_sync + ( + SECRET_SERVICE_OPEN_SESSION, + NULL, // No cancellation + error.Out() + ); + if ( !service ) + { + errmsg = error.GetMessage(); + return NULL; + } + + // This passes ownership of service to the new object. + return new wxSecretStoreLibSecretImpl(service); + } + virtual bool Save(const wxString& service, const wxString& user, const wxSecretValueImpl& secret, @@ -142,7 +207,7 @@ public: wxGtkError error; if ( !secret_service_store_sync ( - NULL, // Default service + m_service, GetSchema(), BuildAttributes(service, user), SECRET_COLLECTION_DEFAULT, @@ -167,7 +232,7 @@ public: wxGtkError error; GList* const found = secret_service_search_sync ( - NULL, // Default service + m_service, GetSchema(), BuildAttributes(service), static_cast @@ -211,7 +276,7 @@ public: wxGtkError error; if ( !secret_service_clear_sync ( - NULL, // Default service + m_service, GetSchema(), BuildAttributes(service), NULL, // Can't be cancelled @@ -279,6 +344,15 @@ private: NULL )); } + + // Ctor is private, Create() should be used for creating objects of this + // class. + explicit wxSecretStoreLibSecretImpl(SecretService* service) + : m_service(service) + { + } + + wxGtkObject m_service; }; const char* wxSecretStoreLibSecretImpl::FIELD_SERVICE = "service"; @@ -299,8 +373,17 @@ wxSecretValueImpl* wxSecretValue::NewImpl(size_t size, const void *data) /* static */ wxSecretStore wxSecretStore::GetDefault() { - // There is only a single store under Windows anyhow. - return wxSecretStore(new wxSecretStoreLibSecretImpl()); + // Try to create the real implementation. + wxString errmsg; + wxSecretStoreImpl* impl = wxSecretStoreLibSecretImpl::Create(errmsg); + if ( !impl ) + { + // But if we failed, fall back to a dummy one, so that we could at + // least return the error to the code using this class. + impl = new wxSecretStoreNotAvailableImpl(errmsg); + } + + return wxSecretStore(impl); } #endif // wxUSE_SECRETSTORE From f7f90a6111671cf1a49017fa1ae73c1fbdd85828 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 18:27:38 +0100 Subject: [PATCH 079/329] Mention that wxSecretStore ctor can block At least under Unix it can show a dialog asking to create a new key ring. --- interface/wx/secretstore.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/wx/secretstore.h b/interface/wx/secretstore.h index 0af7958bb4..2dbc630c77 100644 --- a/interface/wx/secretstore.h +++ b/interface/wx/secretstore.h @@ -203,6 +203,9 @@ public: Returns the default secrets collection to use. Call IsOk() on the returned object to check if this method succeeded. + + Note that this method may show a dialog to the user under some + platforms, so it can take an arbitrarily long time to return. */ static wxSecretStore GetDefault(); From 8fcf46f65c6a6bd9c4da303a464ddcea95323d3a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 14:08:53 +0100 Subject: [PATCH 080/329] Forbid creation of wxPaintEvent objects from user code This doesn't work anyhow, so it's better to prevent the code doing this from compiling instead of getting run-time asserts or worse. Also simplify construction of these events inside wxWidgets by passing the window itself to the ctor instead of passing just its ID and calling SetEventObject() separately later. For consistency, do the same thing for wxNcPaintEvent too. --- docs/changes.txt | 4 ++++ include/wx/event.h | 19 ++++++++++++------- interface/wx/event.h | 2 +- src/common/event.cpp | 16 ++++++++++++++++ src/dfb/window.cpp | 6 ++---- src/gtk/window.cpp | 6 ++---- src/gtk1/glcanvas.cpp | 6 ++---- src/gtk1/window.cpp | 6 ++---- src/motif/window.cpp | 3 +-- src/msw/window.cpp | 6 ++---- src/osx/window_osx.cpp | 6 ++---- src/qt/glcanvas.cpp | 2 +- src/qt/window.cpp | 3 +-- src/univ/topluniv.cpp | 3 +-- src/x11/window.cpp | 6 ++---- tests/events/evthandler.cpp | 11 +++++++++++ tests/test.bkl | 6 +++--- 17 files changed, 65 insertions(+), 46 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 63a155fcbc..8925b02258 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -103,6 +103,10 @@ Changes in behaviour which may result in build errors then you will need to add these libraries to your make or project files yourself. +- wxPaintEvent objects can no longer be created by the application code. This + was never supposed to work and is now forbidden at compile-time instead of + resulting in errors during run-time. + - WXWIN_OS_DESCRIPTION doesn't exist any longer, use wxGetOsDescription(). - Never documented and not always available private wxGetClipboardData() diff --git a/include/wx/event.h b/include/wx/event.h index 293211aae3..39ca40725d 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -2337,12 +2337,14 @@ private: class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent { + // This ctor is only intended to be used by wxWidgets itself, so it's + // intentionally declared as private when not building the library itself. +#ifdef WXBUILDING public: - wxPaintEvent(int Id = 0) - : wxEvent(Id, wxEVT_PAINT) - { - } +#endif // WXBUILDING + explicit wxPaintEvent(wxWindowBase* window = NULL); +public: // default copy ctor and dtor are fine virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); } @@ -2353,11 +2355,14 @@ private: class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent { + // This ctor is only intended to be used by wxWidgets itself, so it's + // intentionally declared as private when not building the library itself. +#ifdef WXBUILDING public: - wxNcPaintEvent(int winid = 0) - : wxEvent(winid, wxEVT_NC_PAINT) - { } +#endif // WXBUILDING + explicit wxNcPaintEvent(wxWindowBase* window = NULL); +public: virtual wxEvent *Clone() const wxOVERRIDE { return new wxNcPaintEvent(*this); } private: diff --git a/interface/wx/event.h b/interface/wx/event.h index 35b97325df..7f9c0e9d66 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -2222,7 +2222,7 @@ public: need a window to be repainted, use wxWindow::Refresh() instead of trying to manually create an event of this class. */ - wxPaintEvent(int id = 0); + explicit wxPaintEvent(wxWindow* window); }; diff --git a/src/common/event.cpp b/src/common/event.cpp index e453b9694e..2d7b822c38 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -458,6 +458,22 @@ wxString wxCommandEvent::GetString() const return m_cmdString; } +// ---------------------------------------------------------------------------- +// wxPaintEvent and wxNcPaintEvent +// ---------------------------------------------------------------------------- + +wxPaintEvent::wxPaintEvent(wxWindowBase* window) + : wxEvent(window ? window->GetId() : 0, wxEVT_PAINT) +{ + SetEventObject(window); +} + +wxNcPaintEvent::wxNcPaintEvent(wxWindowBase* window) + : wxEvent(window ? window->GetId() : 0, wxEVT_NC_PAINT) +{ + SetEventObject(window); +} + // ---------------------------------------------------------------------------- // wxUpdateUIEvent // ---------------------------------------------------------------------------- diff --git a/src/dfb/window.cpp b/src/dfb/window.cpp index 888cf7491f..dd6a310f09 100644 --- a/src/dfb/window.cpp +++ b/src/dfb/window.cpp @@ -684,8 +684,7 @@ void wxWindowDFB::PaintWindow(const wxRect& rect) // only send wxNcPaintEvent if drawing at least part of nonclient area: if ( !clientRect.Contains(rect) ) { - wxNcPaintEvent eventNc(GetId()); - eventNc.SetEventObject(this); + wxNcPaintEvent eventNc(this); HandleWindowEvent(eventNc); } else @@ -697,8 +696,7 @@ void wxWindowDFB::PaintWindow(const wxRect& rect) // only send wxPaintEvent if drawing at least part of client area: if ( rect.Intersects(clientRect) ) { - wxPaintEvent eventPt(GetId()); - eventPt.SetEventObject(this); + wxPaintEvent eventPt(this); HandleWindowEvent(eventPt); } else diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index c85fe9fbb1..c00031bbb5 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -5205,12 +5205,10 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region) wxFAIL_MSG( "unsupported background style" ); } - wxNcPaintEvent nc_paint_event( GetId() ); - nc_paint_event.SetEventObject( this ); + wxNcPaintEvent nc_paint_event( this ); HandleWindowEvent( nc_paint_event ); - wxPaintEvent paint_event( GetId() ); - paint_event.SetEventObject( this ); + wxPaintEvent paint_event( this ); HandleWindowEvent( paint_event ); #if wxGTK_HAS_COMPOSITING_SUPPORT diff --git a/src/gtk1/glcanvas.cpp b/src/gtk1/glcanvas.cpp index b75b3766d8..17ab11450f 100644 --- a/src/gtk1/glcanvas.cpp +++ b/src/gtk1/glcanvas.cpp @@ -65,8 +65,7 @@ extern "C" { static gint gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) { - wxPaintEvent event( win->GetId() ); - event.SetEventObject( win ); + wxPaintEvent event( win ); win->HandleWindowEvent( event ); win->GetUpdateRegion().Clear(); @@ -302,8 +301,7 @@ void wxGLCanvas::OnInternalIdle() { if (!m_updateRegion.IsEmpty()) { - wxPaintEvent event( GetId() ); - event.SetEventObject( this ); + wxPaintEvent event( this ); HandleWindowEvent( event ); GetUpdateRegion().Clear(); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 98224b25fb..55a266b9f5 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -3599,12 +3599,10 @@ void wxWindowGTK::GtkSendPaintEvents() m_clearRegion.Clear(); } - wxNcPaintEvent nc_paint_event( GetId() ); - nc_paint_event.SetEventObject( this ); + wxNcPaintEvent nc_paint_event( this ); HandleWindowEvent( nc_paint_event ); - wxPaintEvent paint_event( GetId() ); - paint_event.SetEventObject( this ); + wxPaintEvent paint_event( this ); HandleWindowEvent( paint_event ); m_clipPaintRegion = false; diff --git a/src/motif/window.cpp b/src/motif/window.cpp index a3bb7b274f..023770f093 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1621,8 +1621,7 @@ void wxWindow::DoPaint() eraseEvent.SetEventObject(this); HandleWindowEvent(eraseEvent); - wxPaintEvent event(GetId()); - event.SetEventObject(this); + wxPaintEvent event(this); HandleWindowEvent(event); m_needsRefresh = false; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 0d06fcf9a5..2572ec0efc 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -5260,8 +5260,7 @@ bool wxWindowMSW::HandlePaint() paintStack.push(PaintData(this)); - wxPaintEvent event(m_windowId); - event.SetEventObject(this); + wxPaintEvent event(this); bool processed = HandleWindowEvent(event); @@ -5280,8 +5279,7 @@ bool wxWindowMSW::HandlePaint() // note that we must generate NC event after the normal one as otherwise // BeginPaint() will happily overwrite our decorations with the background // colour - wxNcPaintEvent eventNc(m_windowId); - eventNc.SetEventObject(this); + wxNcPaintEvent eventNc(this); HandleWindowEvent(eventNc); // don't keep an HRGN we don't need any longer (GetUpdateRegion() can only diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 4eaa5a907c..1e58f4c1ab 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -1989,9 +1989,8 @@ bool wxWindowMac::MacDoRedraw( long time ) { // paint the window itself - wxPaintEvent event(GetId()); + wxPaintEvent event(this); event.SetTimestamp(time); - event.SetEventObject(this); handled = HandleWindowEvent(event); } @@ -2040,8 +2039,7 @@ void wxWindowMac::MacPaintChildrenBorders() if ( m_updateRegion.Contains(clientOrigin.x+x-10, clientOrigin.y+y-10, w+20, h+20) ) { // paint custom borders - wxNcPaintEvent eventNc( child->GetId() ); - eventNc.SetEventObject( child ); + wxNcPaintEvent eventNc( child ); if ( !child->HandleWindowEvent( eventNc ) ) { child->MacPaintBorders(0, 0) ; diff --git a/src/qt/glcanvas.cpp b/src/qt/glcanvas.cpp index 60be7159f9..f89645c014 100644 --- a/src/qt/glcanvas.cpp +++ b/src/qt/glcanvas.cpp @@ -62,7 +62,7 @@ void wxQtGLWidget::resizeGL(int w, int h) void wxQtGLWidget::paintGL() { - wxPaintEvent event( GetHandler()->GetId() ); + wxPaintEvent event( GetHandler() ); EmitEvent(event); } diff --git a/src/qt/window.cpp b/src/qt/window.cpp index 5e1ac194ef..e2ac004a2b 100644 --- a/src/qt/window.cpp +++ b/src/qt/window.cpp @@ -1281,8 +1281,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event ) } // send the paint event (wxWindowDC will draw directly): - wxPaintEvent paint( GetId() ); - paint.SetEventObject(this); + wxPaintEvent paint( this ); handled = ProcessWindowEvent(paint); m_updateRegion.Clear(); } diff --git a/src/univ/topluniv.cpp b/src/univ/topluniv.cpp index 312ce6a912..460f465892 100644 --- a/src/univ/topluniv.cpp +++ b/src/univ/topluniv.cpp @@ -216,8 +216,7 @@ long wxTopLevelWindow::GetDecorationsStyle() const void wxTopLevelWindow::RefreshTitleBar() { - wxNcPaintEvent event(GetId()); - event.SetEventObject(this); + wxNcPaintEvent event(this); GetEventHandler()->ProcessEvent(event); } diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 373151892a..ddcd303511 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -1282,8 +1282,7 @@ void wxWindowX11::SendPaintEvents() m_clipPaintRegion = true; - wxPaintEvent paint_event( GetId() ); - paint_event.SetEventObject( this ); + wxPaintEvent paint_event( this ); HandleWindowEvent( paint_event ); m_updateRegion.Clear(); @@ -1324,8 +1323,7 @@ void wxWindowX11::SendNcPaintEvents() } } - wxNcPaintEvent nc_paint_event( GetId() ); - nc_paint_event.SetEventObject( this ); + wxNcPaintEvent nc_paint_event( this ); HandleWindowEvent( nc_paint_event ); m_updateNcArea = false; diff --git a/tests/events/evthandler.cpp b/tests/events/evthandler.cpp index a2ef903dbb..6be6c2d1ec 100644 --- a/tests/events/evthandler.cpp +++ b/tests/events/evthandler.cpp @@ -534,3 +534,14 @@ public: void OnIdle(wxIdleEvent&) { } }; #endif // C++11 + +// Another compilation-time-only test, but this one checking that these event +// objects can't be created from outside of the library. +#ifdef TEST_INVALID_EVENT_CREATION + +void TestEventCreation() +{ + wxPaintEvent eventPaint; +} + +#endif // TEST_INVALID_EVENT_CREATION diff --git a/tests/test.bkl b/tests/test.bkl index 70326b8dce..00f0c0b013 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -365,9 +365,9 @@ failtest_combobox: failtest_evthandler: @$(RM) test_evthandler.o - @for d in GLOBAL STATIC METHOD FUNCTOR NO_HANDLER DERIVED WRONG_CLASS; do \ - if $(MAKE) CXXWARNINGS=-DTEST_INVALID_BIND_$$d test_evthandler.o 2>/dev/null; then \ - echo "*** Compilation with TEST_INVALID_BIND_$$d unexpectedly succeeded.">&2; \ + @for d in BIND_GLOBAL BIND_STATIC BIND_METHOD BIND_FUNCTOR BIND_NO_HANDLER BIND_DERIVED BIND_WRONG_CLASS EVENT_CREATION; do \ + if $(MAKE) CXXWARNINGS=-DTEST_INVALID_$$d test_evthandler.o 2>/dev/null; then \ + echo "*** Compilation with TEST_INVALID_$$d unexpectedly succeeded.">&2; \ exit 1; \ fi; \ done; \ From 6697b576b21f10e4296c7338353d1ee07da83a78 Mon Sep 17 00:00:00 2001 From: Kvaz1r Date: Tue, 11 Feb 2020 16:48:13 +0200 Subject: [PATCH 081/329] Close AUI MDI children when the parent frame is closed This ensures that the parent frame doesn't close if any of the children can't be closed and also that all children are closed before the parent if they do agree to close. Closes https://github.com/wxWidgets/wxWidgets/pull/1734 Closes #15170. --- include/wx/aui/tabmdi.h | 5 +++++ src/aui/tabmdi.cpp | 33 +++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/include/wx/aui/tabmdi.h b/include/wx/aui/tabmdi.h index bd98406353..af0a100ef6 100644 --- a/include/wx/aui/tabmdi.h +++ b/include/wx/aui/tabmdi.h @@ -108,6 +108,11 @@ protected: virtual void DoGetClientSize(int *width, int *height) const wxOVERRIDE; private: + void OnClose(wxCloseEvent& event); + + // close all children, return false if any of them vetoed it + bool CloseAll(); + wxDECLARE_EVENT_TABLE(); wxDECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame); }; diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 5c0ac18b7e..dca9b8404e 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -54,6 +54,7 @@ enum MDI_MENU_ID wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame, wxFrame); wxBEGIN_EVENT_TABLE(wxAuiMDIParentFrame, wxFrame) + EVT_CLOSE(wxAuiMDIParentFrame::OnClose) #if wxUSE_MENUS EVT_MENU (wxID_ANY, wxAuiMDIParentFrame::DoHandleMenu) EVT_UPDATE_UI (wxID_ANY, wxAuiMDIParentFrame::DoHandleUpdateUI) @@ -241,6 +242,29 @@ bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event) return res; } +void wxAuiMDIParentFrame::OnClose(wxCloseEvent& event) +{ + if (!CloseAll()) + event.Veto(); + else + event.Skip(); +} + +bool wxAuiMDIParentFrame::CloseAll() +{ + wxAuiMDIChildFrame* pActiveChild; + while ((pActiveChild = GetActiveChild()) != NULL) + { + if (!pActiveChild->Close()) + { + // it refused to close, don't close the remaining ones neither + return false; + } + } + + return true; +} + wxAuiMDIChildFrame *wxAuiMDIParentFrame::GetActiveChild() const { // We can be called before the client window is created, so check for its @@ -343,14 +367,7 @@ void wxAuiMDIParentFrame::DoHandleMenu(wxCommandEvent& event) } case wxWINDOWCLOSEALL: { - wxAuiMDIChildFrame* pActiveChild; - while ((pActiveChild = GetActiveChild()) != NULL) - { - if (!pActiveChild->Close()) - { - return; // failure - } - } + CloseAll(); break; } case wxWINDOWNEXT: From 13b0981eb976970db5b336238d91d3b2da2748c9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 Feb 2020 01:28:29 +0100 Subject: [PATCH 082/329] Get rid of WXCONFIG_ONLY_CPPFLAGS variable in configure This variable was set and used exactly once, so just remove it to simplify things. No real changes. --- configure | 7 +++---- configure.in | 13 +++---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/configure b/configure index 5ef2fc76ab..47cde58291 100755 --- a/configure +++ b/configure @@ -28671,8 +28671,6 @@ EOF esac fi - WXCONFIG_ONLY_CPPFLAGS="$WXCONFIG_ONLY_CPPFLAGS -DWXUSINGDLL" - if test $wxUSE_RPATH = "no"; then SAMPLES_RPATH_FLAG='' DYLIB_PATH_POSTLINK='' @@ -37726,8 +37724,9 @@ CXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $CXXFLAGS ` OBJCFLAGS=`echo $WXCONFIG_CFLAGS $CWARNINGS $C_AND_CXX_FLAGS $OBJCFLAGS ` OBJCXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $OBJCXXFLAGS ` -WXCONFIG_CPPFLAGS=`echo $WXCONFIG_CPPFLAGS $WXCONFIG_ONLY_CPPFLAGS` - +if test "SHARED" = 1; then + WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -DWXUSINGDLL" +fi LIBS=`echo $LIBS` EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $DMALLOC_LIBS" diff --git a/configure.in b/configure.in index d9579458db..609d3e179e 100644 --- a/configure.in +++ b/configure.in @@ -3785,10 +3785,6 @@ EOF esac fi - dnl this one shouldn't be used for the library build so put it in a - dnl separate variable from WXCONFIG_CPPFLAGS - WXCONFIG_ONLY_CPPFLAGS="$WXCONFIG_ONLY_CPPFLAGS -DWXUSINGDLL" - if test $wxUSE_RPATH = "no"; then SAMPLES_RPATH_FLAG='' DYLIB_PATH_POSTLINK='' @@ -7954,8 +7950,9 @@ OBJCXXFLAGS=`echo $WXCONFIG_CXXFLAGS $C_AND_CXX_FLAGS $OBJCXXFLAGS ` dnl now that we added WXCONFIG_CPPFLAGS to CPPFLAGS we can add the wx-config dnl only stuff to it -WXCONFIG_CPPFLAGS=`echo $WXCONFIG_CPPFLAGS $WXCONFIG_ONLY_CPPFLAGS` - +if test "SHARED" = 1; then + WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS -DWXUSINGDLL" +fi LIBS=`echo $LIBS` EXTRALIBS="$LDFLAGS $LDFLAGS_VERSIONING $LIBS $DMALLOC_LIBS" @@ -8309,10 +8306,6 @@ dnl are used when building the libraries using the library dnl dnl so put anything which should be used only during the library build in, e.g. dnl CXXFLAGS, but put everything else (by default) into WXCONFIG_CXXFLAGS -dnl -dnl and, finally, for some things which should be only used by wx-config but -dnl not during the library compilation, use WXCONFIG_ONLY_CPPFLAGS which is -dnl added to WXCONFIG_CPPFLAGS after adding the latter to CPPFLAGS AC_SUBST(WXCONFIG_CPPFLAGS) AC_SUBST(WXCONFIG_CFLAGS) AC_SUBST(WXCONFIG_CXXFLAGS) From ec091c9f2b3b9b2c1fa4abc1b5afa70118f4024b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 Feb 2020 01:57:11 +0100 Subject: [PATCH 083/329] Don't override CFLAGS etc in configure-generated makefile CPPFLAGS, CFLAGS, CXXFLAGS and LDFLAGS are supposed to be under user-control and putting configure-determined options in them broke something as simple as running "make CXXFLAGS=-Wno-some-extra-warning" because this overrode the CXXFLAGS set by configure and required for build. Improve this by using WX_*FLAGS in the generated makefile and leaving the user-controlled FLAGS alone. This is still not ideal as running "configure CFLAGS=-DFOO" and then "make CFLAGS=-DBAR" will define both FOO and BAR, as configure copies CFLAGS to WX_CFLAGS, and so setting it on make command line won't override it, as it should, but this should be a much more rare and also much less severe problem, so we should be able to live with it for now. Normally this commit shouldn't result in any user-visible changes, i.e. it shouldn't break any previously working scenarios and only make some previously broken ones work. --- Makefile.in | 524 +++++++++++++++------------- build/bakefiles/common.bkl | 5 +- build/bakefiles/config.bkl | 5 +- configure | 30 +- configure.in | 48 ++- demos/bombs/Makefile.in | 14 +- demos/forty/Makefile.in | 14 +- demos/fractal/Makefile.in | 14 +- demos/life/Makefile.in | 14 +- demos/poem/Makefile.in | 14 +- samples/access/Makefile.in | 10 +- samples/animate/Makefile.in | 14 +- samples/archive/Makefile.in | 14 +- samples/artprov/Makefile.in | 14 +- samples/aui/Makefile.in | 14 +- samples/calendar/Makefile.in | 10 +- samples/caret/Makefile.in | 14 +- samples/clipboard/Makefile.in | 10 +- samples/collpane/Makefile.in | 10 +- samples/combo/Makefile.in | 14 +- samples/config/Makefile.in | 10 +- samples/console/Makefile.in | 14 +- samples/dataview/Makefile.in | 10 +- samples/debugrpt/Makefile.in | 10 +- samples/dialogs/Makefile.in | 14 +- samples/dialup/Makefile.in | 14 +- samples/display/Makefile.in | 14 +- samples/dll/Makefile.in | 28 +- samples/dnd/Makefile.in | 14 +- samples/docview/Makefile.in | 14 +- samples/dragimag/Makefile.in | 10 +- samples/drawing/Makefile.in | 14 +- samples/erase/Makefile.in | 14 +- samples/event/Makefile.in | 14 +- samples/except/Makefile.in | 14 +- samples/exec/Makefile.in | 14 +- samples/font/Makefile.in | 14 +- samples/fswatcher/Makefile.in | 10 +- samples/grid/Makefile.in | 14 +- samples/help/Makefile.in | 14 +- samples/htlbox/Makefile.in | 14 +- samples/html/about/Makefile.in | 15 +- samples/html/help/Makefile.in | 10 +- samples/html/helpview/Makefile.in | 10 +- samples/html/htmlctrl/Makefile.in | 10 +- samples/html/printing/Makefile.in | 10 +- samples/html/test/Makefile.in | 15 +- samples/html/virtual/Makefile.in | 15 +- samples/html/widget/Makefile.in | 15 +- samples/html/zip/Makefile.in | 15 +- samples/image/Makefile.in | 14 +- samples/internat/Makefile.in | 10 +- samples/ipc/Makefile.in | 36 +- samples/joytest/Makefile.in | 14 +- samples/keyboard/Makefile.in | 10 +- samples/layout/Makefile.in | 14 +- samples/listctrl/Makefile.in | 10 +- samples/mdi/Makefile.in | 14 +- samples/mediaplayer/Makefile.in | 10 +- samples/memcheck/Makefile.in | 10 +- samples/menu/Makefile.in | 14 +- samples/minimal/Makefile.in | 14 +- samples/nativdlg/Makefile.in | 10 +- samples/notebook/Makefile.in | 10 +- samples/oleauto/Makefile.in | 14 +- samples/opengl/cube/Makefile.in | 15 +- samples/opengl/isosurf/Makefile.in | 15 +- samples/opengl/penguin/Makefile.in | 24 +- samples/opengl/pyramid/Makefile.in | 15 +- samples/ownerdrw/Makefile.in | 10 +- samples/popup/Makefile.in | 14 +- samples/power/Makefile.in | 14 +- samples/preferences/Makefile.in | 10 +- samples/printing/Makefile.in | 10 +- samples/propgrid/Makefile.in | 10 +- samples/regtest/Makefile.in | 14 +- samples/render/Makefile.in | 23 +- samples/ribbon/Makefile.in | 14 +- samples/richtext/Makefile.in | 10 +- samples/sashtest/Makefile.in | 10 +- samples/scroll/Makefile.in | 14 +- samples/secretstore/Makefile.in | 10 +- samples/shaped/Makefile.in | 14 +- samples/sockets/Makefile.in | 36 +- samples/sound/Makefile.in | 14 +- samples/splash/Makefile.in | 14 +- samples/splitter/Makefile.in | 10 +- samples/statbar/Makefile.in | 14 +- samples/stc/Makefile.in | 14 +- samples/svg/Makefile.in | 14 +- samples/taborder/Makefile.in | 10 +- samples/taskbar/Makefile.in | 14 +- samples/taskbarbutton/Makefile.in | 15 +- samples/text/Makefile.in | 14 +- samples/thread/Makefile.in | 14 +- samples/toolbar/Makefile.in | 14 +- samples/treectrl/Makefile.in | 10 +- samples/treelist/Makefile.in | 10 +- samples/typetest/Makefile.in | 10 +- samples/uiaction/Makefile.in | 10 +- samples/validate/Makefile.in | 10 +- samples/vscroll/Makefile.in | 14 +- samples/webview/Makefile.in | 14 +- samples/widgets/Makefile.in | 16 +- samples/wizard/Makefile.in | 14 +- samples/wrapsizer/Makefile.in | 10 +- samples/xrc/Makefile.in | 14 +- samples/xti/Makefile.in | 14 +- tests/Makefile.in | 45 +-- tests/benchmarks/Makefile.in | 31 +- utils/emulator/src/Makefile.in | 10 +- utils/execmon/Makefile.in | 14 +- utils/helpview/src/Makefile.in | 10 +- utils/hhp2cached/Makefile.in | 10 +- utils/ifacecheck/src/Makefile.in | 10 +- utils/screenshotgen/src/Makefile.in | 14 +- utils/wxrc/Makefile.in | 14 +- 117 files changed, 1238 insertions(+), 922 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0b650a0936..ae29ef1375 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,7 +64,10 @@ EXTRALIBS_GUI = @EXTRALIBS_GUI@ EXTRALIBS_OPENGL = @EXTRALIBS_OPENGL@ EXTRALIBS_SDL = @EXTRALIBS_SDL@ EXTRALIBS_WEBVIEW = @EXTRALIBS_WEBVIEW@ -CXXWARNINGS = @CXXWARNINGS@ +WX_CPPFLAGS = @WX_CPPFLAGS@ +WX_CFLAGS = @WX_CFLAGS@ +WX_CXXFLAGS = @WX_CXXFLAGS@ +WX_LDFLAGS = @WX_LDFLAGS@ HOST_SUFFIX = @HOST_SUFFIX@ DYLIB_RPATH_INSTALL = @DYLIB_RPATH_INSTALL@ DYLIB_RPATH_POSTLINK = @DYLIB_RPATH_POSTLINK@ @@ -79,14 +82,15 @@ WX_RELEASE_NODOT = 31 WX_VERSION = $(WX_RELEASE).4 WX_VERSION_NODOT = $(WX_RELEASE_NODOT)4 LIBDIRNAME = $(wx_top_builddir)/lib -WXREGEX_CFLAGS = -DNDEBUG -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(____SHARED) \ - $(CPPFLAGS) $(CFLAGS) +WXREGEX_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(WX_CFLAGS) $(____SHARED) $(CPPFLAGS) $(CFLAGS) WXREGEX_OBJECTS = \ wxregex_regcomp.o \ wxregex_regexec.o \ wxregex_regerror.o \ wxregex_regfree.o -WXZLIB_CFLAGS = -DNDEBUG $(____SHARED) $(CPPFLAGS) $(CFLAGS) +WXZLIB_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG $(WX_CFLAGS) $(____SHARED) $(CPPFLAGS) \ + $(CFLAGS) WXZLIB_OBJECTS = \ wxzlib_adler32.o \ wxzlib_compress.o \ @@ -103,7 +107,8 @@ WXZLIB_OBJECTS = \ wxzlib_trees.o \ wxzlib_uncompr.o \ wxzlib_zutil.o -WXPNG_CFLAGS = -DNDEBUG $(__INC_ZLIB_p) $(____SHARED) $(CPPFLAGS) $(CFLAGS) +WXPNG_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG $(__INC_ZLIB_p) $(WX_CFLAGS) \ + $(____SHARED) $(CPPFLAGS) $(CFLAGS) WXPNG_OBJECTS = \ wxpng_png.o \ wxpng_pngerror.o \ @@ -120,7 +125,8 @@ WXPNG_OBJECTS = \ wxpng_pngwrite.o \ wxpng_pngwtran.o \ wxpng_pngwutil.o -WXJPEG_CFLAGS = -DNDEBUG $(____SHARED) $(CPPFLAGS) $(CFLAGS) +WXJPEG_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG $(WX_CFLAGS) $(____SHARED) $(CPPFLAGS) \ + $(CFLAGS) WXJPEG_OBJECTS = \ wxjpeg_jaricom.o \ wxjpeg_jcapimin.o \ @@ -168,8 +174,9 @@ WXJPEG_OBJECTS = \ wxjpeg_jquant1.o \ wxjpeg_jquant2.o \ wxjpeg_jutils.o -WXTIFF_CFLAGS = -DNDEBUG $(__INC_ZLIB_p) $(__INC_JPEG_p) $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(____SHARED) $(CPPFLAGS) $(CFLAGS) +WXTIFF_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG $(__INC_ZLIB_p) $(__INC_JPEG_p) \ + $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(WX_CFLAGS) $(____SHARED) $(CPPFLAGS) \ + $(CFLAGS) WXTIFF_OBJECTS = \ $(__TIFF_PLATFORM_SRC_OBJECTS) \ wxtiff_tif_aux.o \ @@ -212,18 +219,20 @@ WXTIFF_OBJECTS = \ wxtiff_tif_write.o \ wxtiff_tif_zip.o \ wxtiff_tif_zstd.o -WXEXPAT_CFLAGS = -DNDEBUG -I./src/expat/expat -DHAVE_EXPAT_CONFIG_H \ - $(____SHARED) $(wxCFLAGS_C99) $(CPPFLAGS) $(CFLAGS) +WXEXPAT_CFLAGS = $(WX_CPPFLAGS) -DNDEBUG -I./src/expat/expat \ + -DHAVE_EXPAT_CONFIG_H $(WX_CFLAGS) $(____SHARED) $(wxCFLAGS_C99) $(CPPFLAGS) \ + $(CFLAGS) WXEXPAT_OBJECTS = \ wxexpat_xmlparse.o \ wxexpat_xmlrole.o \ wxexpat_xmltok.o -WXSCINTILLA_CXXFLAGS = -DNDEBUG -I$(top_srcdir)/src/stc/scintilla/include \ +WXSCINTILLA_CXXFLAGS = $(WX_CPPFLAGS) -DNDEBUG \ + -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ -DLINK_LEXERS $(__wxscintilla_usingdll_p) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(____SHARED) $(CPPFLAGS) \ - $(CXXFLAGS) + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(WX_CXXFLAGS) $(____SHARED) \ + $(CPPFLAGS) $(CXXFLAGS) WXSCINTILLA_OBJECTS = \ wxscintilla_LexA68k.o \ wxscintilla_LexAbaqus.o \ @@ -922,16 +931,7 @@ ALL_BASE_SOURCES = \ src/msw/urlmsw.cpp \ src/xml/xml.cpp \ src/common/xtixml.cpp -MONODLL_CFLAGS = $(__monodll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -I$(top_srcdir)/src/stc/scintilla/include \ - -I$(top_srcdir)/src/stc/scintilla/lexlib \ - -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \ - $(PIC_FLAG) $(CPPFLAGS) $(CFLAGS) -MONODLL_CXXFLAGS = $(__monodll_PCH_INC) -D__WX$(TOOLKIT)__ \ +MONODLL_CFLAGS = $(__monodll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -940,8 +940,18 @@ MONODLL_CXXFLAGS = $(__monodll_PCH_INC) -D__WX$(TOOLKIT)__ \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -MONODLL_OBJCXXFLAGS = $(__monodll_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(PIC_FLAG) $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS) +MONODLL_CXXFLAGS = $(__monodll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -I$(top_srcdir)/src/stc/scintilla/include \ + -I$(top_srcdir)/src/stc/scintilla/lexlib \ + -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ + -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \ + $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +MONODLL_OBJCXXFLAGS = $(__monodll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1064,16 +1074,17 @@ MONODLL_OBJECTS = \ $(__PLUGIN_SRC_OBJECTS) \ $(__monodll___win32rc) MONODLL_ODEP = $(_____pch_wxprec_monodll_wx_wxprec_h_gch___depname) -MONOLIB_CFLAGS = $(__monolib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -I$(top_srcdir)/src/stc/scintilla/include \ +MONOLIB_CFLAGS = $(__monolib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) $(CPPFLAGS) \ - $(CFLAGS) -MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) -D__WX$(TOOLKIT)__ \ + -DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) $(WX_CFLAGS) \ + $(CPPFLAGS) $(CFLAGS) +MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1082,8 +1093,8 @@ MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) -D__WX$(TOOLKIT)__ \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ -DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) \ - $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -MONOLIB_OBJCXXFLAGS = $(__monolib_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +MONOLIB_OBJCXXFLAGS = $(__monolib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1205,19 +1216,19 @@ MONOLIB_OBJECTS = \ monolib_xtixml.o \ $(__PLUGIN_SRC_OBJECTS_1) MONOLIB_ODEP = $(_____pch_wxprec_monolib_wx_wxprec_h_gch___depname) -BASEDLL_CFLAGS = $(__basedll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 $(PIC_FLAG) \ - $(CPPFLAGS) $(CFLAGS) -BASEDLL_CXXFLAGS = $(__basedll_PCH_INC) -D__WX$(TOOLKIT)__ \ +BASEDLL_CFLAGS = $(__basedll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE \ - -DwxUSE_BASE=1 $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -BASEDLL_OBJCXXFLAGS = $(__basedll_PCH_INC) -D__WX$(TOOLKIT)__ \ + -DwxUSE_BASE=1 $(PIC_FLAG) $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS) +BASEDLL_CXXFLAGS = $(__basedll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE \ + -DwxUSE_BASE=1 $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +BASEDLL_OBJCXXFLAGS = $(__basedll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1321,18 +1332,19 @@ BASEDLL_OBJECTS = \ $(__BASE_AND_GUI_PLATFORM_SRC_OBJECTS_2) \ $(__BASE_AND_GUI_TOOLKIT_SRC_OBJECTS_2) BASEDLL_ODEP = $(_____pch_wxprec_basedll_wx_wxprec_h_gch___depname) -BASELIB_CFLAGS = $(__baselib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DwxUSE_BASE=1 $(CPPFLAGS) $(CFLAGS) -BASELIB_CXXFLAGS = $(__baselib_PCH_INC) -D__WX$(TOOLKIT)__ \ +BASELIB_CFLAGS = $(__baselib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DwxUSE_BASE=1 $(WX_CFLAGS) \ + $(CPPFLAGS) $(CFLAGS) +BASELIB_CXXFLAGS = $(__baselib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DwxUSE_BASE=1 \ - $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -BASELIB_OBJCXXFLAGS = $(__baselib_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +BASELIB_OBJCXXFLAGS = $(__baselib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1435,12 +1447,12 @@ BASELIB_OBJECTS = \ $(__BASE_AND_GUI_PLATFORM_SRC_OBJECTS_3) \ $(__BASE_AND_GUI_TOOLKIT_SRC_OBJECTS_3) BASELIB_ODEP = $(_____pch_wxprec_baselib_wx_wxprec_h_gch___depname) -NETDLL_CXXFLAGS = $(__netdll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXUSINGDLL -DWXMAKINGDLL_NET $(PIC_FLAG) \ - $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +NETDLL_CXXFLAGS = $(__netdll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXUSINGDLL \ + -DWXMAKINGDLL_NET $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) NETDLL_OBJECTS = \ $(__netdll___win32rc) \ netdll_fs_inet.o \ @@ -1455,11 +1467,12 @@ NETDLL_OBJECTS = \ netdll_url.o \ $(__NET_PLATFORM_SRC_OBJECTS_2) NETDLL_ODEP = $(_____pch_wxprec_netdll_wx_wxprec_h_gch___depname) -NETLIB_CXXFLAGS = $(__netlib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_GUI=0 $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +NETLIB_CXXFLAGS = $(__netlib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 $(WX_CXXFLAGS) $(CPPFLAGS) \ + $(CXXFLAGS) NETLIB_OBJECTS = \ netlib_fs_inet.o \ netlib_ftp.o \ @@ -1473,19 +1486,19 @@ NETLIB_OBJECTS = \ netlib_url.o \ $(__NET_PLATFORM_SRC_OBJECTS_3) NETLIB_ODEP = $(_____pch_wxprec_netlib_wx_wxprec_h_gch___depname) -COREDLL_CFLAGS = $(__coredll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 $(PIC_FLAG) \ - $(CPPFLAGS) $(CFLAGS) -COREDLL_CXXFLAGS = $(__coredll_PCH_INC) -D__WX$(TOOLKIT)__ \ +COREDLL_CFLAGS = $(__coredll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_CORE \ - -DwxUSE_BASE=0 $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -COREDLL_OBJCXXFLAGS = $(__coredll_PCH_INC) -D__WX$(TOOLKIT)__ \ + -DwxUSE_BASE=0 $(PIC_FLAG) $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS) +COREDLL_CXXFLAGS = $(__coredll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_CORE \ + -DwxUSE_BASE=0 $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +COREDLL_OBJCXXFLAGS = $(__coredll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1502,18 +1515,19 @@ COREDLL_OBJECTS = \ $(__CORE_SRC_OBJECTS_2) \ $(__PLUGIN_SRC_OBJECTS_2) COREDLL_ODEP = $(_____pch_wxprec_coredll_wx_wxprec_h_gch___depname) -CORELIB_CFLAGS = $(__corelib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_BASE=0 $(CPPFLAGS) $(CFLAGS) -CORELIB_CXXFLAGS = $(__corelib_PCH_INC) -D__WX$(TOOLKIT)__ \ +CORELIB_CFLAGS = $(__corelib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_BASE=0 $(CXXWARNINGS) $(CPPFLAGS) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_BASE=0 $(WX_CFLAGS) $(CPPFLAGS) \ + $(CFLAGS) +CORELIB_CXXFLAGS = $(__corelib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_BASE=0 $(WX_CXXFLAGS) $(CPPFLAGS) \ $(CXXFLAGS) -CORELIB_OBJCXXFLAGS = $(__corelib_PCH_INC) -D__WX$(TOOLKIT)__ \ +CORELIB_OBJCXXFLAGS = $(__corelib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1528,31 +1542,31 @@ CORELIB_OBJECTS = \ $(__CORE_SRC_OBJECTS_3) \ $(__PLUGIN_SRC_OBJECTS_3) CORELIB_ODEP = $(_____pch_wxprec_corelib_wx_wxprec_h_gch___depname) -ADVDLL_CXXFLAGS = $(__advdll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_ADV $(PIC_FLAG) $(CXXWARNINGS) \ - $(CPPFLAGS) $(CXXFLAGS) +ADVDLL_CXXFLAGS = $(__advdll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_ADV $(PIC_FLAG) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) ADVDLL_OBJECTS = \ $(__advdll___win32rc) \ advdll_dummy.o ADVDLL_ODEP = $(_____pch_wxprec_advdll_wx_wxprec_h_gch___depname) -ADVLIB_CXXFLAGS = $(__advlib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +ADVLIB_CXXFLAGS = $(__advlib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) ADVLIB_OBJECTS = \ advlib_dummy.o ADVLIB_ODEP = $(_____pch_wxprec_advlib_wx_wxprec_h_gch___depname) -MEDIADLL_CXXFLAGS = $(__mediadll_PCH_INC) -D__WX$(TOOLKIT)__ \ +MEDIADLL_CXXFLAGS = $(__mediadll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_MEDIA \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -MEDIADLL_OBJCXXFLAGS = $(__mediadll_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +MEDIADLL_OBJCXXFLAGS = $(__mediadll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1563,12 +1577,12 @@ MEDIADLL_OBJECTS = \ mediadll_mediactrlcmn.o \ $(__MEDIA_PLATFORM_SRC_OBJECTS_2) MEDIADLL_ODEP = $(_____pch_wxprec_mediadll_wx_wxprec_h_gch___depname) -MEDIALIB_CXXFLAGS = $(__medialib_PCH_INC) -D__WX$(TOOLKIT)__ \ +MEDIALIB_CXXFLAGS = $(__medialib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -MEDIALIB_OBJCXXFLAGS = $(__medialib_PCH_INC) -D__WX$(TOOLKIT)__ \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +MEDIALIB_OBJCXXFLAGS = $(__medialib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -1577,12 +1591,12 @@ MEDIALIB_OBJECTS = \ medialib_mediactrlcmn.o \ $(__MEDIA_PLATFORM_SRC_OBJECTS_3) MEDIALIB_ODEP = $(_____pch_wxprec_medialib_wx_wxprec_h_gch___depname) -HTMLDLL_CXXFLAGS = $(__htmldll_PCH_INC) -D__WX$(TOOLKIT)__ \ +HTMLDLL_CXXFLAGS = $(__htmldll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_HTML \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) + $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) HTMLDLL_OBJECTS = \ $(__htmldll___win32rc) \ $(__HTML_SRC_PLATFORM_OBJECTS_2) \ @@ -1612,11 +1626,11 @@ HTMLDLL_OBJECTS = \ htmldll_winpars.o \ htmldll_htmllbox.o HTMLDLL_ODEP = $(_____pch_wxprec_htmldll_wx_wxprec_h_gch___depname) -HTMLLIB_CXXFLAGS = $(__htmllib_PCH_INC) -D__WX$(TOOLKIT)__ \ +HTMLLIB_CXXFLAGS = $(__htmllib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) HTMLLIB_OBJECTS = \ $(__HTML_SRC_PLATFORM_OBJECTS_3) \ htmllib_helpctrl.o \ @@ -1645,20 +1659,21 @@ HTMLLIB_OBJECTS = \ htmllib_winpars.o \ htmllib_htmllbox.o HTMLLIB_ODEP = $(_____pch_wxprec_htmllib_wx_wxprec_h_gch___depname) -WEBVIEWDLL_CXXFLAGS = $(__webviewdll_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW \ - $(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -WEBVIEWDLL_OBJCXXFLAGS = $(__webviewdll_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW \ - $(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \ - $(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS) +WEBVIEWDLL_CXXFLAGS = $(__webviewdll_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p) \ + $(__webview_additional_include_p) $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) \ + $(CXXFLAGS) +WEBVIEWDLL_OBJCXXFLAGS = $(__webviewdll_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -DWXUSINGDLL -DWXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p) \ + $(__webview_additional_include_p) $(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS) WEBVIEWDLL_OBJECTS = \ $(__WEBVIEW_SRC_PLATFORM_OBJECTS_2) \ webviewdll_webview.o \ @@ -1666,70 +1681,73 @@ WEBVIEWDLL_OBJECTS = \ webviewdll_webviewfshandler.o \ $(__webviewdll___win32rc) WEBVIEWDLL_ODEP = $(_____pch_wxprec_webviewdll_wx_wxprec_h_gch___depname) -WEBVIEWLIB_CXXFLAGS = $(__webviewlib_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(__webviewdll_ext_dir_define_p) \ - $(__webview_additional_include_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -WEBVIEWLIB_OBJCXXFLAGS = $(__webviewlib_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(__webviewdll_ext_dir_define_p) \ - $(__webview_additional_include_p) $(CPPFLAGS) $(OBJCXXFLAGS) +WEBVIEWLIB_CXXFLAGS = $(__webviewlib_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + $(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +WEBVIEWLIB_OBJCXXFLAGS = $(__webviewlib_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + $(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \ + $(CPPFLAGS) $(OBJCXXFLAGS) WEBVIEWLIB_OBJECTS = \ $(__WEBVIEW_SRC_PLATFORM_OBJECTS_3) \ webviewlib_webview.o \ webviewlib_webviewarchivehandler.o \ webviewlib_webviewfshandler.o WEBVIEWLIB_ODEP = $(_____pch_wxprec_webviewlib_wx_wxprec_h_gch___depname) -QADLL_CXXFLAGS = $(__qadll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_QA $(PIC_FLAG) $(CXXWARNINGS) \ - $(CPPFLAGS) $(CXXFLAGS) +QADLL_CXXFLAGS = $(__qadll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_QA $(PIC_FLAG) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) QADLL_OBJECTS = \ $(__qadll___win32rc) \ qadll_debugrpt.o \ qadll_dbgrptg.o QADLL_ODEP = $(_____pch_wxprec_qadll_wx_wxprec_h_gch___depname) -QALIB_CXXFLAGS = $(__qalib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +QALIB_CXXFLAGS = $(__qalib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) QALIB_OBJECTS = \ qalib_debugrpt.o \ qalib_dbgrptg.o QALIB_ODEP = $(_____pch_wxprec_qalib_wx_wxprec_h_gch___depname) -XMLDLL_CXXFLAGS = $(__xmldll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXUSINGDLL -DWXMAKINGDLL_XML $(PIC_FLAG) \ - $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +XMLDLL_CXXFLAGS = $(__xmldll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 -DWXUSINGDLL \ + -DWXMAKINGDLL_XML $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) XMLDLL_OBJECTS = \ $(__xmldll___win32rc) \ xmldll_xml.o \ xmldll_xtixml.o XMLDLL_ODEP = $(_____pch_wxprec_xmldll_wx_wxprec_h_gch___depname) -XMLLIB_CXXFLAGS = $(__xmllib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DwxUSE_GUI=0 $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +XMLLIB_CXXFLAGS = $(__xmllib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DwxUSE_GUI=0 $(WX_CXXFLAGS) $(CPPFLAGS) \ + $(CXXFLAGS) XMLLIB_OBJECTS = \ xmllib_xml.o \ xmllib_xtixml.o XMLLIB_ODEP = $(_____pch_wxprec_xmllib_wx_wxprec_h_gch___depname) -XRCDLL_CXXFLAGS = $(__xrcdll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_XRC $(PIC_FLAG) $(CXXWARNINGS) \ - $(CPPFLAGS) $(CXXFLAGS) +XRCDLL_CXXFLAGS = $(__xrcdll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_XRC $(PIC_FLAG) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) XRCDLL_OBJECTS = \ $(__xrcdll___win32rc) \ xrcdll_xh_activityindicator.o \ @@ -1802,11 +1820,11 @@ XRCDLL_OBJECTS = \ xrcdll_xmladv.o \ xrcdll_xmlrsall.o XRCDLL_ODEP = $(_____pch_wxprec_xrcdll_wx_wxprec_h_gch___depname) -XRCLIB_CXXFLAGS = $(__xrclib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +XRCLIB_CXXFLAGS = $(__xrclib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) XRCLIB_OBJECTS = \ xrclib_xh_activityindicator.o \ xrclib_xh_animatctrl.o \ @@ -1878,12 +1896,12 @@ XRCLIB_OBJECTS = \ xrclib_xmladv.o \ xrclib_xmlrsall.o XRCLIB_ODEP = $(_____pch_wxprec_xrclib_wx_wxprec_h_gch___depname) -AUIDLL_CXXFLAGS = $(__auidll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_AUI $(PIC_FLAG) $(CXXWARNINGS) \ - $(CPPFLAGS) $(CXXFLAGS) +AUIDLL_CXXFLAGS = $(__auidll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_AUI $(PIC_FLAG) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) AUIDLL_OBJECTS = \ $(__auidll___win32rc) \ auidll_framemanager.o \ @@ -1898,11 +1916,11 @@ AUIDLL_OBJECTS = \ $(__AUI_GTK_SRC_OBJECTS_2) \ $(__AUI_PLATFORM_SRC_OBJECTS_2) AUIDLL_ODEP = $(_____pch_wxprec_auidll_wx_wxprec_h_gch___depname) -AUILIB_CXXFLAGS = $(__auilib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +AUILIB_CXXFLAGS = $(__auilib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) AUILIB_OBJECTS = \ auilib_framemanager.o \ auilib_dockart.o \ @@ -1916,12 +1934,12 @@ AUILIB_OBJECTS = \ $(__AUI_GTK_SRC_OBJECTS_3) \ $(__AUI_PLATFORM_SRC_OBJECTS_3) AUILIB_ODEP = $(_____pch_wxprec_auilib_wx_wxprec_h_gch___depname) -RIBBONDLL_CXXFLAGS = $(__ribbondll_PCH_INC) -D__WX$(TOOLKIT)__ \ +RIBBONDLL_CXXFLAGS = $(__ribbondll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_RIBBON \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) + $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) RIBBONDLL_OBJECTS = \ $(__ribbondll___win32rc) \ ribbondll_art_internal.o \ @@ -1936,11 +1954,11 @@ RIBBONDLL_OBJECTS = \ ribbondll_toolbar.o \ ribbondll_xh_ribbon.o RIBBONDLL_ODEP = $(_____pch_wxprec_ribbondll_wx_wxprec_h_gch___depname) -RIBBONLIB_CXXFLAGS = $(__ribbonlib_PCH_INC) -D__WX$(TOOLKIT)__ \ +RIBBONLIB_CXXFLAGS = $(__ribbonlib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) RIBBONLIB_OBJECTS = \ ribbonlib_art_internal.o \ ribbonlib_art_msw.o \ @@ -1954,12 +1972,13 @@ RIBBONLIB_OBJECTS = \ ribbonlib_toolbar.o \ ribbonlib_xh_ribbon.o RIBBONLIB_ODEP = $(_____pch_wxprec_ribbonlib_wx_wxprec_h_gch___depname) -PROPGRIDDLL_CXXFLAGS = $(__propgriddll_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_PROPGRID \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +PROPGRIDDLL_CXXFLAGS = $(__propgriddll_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -DWXUSINGDLL -DWXMAKINGDLL_PROPGRID $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) \ + $(CXXFLAGS) PROPGRIDDLL_OBJECTS = \ $(__propgriddll___win32rc) \ propgriddll_advprops.o \ @@ -1971,11 +1990,12 @@ PROPGRIDDLL_OBJECTS = \ propgriddll_propgridpagestate.o \ propgriddll_props.o PROPGRIDDLL_ODEP = $(_____pch_wxprec_propgriddll_wx_wxprec_h_gch___depname) -PROPGRIDLIB_CXXFLAGS = $(__propgridlib_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +PROPGRIDLIB_CXXFLAGS = $(__propgridlib_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) PROPGRIDLIB_OBJECTS = \ propgridlib_advprops.o \ propgridlib_editors.o \ @@ -1986,12 +2006,13 @@ PROPGRIDLIB_OBJECTS = \ propgridlib_propgridpagestate.o \ propgridlib_props.o PROPGRIDLIB_ODEP = $(_____pch_wxprec_propgridlib_wx_wxprec_h_gch___depname) -RICHTEXTDLL_CXXFLAGS = $(__richtextdll_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_RICHTEXT \ - $(PIC_FLAG) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +RICHTEXTDLL_CXXFLAGS = $(__richtextdll_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -DWXUSINGDLL -DWXMAKINGDLL_RICHTEXT $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) \ + $(CXXFLAGS) RICHTEXTDLL_OBJECTS = \ $(__richtextdll___win32rc) \ richtextdll_richtextbuffer.o \ @@ -2006,11 +2027,12 @@ RICHTEXTDLL_OBJECTS = \ richtextdll_richtextxml.o \ richtextdll_xh_richtext.o RICHTEXTDLL_ODEP = $(_____pch_wxprec_richtextdll_wx_wxprec_h_gch___depname) -RICHTEXTLIB_CXXFLAGS = $(__richtextlib_PCH_INC) -D__WX$(TOOLKIT)__ \ - $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ - $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ - $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ - $(__INC_REGEX_p) $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) +RICHTEXTLIB_CXXFLAGS = $(__richtextlib_PCH_INC) $(WX_CPPFLAGS) \ + -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) $(__INC_JPEG_p) \ + $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) RICHTEXTLIB_OBJECTS = \ richtextlib_richtextbuffer.o \ richtextlib_richtextctrl.o \ @@ -2024,16 +2046,17 @@ RICHTEXTLIB_OBJECTS = \ richtextlib_richtextxml.o \ richtextlib_xh_richtext.o RICHTEXTLIB_ODEP = $(_____pch_wxprec_richtextlib_wx_wxprec_h_gch___depname) -STCDLL_CXXFLAGS = $(__stcdll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -I$(top_srcdir)/src/stc/scintilla/include \ +STCDLL_CXXFLAGS = $(__stcdll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DWXUSINGDLL -DWXMAKINGDLL_STC $(PIC_FLAG) $(CXXWARNINGS) \ + -DLINK_LEXERS -DWXUSINGDLL -DWXMAKINGDLL_STC $(PIC_FLAG) $(WX_CXXFLAGS) \ $(CPPFLAGS) $(CXXFLAGS) -STCDLL_OBJCXXFLAGS = $(__stcdll_PCH_INC) -D__WX$(TOOLKIT)__ \ +STCDLL_OBJCXXFLAGS = $(__stcdll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -2050,15 +2073,16 @@ STCDLL_OBJECTS = \ stcdll_ScintillaWX.o \ $(__STC_PLATFORM_SRC_OBJECTS_2) STCDLL_ODEP = $(_____pch_wxprec_stcdll_wx_wxprec_h_gch___depname) -STCLIB_CXXFLAGS = $(__stclib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -I$(top_srcdir)/src/stc/scintilla/include \ +STCLIB_CXXFLAGS = $(__stclib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) \ + -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -STCLIB_OBJCXXFLAGS = $(__stclib_PCH_INC) -D__WX$(TOOLKIT)__ \ + -DLINK_LEXERS $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +STCLIB_OBJCXXFLAGS = $(__stclib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ @@ -2073,33 +2097,33 @@ STCLIB_OBJECTS = \ stclib_ScintillaWX.o \ $(__STC_PLATFORM_SRC_OBJECTS_3) STCLIB_ODEP = $(_____pch_wxprec_stclib_wx_wxprec_h_gch___depname) -GLDLL_CXXFLAGS = $(__gldll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_GL $(PIC_FLAG) $(CXXWARNINGS) \ - $(CPPFLAGS) $(CXXFLAGS) -GLDLL_OBJCXXFLAGS = $(__gldll_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_GL $(PIC_FLAG) $(CPPFLAGS) \ - $(OBJCXXFLAGS) +GLDLL_CXXFLAGS = $(__gldll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_GL $(PIC_FLAG) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +GLDLL_OBJCXXFLAGS = $(__gldll_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) -DWXUSINGDLL -DWXMAKINGDLL_GL $(PIC_FLAG) \ + $(CPPFLAGS) $(OBJCXXFLAGS) GLDLL_OBJECTS = \ $(__gldll___win32rc) \ gldll_glcmn.o \ $(__OPENGL_SRC_PLATFORM_OBJECTS) GLDLL_ODEP = $(_____pch_wxprec_gldll_wx_wxprec_h_gch___depname) -GLLIB_CXXFLAGS = $(__gllib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) $(CXXWARNINGS) $(CPPFLAGS) $(CXXFLAGS) -GLLIB_OBJCXXFLAGS = $(__gllib_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ - $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ - $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ - $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ - $(__INC_EXPAT_p) $(CPPFLAGS) $(OBJCXXFLAGS) +GLLIB_CXXFLAGS = $(__gllib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) +GLLIB_OBJCXXFLAGS = $(__gllib_PCH_INC) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ + $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ + $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING $(__INC_TIFF_BUILD_p) \ + $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ + $(__INC_REGEX_p) $(__INC_EXPAT_p) $(CPPFLAGS) $(OBJCXXFLAGS) GLLIB_OBJECTS = \ gllib_glcmn.o \ $(__OPENGL_SRC_PLATFORM_OBJECTS_1) @@ -14057,7 +14081,7 @@ distclean: clean @COND_SHARED_0_USE_STC_1@ rm -f $(DESTDIR)$(libdir)/$(LIBPREFIX)wxscintilla$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT) @COND_MONOLITHIC_1_SHARED_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(MONODLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__monodll___win32rc) $(__wxscintilla_library_link_DEP) -@COND_MONOLITHIC_1_SHARED_1@ $(SHARED_LD_CXX) $@ $(MONODLL_OBJECTS) $(__wxscintilla_library_link_LIBR) -L$(LIBDIRNAME) $(__monodll___macinstnamecmd) $(__monodll___importlib) $(__monodll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(EXTRALIBS_XML) $(EXTRALIBS_HTML) $(EXTRALIBS_MEDIA) $(PLUGIN_ADV_EXTRALIBS) $(EXTRALIBS_WEBVIEW) $(__wxscintilla_library_link_LIBR_1) $(LIBS) +@COND_MONOLITHIC_1_SHARED_1@ $(SHARED_LD_CXX) $@ $(MONODLL_OBJECTS) $(__wxscintilla_library_link_LIBR) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__monodll___macinstnamecmd) $(__monodll___importlib) $(__monodll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(EXTRALIBS_XML) $(EXTRALIBS_HTML) $(EXTRALIBS_MEDIA) $(PLUGIN_ADV_EXTRALIBS) $(EXTRALIBS_WEBVIEW) $(__wxscintilla_library_link_LIBR_1) $(LIBS) @COND_MONOLITHIC_1_SHARED_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_1_SHARED_1@ @COND_MONOLITHIC_1_SHARED_1@ $(__monodll___so_symlinks_cmd) @@ -14092,7 +14116,7 @@ distclean: clean @COND_USE_PCH_1@ $(BK_MAKE_PCH) ./.pch/wxprec_monolib/wx/wxprec.h.gch wx/wxprec.h $(CXX) $(MONOLIB_CXXFLAGS) @COND_MONOLITHIC_0_SHARED_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIX)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(BASEDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__basedll___win32rc) -@COND_MONOLITHIC_0_SHARED_1@ $(SHARED_LD_CXX) $@ $(BASEDLL_OBJECTS) -L$(LIBDIRNAME) $(__basedll___macinstnamecmd) $(__basedll___importlib) $(__basedll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1@ $(SHARED_LD_CXX) $@ $(BASEDLL_OBJECTS) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__basedll___macinstnamecmd) $(__basedll___importlib) $(__basedll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) @COND_MONOLITHIC_0_SHARED_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1@ @COND_MONOLITHIC_0_SHARED_1@ $(__basedll___so_symlinks_cmd) @@ -14129,7 +14153,7 @@ distclean: clean @COND_MONOLITHIC_0@wxbase: $(____wxbase_namedll_DEP) $(____wxbase_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIX)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(NETDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__netdll___win32rc) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1@ $(SHARED_LD_CXX) $@ $(NETDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__netdll___macinstnamecmd) $(__netdll___importlib) $(__netdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1@ $(SHARED_LD_CXX) $@ $(NETDLL_OBJECTS) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__netdll___macinstnamecmd) $(__netdll___importlib) $(__netdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1@ @COND_MONOLITHIC_0_SHARED_1@ $(__netdll___so_symlinks_cmd) @@ -14166,7 +14190,7 @@ distclean: clean @COND_MONOLITHIC_0@wxnet: $(____wxnet_namedll_DEP) $(____wxnet_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(COREDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__coredll___win32rc) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(SHARED_LD_CXX) $@ $(COREDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__coredll___macinstnamecmd) $(__coredll___importlib) $(__coredll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(SHARED_LD_CXX) $@ $(COREDLL_OBJECTS) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__coredll___macinstnamecmd) $(__coredll___importlib) $(__coredll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(__coredll___so_symlinks_cmd) @@ -14203,7 +14227,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_GUI_1@wxcore: $(____wxcore_namedll_DEP) $(____wxcore_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(ADVDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__advdll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(SHARED_LD_CXX) $@ $(ADVDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__advdll___macinstnamecmd) $(__advdll___importlib) $(__advdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(PLUGIN_ADV_EXTRALIBS) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(SHARED_LD_CXX) $@ $(ADVDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__advdll___macinstnamecmd) $(__advdll___importlib) $(__advdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(PLUGIN_ADV_EXTRALIBS) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1@ $(__advdll___so_symlinks_cmd) @@ -14240,7 +14264,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_GUI_1@wxadv: $(____wxadv_namedll_DEP) $(____wxadv_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_MEDIA_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_media$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(MEDIADLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__mediadll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_MEDIA_1@ $(SHARED_LD_CXX) $@ $(MEDIADLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__mediadll___macinstnamecmd) $(__mediadll___importlib) $(__mediadll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_MEDIA) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_MEDIA_1@ $(SHARED_LD_CXX) $@ $(MEDIADLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__mediadll___macinstnamecmd) $(__mediadll___importlib) $(__mediadll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_MEDIA) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_MEDIA_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_MEDIA_1@ @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_MEDIA_1@ $(__mediadll___so_symlinks_cmd) @@ -14277,7 +14301,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_GUI_1_USE_MEDIA_1@wxmedia: $(____wxmedia_namedll_DEP) $(____wxmedia_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(HTMLDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__htmldll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@ $(SHARED_LD_CXX) $@ $(HTMLDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__htmldll___macinstnamecmd) $(__htmldll___importlib) $(__htmldll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_HTML) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@ $(SHARED_LD_CXX) $@ $(HTMLDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__htmldll___macinstnamecmd) $(__htmldll___importlib) $(__htmldll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_HTML) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@ @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@ $(__htmldll___so_symlinks_cmd) @@ -14314,7 +14338,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_HTML_1@wxhtml: $(____wxhtml_namedll_DEP) $(____wxhtml_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_WEBVIEW_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(WEBVIEWDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__coredll___depname) $(__basedll___depname) $(__webviewdll___win32rc) -@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_WEBVIEW_1@ $(SHARED_LD_CXX) $@ $(WEBVIEWDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__webviewdll___macinstnamecmd) $(__webviewdll___importlib) $(__webviewdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_WEBVIEW) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_WEBVIEW_1@ $(SHARED_LD_CXX) $@ $(WEBVIEWDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__webviewdll___macinstnamecmd) $(__webviewdll___importlib) $(__webviewdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_WEBVIEW) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_WEBVIEW_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_WEBVIEW_1@ @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_WEBVIEW_1@ $(__webviewdll___so_symlinks_cmd) @@ -14351,7 +14375,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_WEBVIEW_1@wxwebview: $(____wxwebview_namedll_DEP) $(____wxwebview_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_QA_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_qa$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(QADLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__qadll___win32rc) $(__coredll___depname) $(__basedll___depname) $(__xmldll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_QA_1@ $(SHARED_LD_CXX) $@ $(QADLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__qadll___macinstnamecmd) $(__qadll___importlib) $(__qadll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_QA_1@ $(SHARED_LD_CXX) $@ $(QADLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__qadll___macinstnamecmd) $(__qadll___importlib) $(__qadll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_QA_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_QA_1@ @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_QA_1@ $(__qadll___so_symlinks_cmd) @@ -14388,7 +14412,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_QA_1@wxqa: $(____wxqa_namedll_DEP) $(____wxqa_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIX)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(XMLDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__xmldll___win32rc) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1@ $(SHARED_LD_CXX) $@ $(XMLDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__xmldll___macinstnamecmd) $(__xmldll___importlib) $(__xmldll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_XML) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1@ $(SHARED_LD_CXX) $@ $(XMLDLL_OBJECTS) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__xmldll___macinstnamecmd) $(__xmldll___importlib) $(__xmldll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(EXTRALIBS_XML) $(LIBS) @COND_MONOLITHIC_0_SHARED_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1@ @COND_MONOLITHIC_0_SHARED_1@ $(__xmldll___so_symlinks_cmd) @@ -14425,7 +14449,7 @@ distclean: clean @COND_MONOLITHIC_0@wxxml: $(____wxxml_namedll_DEP) $(____wxxml_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_XRC_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xrc$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(XRCDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__xrcdll___win32rc) $(__htmldll_library_link_DEP) $(__coredll___depname) $(__xmldll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_XRC_1@ $(SHARED_LD_CXX) $@ $(XRCDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__htmldll_library_link_LIBR) -L$(LIBDIRNAME) $(__xrcdll___macinstnamecmd) $(__xrcdll___importlib) $(__xrcdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(__htmldll_library_link_LIBR_0) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_XRC_1@ $(SHARED_LD_CXX) $@ $(XRCDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__htmldll_library_link_LIBR) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__xrcdll___macinstnamecmd) $(__xrcdll___importlib) $(__xrcdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(__htmldll_library_link_LIBR_0) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_XRC_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_XRC_1@ @COND_MONOLITHIC_0_SHARED_1_USE_XRC_1@ $(__xrcdll___so_symlinks_cmd) @@ -14462,7 +14486,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_XRC_1@wxxrc: $(____wxxrc_namedll_DEP) $(____wxxrc_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_AUI_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_aui$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(AUIDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__auidll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_AUI_1@ $(SHARED_LD_CXX) $@ $(AUIDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__auidll___macinstnamecmd) $(__auidll___importlib) $(__auidll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_AUI_1@ $(SHARED_LD_CXX) $@ $(AUIDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__auidll___macinstnamecmd) $(__auidll___importlib) $(__auidll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_AUI_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_AUI_1@ @COND_MONOLITHIC_0_SHARED_1_USE_AUI_1@ $(__auidll___so_symlinks_cmd) @@ -14499,7 +14523,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_AUI_1@wxaui: $(____wxaui_namedll_DEP) $(____wxaui_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_RIBBON_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_ribbon$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(RIBBONDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__ribbondll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_RIBBON_1@ $(SHARED_LD_CXX) $@ $(RIBBONDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__ribbondll___macinstnamecmd) $(__ribbondll___importlib) $(__ribbondll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_RIBBON_1@ $(SHARED_LD_CXX) $@ $(RIBBONDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__ribbondll___macinstnamecmd) $(__ribbondll___importlib) $(__ribbondll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_RIBBON_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_RIBBON_1@ @COND_MONOLITHIC_0_SHARED_1_USE_RIBBON_1@ $(__ribbondll___so_symlinks_cmd) @@ -14536,7 +14560,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_RIBBON_1@wxribbon: $(____wxribbon_namedll_DEP) $(____wxribbon_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_PROPGRID_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(PROPGRIDDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__propgriddll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_PROPGRID_1@ $(SHARED_LD_CXX) $@ $(PROPGRIDDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__propgriddll___macinstnamecmd) $(__propgriddll___importlib) $(__propgriddll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_PROPGRID_1@ $(SHARED_LD_CXX) $@ $(PROPGRIDDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__propgriddll___macinstnamecmd) $(__propgriddll___importlib) $(__propgriddll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_PROPGRID_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_PROPGRID_1@ @COND_MONOLITHIC_0_SHARED_1_USE_PROPGRID_1@ $(__propgriddll___so_symlinks_cmd) @@ -14573,7 +14597,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_PROPGRID_1@wxpropgrid: $(____wxpropgrid_namedll_DEP) $(____wxpropgrid_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_RICHTEXT_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_richtext$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(RICHTEXTDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__richtextdll___win32rc) $(__htmldll_library_link_DEP) $(__xmldll___depname) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_RICHTEXT_1@ $(SHARED_LD_CXX) $@ $(RICHTEXTDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__htmldll_library_link_LIBR) -L$(LIBDIRNAME) $(__richtextdll___macinstnamecmd) $(__richtextdll___importlib) $(__richtextdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(__htmldll_library_link_LIBR_0) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_RICHTEXT_1@ $(SHARED_LD_CXX) $@ $(RICHTEXTDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__htmldll_library_link_LIBR) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__richtextdll___macinstnamecmd) $(__richtextdll___importlib) $(__richtextdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(__htmldll_library_link_LIBR_0) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_RICHTEXT_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_RICHTEXT_1@ @COND_MONOLITHIC_0_SHARED_1_USE_RICHTEXT_1@ $(__richtextdll___so_symlinks_cmd) @@ -14610,7 +14634,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_RICHTEXT_1@wxrichtext: $(____wxrichtext_namedll_DEP) $(____wxrichtext_namelib_DEP) @COND_MONOLITHIC_0_SHARED_1_USE_STC_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_stc$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(STCDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__wxscintilla___depname) $(__stcdll___win32rc) $(__coredll___depname) $(__basedll___depname) -@COND_MONOLITHIC_0_SHARED_1_USE_STC_1@ $(SHARED_LD_CXX) $@ $(STCDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(__stcdll___macinstnamecmd) $(__stcdll___importlib) $(__stcdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwxscintilla$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) +@COND_MONOLITHIC_0_SHARED_1_USE_STC_1@ $(SHARED_LD_CXX) $@ $(STCDLL_OBJECTS) -L$(LIBDIRNAME) -L$(LIBDIRNAME) -L$(LIBDIRNAME) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__stcdll___macinstnamecmd) $(__stcdll___importlib) $(__stcdll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) -lwxscintilla$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) $(LIBS) @COND_MONOLITHIC_0_SHARED_1_USE_STC_1@ $(DYLIB_RPATH_POSTLINK) @COND_MONOLITHIC_0_SHARED_1_USE_STC_1@ @COND_MONOLITHIC_0_SHARED_1_USE_STC_1@ $(__stcdll___so_symlinks_cmd) @@ -14647,7 +14671,7 @@ distclean: clean @COND_MONOLITHIC_0_USE_STC_1@wxstc: $(____wxstc_namedll_DEP) $(____wxstc_namelib_DEP) @COND_SHARED_1_USE_GUI_1_USE_OPENGL_1@$(LIBDIRNAME)/$(DLLPREFIX)$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG)$(dll___targetsuf3): $(GLDLL_OBJECTS) $(__wxtiff___depname) $(__wxjpeg___depname) $(__wxpng___depname) $(__wxscintilla___depname) $(__wxexpat___depname) $(__wxzlib___depname) $(__wxregex___depname) $(__gldll___win32rc) $(__basedll___depname) $(__coredll___depname) $(__monodll___depname) -@COND_SHARED_1_USE_GUI_1_USE_OPENGL_1@ $(SHARED_LD_CXX) $@ $(GLDLL_OBJECTS) -L$(LIBDIRNAME) $(__gldll___macinstnamecmd) $(__gldll___importlib) $(__gldll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(__WXLIBGLDEP_CORE_p) $(__WXLIBGLDEP_BASE_p) $(__WXLIB_MONO_p) $(EXTRALIBS_OPENGL) $(LIBS) +@COND_SHARED_1_USE_GUI_1_USE_OPENGL_1@ $(SHARED_LD_CXX) $@ $(GLDLL_OBJECTS) $(WX_LDFLAGS) -L$(LIBDIRNAME) $(__gldll___macinstnamecmd) $(__gldll___importlib) $(__gldll___soname_flags) $(WXMACVERSION_CMD) $(LDFLAGS) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(__WXLIBGLDEP_CORE_p) $(__WXLIBGLDEP_BASE_p) $(__WXLIB_MONO_p) $(EXTRALIBS_OPENGL) $(LIBS) @COND_SHARED_1_USE_GUI_1_USE_OPENGL_1@ $(DYLIB_RPATH_POSTLINK) @COND_SHARED_1_USE_GUI_1_USE_OPENGL_1@ @COND_SHARED_1_USE_GUI_1_USE_OPENGL_1@ $(__gldll___so_symlinks_cmd) diff --git a/build/bakefiles/common.bkl b/build/bakefiles/common.bkl index 60b725d4fd..a96c972dc9 100644 --- a/build/bakefiles/common.bkl +++ b/build/bakefiles/common.bkl @@ -379,6 +379,10 @@ $(NO_VC_CRTDBG) $(WIN32_WINNT) + $(WX_CPPFLAGS) + $(WX_CFLAGS) + $(WX_CXXFLAGS) + $(WX_LDFLAGS) $(WIN32_DPI_MANIFEST) $(WIN32_DPI_LINKFLAG) @@ -557,7 +561,6 @@ $(TAB)cl /EP /nologo "$(DOLLAR)(InputPath)" > "$(SETUPHDIR)\wx\msw\rcdefs.h" $(LIBDIRNAME) max - $(CXXWARNINGS) -wcd=549 -wcd=656 diff --git a/build/bakefiles/config.bkl b/build/bakefiles/config.bkl index fae136f0a5..0880d1cfd0 100644 --- a/build/bakefiles/config.bkl +++ b/build/bakefiles/config.bkl @@ -400,7 +400,10 @@ compiled .lib files and setup.h under the lib/ toplevel directory.