From 685856173115dd94d886e0a8dd33f0cf5a330963 Mon Sep 17 00:00:00 2001 From: Jon Evans <jon@craftyjon.com> Date: Thu, 9 Jan 2025 08:38:32 -0500 Subject: [PATCH] Fixes for building against recent wxWidgets 3.3 --- common/design_block_lib_table.cpp | 3 ++- common/widgets/grid_text_helpers.cpp | 1 + common/widgets/wx_aui_art_providers.cpp | 6 +++++- eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp | 2 +- eeschema/tools/sch_drawing_tools.cpp | 4 ++-- include/widgets/wx_aui_art_providers.h | 4 ++++ pcbnew/dialogs/dialog_board_reannotate.cpp | 2 +- pcbnew/tools/pcb_picker_tool.cpp | 4 ++-- qa/tests/eeschema/test_sch_sheet_path.cpp | 3 ++- 9 files changed, 20 insertions(+), 9 deletions(-) diff --git a/common/design_block_lib_table.cpp b/common/design_block_lib_table.cpp index 71524f721e..1ba6668688 100644 --- a/common/design_block_lib_table.cpp +++ b/common/design_block_lib_table.cpp @@ -536,7 +536,8 @@ public: // consider a directory to be a lib if it's name ends with the design block lib dir extension // it is under $KICADn_3RD_PARTY/design_blocks/<pkgid>/ i.e. has nested level of at least +3 - if( dirPath.EndsWith( wxS( "." ) + FILEEXT::KiCadDesignBlockLibPathExtension ) + if( dirPath.EndsWith( wxString::Format( wxS( ".%s" ), + FILEEXT::KiCadDesignBlockLibPathExtension ) ) && dir.GetDirCount() >= m_prefix_dir_count + 3 ) { wxString versionedPath = wxString::Format( diff --git a/common/widgets/grid_text_helpers.cpp b/common/widgets/grid_text_helpers.cpp index fa18644fc5..85e05f7a25 100644 --- a/common/widgets/grid_text_helpers.cpp +++ b/common/widgets/grid_text_helpers.cpp @@ -20,6 +20,7 @@ #include <string_utils.h> #include <wx/stc/stc.h> +#include <wx/dc.h> #include <widgets/grid_text_helpers.h> #include <widgets/wx_grid.h> #include <scintilla_tricks.h> diff --git a/common/widgets/wx_aui_art_providers.cpp b/common/widgets/wx_aui_art_providers.cpp index 2435e4a72c..3be11d6bf6 100644 --- a/common/widgets/wx_aui_art_providers.cpp +++ b/common/widgets/wx_aui_art_providers.cpp @@ -28,9 +28,13 @@ #include <settings/common_settings.h> #include <widgets/wx_aui_art_providers.h> - +#if wxCHECK_VERSION( 3, 3, 0 ) +wxSize WX_AUI_TOOLBAR_ART::GetToolSize( wxReadOnlyDC& aDc, wxWindow* aWindow, + const wxAuiToolBarItem& aItem ) +#else wxSize WX_AUI_TOOLBAR_ART::GetToolSize( wxDC& aDc, wxWindow* aWindow, const wxAuiToolBarItem& aItem ) +#endif { // Based on the upstream wxWidgets implementation, but simplified for our application int size = Pgm().GetCommonSettings()->m_Appearance.toolbar_icon_size; diff --git a/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp b/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp index 53a15c76eb..913d4e5fbc 100644 --- a/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp +++ b/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp @@ -291,7 +291,7 @@ void SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary( const wxString& aLibraryPath, if( aProperties && aProperties->contains( "fplib" ) ) { - fplibname = aProperties->at( "fplib" ); + fplibname = wxString::FromUTF8( aProperties->at( "fplib" ) ); } // Get timestamp diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 05ebfceab3..b26a402b19 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -3044,8 +3044,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) else { sheet->GetFields()[SHEETNAME].SetText( wxT( "Untitled Sheet" ) ); - sheet->GetFields()[SHEETFILENAME].SetText( wxT( "untitled." ) - + FILEEXT::KiCadSchematicFileExtension ); + sheet->GetFields()[SHEETFILENAME].SetText( + wxString::Format( wxT( "untitled.%s" ), FILEEXT::KiCadSchematicFileExtension ) ); } sheet->SetFlags( IS_NEW | IS_MOVING ); diff --git a/include/widgets/wx_aui_art_providers.h b/include/widgets/wx_aui_art_providers.h index 28b0ee7021..3027ef30a7 100644 --- a/include/widgets/wx_aui_art_providers.h +++ b/include/widgets/wx_aui_art_providers.h @@ -31,7 +31,11 @@ public: virtual ~WX_AUI_TOOLBAR_ART() = default; +#if wxCHECK_VERSION( 3, 3, 0 ) + wxSize GetToolSize( wxReadOnlyDC& aDc, wxWindow* aWindow, const wxAuiToolBarItem& aItem ) override; +#else wxSize GetToolSize( wxDC& aDc, wxWindow* aWindow, const wxAuiToolBarItem& aItem ) override; +#endif /** * Unfortunately we need to re-implement this to actually be able to control the size diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index dcbd4eceba..33dafcfbaa 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -327,7 +327,7 @@ void DIALOG_BOARD_REANNOTATE::OnApplyClick( wxCommandEvent& event ) void DIALOG_BOARD_REANNOTATE::MakeSampleText( wxString& aMessage ) { aMessage.Printf( _( "\n%s footprints will be reannotated." ), - _( AnnotateString[m_annotationScope] ) ); + wxGetTranslation( AnnotateString[m_annotationScope] ) ); if( !m_ExcludeList->GetValue().empty() ) { diff --git a/pcbnew/tools/pcb_picker_tool.cpp b/pcbnew/tools/pcb_picker_tool.cpp index 2d21db9930..892b687632 100644 --- a/pcbnew/tools/pcb_picker_tool.cpp +++ b/pcbnew/tools/pcb_picker_tool.cpp @@ -249,7 +249,7 @@ int PCB_PICKER_TOOL::SelectPointInteractively( const TOOL_EVENT& aEvent ) Activate(); - statusPopup.SetText( _( params.m_Prompt ) ); + statusPopup.SetText( wxGetTranslation( params.m_Prompt ) ); const auto sendPoint = [&]( const std::optional<VECTOR2I>& aPoint ) { @@ -308,7 +308,7 @@ int PCB_PICKER_TOOL::SelectItemInteractively( const TOOL_EVENT& aEvent ) Activate(); - statusPopup.SetText( _( params.m_Prompt ) ); + statusPopup.SetText( wxGetTranslation( params.m_Prompt ) ); const auto sendItem = [&]( const EDA_ITEM* aItem ) { diff --git a/qa/tests/eeschema/test_sch_sheet_path.cpp b/qa/tests/eeschema/test_sch_sheet_path.cpp index f814e61a08..3c5876ecb2 100644 --- a/qa/tests/eeschema/test_sch_sheet_path.cpp +++ b/qa/tests/eeschema/test_sch_sheet_path.cpp @@ -138,7 +138,8 @@ BOOST_AUTO_TEST_CASE( SheetListGetOrdinalPath ) // The "complex_hierarchy" test project has a root sheet with two sheets that reference the // same file. std::unique_ptr<SCHEMATIC> schematic; - wxFileName fn( KI_TEST::GetEeschemaTestDataDir() + wxS( "netlists/complex_hierarchy" ), + wxFileName fn( wxString::Format( wxS( "%snetlists/complex_hierarchy" ), + KI_TEST::GetEeschemaTestDataDir() ), wxS( "complex_hierarchy" ), FILEEXT::ProjectFileExtension ); schematic.reset( EESCHEMA_HELPERS::LoadSchematic( fn.GetFullPath(), false, false, nullptr ) );