From 37b200cb3ed36cbe7b15f6c9979163d0953624b9 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 27 Jul 2021 08:22:27 -0400 Subject: [PATCH] Pass wxString objects by reference instead of on the stack. --- .../3d_model_viewer/eda_3d_model_viewer.h | 4 +- common/confirm.cpp | 17 +++---- common/dialogs/panel_setup_netclasses.cpp | 13 +++-- common/lib_tree_model_adapter.cpp | 33 ++++++------- common/plotters/plotter_hpgl.h | 2 +- common/plugins/altium/altium_parser_utils.cpp | 8 ++-- common/plugins/altium/altium_parser_utils.h | 2 +- .../cadstar/cadstar_archive_parser.cpp | 4 +- .../plugins/cadstar/cadstar_archive_parser.h | 2 +- common/settings/color_settings.cpp | 2 +- common/string.cpp | 10 ++-- common/tool/action_menu.cpp | 2 +- common/widgets/unit_binder.cpp | 2 +- cvpcb/listboxes.h | 2 +- eeschema/dialogs/dialog_choose_symbol.h | 6 +-- eeschema/fields_grid_table.h | 2 +- eeschema/hierarch.cpp | 2 +- eeschema/hierarch.h | 2 +- eeschema/sch_sheet.cpp | 2 +- eeschema/sch_sheet.h | 9 ++-- eeschema/sch_validators.h | 4 +- eeschema/sim/sim_panel_base.cpp | 7 +-- eeschema/sim/sim_panel_base.h | 6 +-- eeschema/sim/sim_plot_panel.cpp | 6 +-- eeschema/sim/sim_plot_panel.h | 7 +-- eeschema/sim/spice_settings.h | 3 +- eeschema/widgets/symbol_preview_widget.h | 2 +- .../dialogs/dialog_select_one_pcb_layer.cpp | 3 +- gerbview/gerbview_frame.h | 2 +- include/confirm.h | 7 +-- include/dialogs/panel_setup_netclasses.h | 37 +++++++-------- include/eda_pattern_match.h | 10 ++-- include/filehistory.h | 4 +- include/footprint_filter.h | 12 ++--- include/footprint_info.h | 4 +- include/gr_basic.h | 4 +- include/kicad_string.h | 2 +- include/lib_table_grid.h | 4 +- include/lib_tree_model.h | 4 +- include/lib_tree_model_adapter.h | 36 +++++++------- include/pcb_group.h | 4 +- include/settings/color_settings.h | 4 +- include/settings/parameters.h | 4 +- include/tool/action_menu.h | 2 +- include/validators.h | 2 +- include/widgets/footprint_choice.h | 6 +-- include/widgets/footprint_preview_widget.h | 4 +- include/widgets/footprint_select_widget.h | 6 +-- include/widgets/grid_combobox.h | 4 +- include/widgets/grid_text_button_helpers.h | 2 +- include/widgets/msgpanel.h | 2 +- include/widgets/unit_binder.h | 2 +- kicad/import_project.cpp | 7 ++- kicad/kicad_manager_frame.h | 13 ++--- pcb_calculator/class_regulator_data.h | 2 +- pcbnew/dialogs/dialog_board_reannotate.cpp | 4 +- pcbnew/dialogs/dialog_board_reannotate.h | 4 +- pcbnew/dialogs/dialog_board_statistics.h | 2 +- pcbnew/dialogs/dialog_imported_layers.cpp | 21 +++++++-- pcbnew/dialogs/dialog_imported_layers.h | 2 +- pcbnew/footprint_info_impl.h | 2 +- pcbnew/fp_text_grid_table.h | 4 +- pcbnew/import_gfx/dxf_import_plugin.h | 6 +-- pcbnew/import_gfx/graphics_importer.h | 2 +- pcbnew/pcb_edit_frame.h | 2 +- pcbnew/pcb_expr_evaluator.h | 7 +-- pcbnew/pcb_plot_params.h | 2 +- pcbnew/plugins/altium/altium_pcb.cpp | 3 +- pcbnew/plugins/altium/altium_pcb.h | 2 +- .../cadstar/cadstar_pcb_archive_parser.h | 36 +++++++------- pcbnew/plugins/pcad/pcad2kicad_common.cpp | 47 ++++++++++++------- pcbnew/plugins/pcad/pcad2kicad_common.h | 15 +++--- pcbnew/plugins/pcad/pcb_component.h | 8 +++- .../scripting/pcbnew_footprint_wizards.h | 2 +- qa/drc_proto/drc_proto.cpp | 9 ++-- qa/drc_proto/drc_proto.h | 19 +++++--- qa/pns/pns_log.h | 12 ++--- 77 files changed, 305 insertions(+), 260 deletions(-) diff --git a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.h b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.h index a33fd1c551..c2230a130b 100644 --- a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.h +++ b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Mario Luzeiro - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -68,7 +68,7 @@ public: * * @param aModelPathName 3D model path name. */ - void Set3DModel( wxString const& aModelPathName ); + void Set3DModel( const wxString& aModelPathName ); /** * Unload the displayed 3D model. diff --git a/common/confirm.cpp b/common/confirm.cpp index 4eea0edc77..eb032b2882 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -151,7 +151,7 @@ long KIDIALOG::getStyle( KD_TYPE aType ) } -int UnsavedChangesDialog( wxWindow* parent, wxString aMessage, bool* aApplyToAll ) +int UnsavedChangesDialog( wxWindow* parent, const wxString& aMessage, bool* aApplyToAll ) { static bool s_apply_to_all = false; @@ -218,19 +218,14 @@ bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage, int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, - wxString aDetailedMessage, wxString aOKLabel, wxString aCancelLabel, - bool* aApplyToAll ) + const wxString& aDetailedMessage, const wxString& aOKLabel, + const wxString& aCancelLabel, bool* aApplyToAll ) { wxRichMessageDialog dlg( aParent, aMessage, aWarning, wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER ); - if( aOKLabel.IsEmpty() ) - aOKLabel = _( "OK" ); - - if( aCancelLabel.IsEmpty() ) - aCancelLabel = _( "Cancel" ); - - dlg.SetOKCancelLabels( aOKLabel, aCancelLabel ); + dlg.SetOKCancelLabels( ( aOKLabel.IsEmpty() ) ? _( "OK" ) : aOKLabel, + ( aCancelLabel.IsEmpty() ) ? _( "Cancel" ) : aCancelLabel ); if( !aDetailedMessage.IsEmpty() ) dlg.SetExtendedMessage( aDetailedMessage ); diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp index 139c3c07be..166bd9f886 100644 --- a/common/dialogs/panel_setup_netclasses.cpp +++ b/common/dialogs/panel_setup_netclasses.cpp @@ -399,12 +399,15 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow() } -bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, bool focusFirst ) +bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, const wxString& aName, + bool focusFirst ) { - aName.Trim( true ); - aName.Trim( false ); + wxString tmp = aName; - if( aName.IsEmpty() ) + tmp.Trim( true ); + tmp.Trim( false ); + + if( tmp.IsEmpty() ) { wxString msg = _( "Netclass must have a name." ); m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_NAME ); @@ -413,7 +416,7 @@ bool PANEL_SETUP_NETCLASSES::validateNetclassName( int aRow, wxString aName, boo for( int ii = 0; ii < m_netclassGrid->GetNumberRows(); ii++ ) { - if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( aName ) == 0 ) + if( ii != aRow && m_netclassGrid->GetCellValue( ii, GRID_NAME ).CmpNoCase( tmp ) == 0 ) { wxString msg = _( "Netclass name already in use." ); m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME ); diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index a8f3b4fbcb..1b46b22e75 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -37,7 +37,7 @@ static const int kDataViewIndent = 20; -wxDataViewItem LIB_TREE_MODEL_ADAPTER::ToItem( LIB_TREE_NODE const* aNode ) +wxDataViewItem LIB_TREE_MODEL_ADAPTER::ToItem( const LIB_TREE_NODE* aNode ) { return wxDataViewItem( const_cast( static_cast( aNode ) ) ); } @@ -49,7 +49,7 @@ LIB_TREE_NODE* LIB_TREE_MODEL_ADAPTER::ToNode( wxDataViewItem aItem ) } -unsigned int LIB_TREE_MODEL_ADAPTER::IntoArray( LIB_TREE_NODE const& aNode, +unsigned int LIB_TREE_MODEL_ADAPTER::IntoArray( const LIB_TREE_NODE& aNode, wxDataViewItemArray& aChildren ) { unsigned int n = 0; @@ -67,7 +67,8 @@ unsigned int LIB_TREE_MODEL_ADAPTER::IntoArray( LIB_TREE_NODE const& aNode, } -LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, wxString aPinnedKey ) : +LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, + const wxString& aPinnedKey ) : m_parent( aParent ), m_filter( SYM_FILTER_NONE ), m_show_units( true ), @@ -148,15 +149,15 @@ void LIB_TREE_MODEL_ADAPTER::ShowUnits( bool aShow ) } -void LIB_TREE_MODEL_ADAPTER::SetPreselectNode( LIB_ID const& aLibId, int aUnit ) +void LIB_TREE_MODEL_ADAPTER::SetPreselectNode( const LIB_ID& aLibId, int aUnit ) { m_preselect_lib_id = aLibId; m_preselect_unit = aUnit; } -LIB_TREE_NODE_LIB& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( wxString const& aNodeName, - wxString const& aDesc ) +LIB_TREE_NODE_LIB& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( const wxString& aNodeName, + const wxString& aDesc ) { LIB_TREE_NODE_LIB& lib_node = m_tree.AddLib( aNodeName, aDesc ); @@ -166,8 +167,8 @@ LIB_TREE_NODE_LIB& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( wxString const& aNo } -void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( wxString const& aNodeName, wxString const& aDesc, - std::vector const& aItemList, +void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( const wxString& aNodeName, const wxString& aDesc, + const std::vector& aItemList, bool presorted ) { LIB_TREE_NODE_LIB& lib_node = DoAddLibraryNode( aNodeName, aDesc ); @@ -179,7 +180,7 @@ void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( wxString const& aNodeName, wxString c } -void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch, bool aState ) +void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool aState ) { { wxWindowUpdateLocker updateLock( m_widget ); @@ -362,7 +363,7 @@ wxDataViewItem LIB_TREE_MODEL_ADAPTER::FindItem( const LIB_ID& aLibId ) } -unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( wxDataViewItem const& aItem, +unsigned int LIB_TREE_MODEL_ADAPTER::GetChildren( const wxDataViewItem& aItem, wxDataViewItemArray& aChildren ) const { const LIB_TREE_NODE* node = ( aItem.IsOk() ? ToNode( aItem ) : &m_tree ); @@ -409,20 +410,20 @@ void LIB_TREE_MODEL_ADAPTER::RefreshTree() } -bool LIB_TREE_MODEL_ADAPTER::HasContainerColumns( wxDataViewItem const& aItem ) const +bool LIB_TREE_MODEL_ADAPTER::HasContainerColumns( const wxDataViewItem& aItem ) const { return IsContainer( aItem ); } -bool LIB_TREE_MODEL_ADAPTER::IsContainer( wxDataViewItem const& aItem ) const +bool LIB_TREE_MODEL_ADAPTER::IsContainer( const wxDataViewItem& aItem ) const { LIB_TREE_NODE* node = ToNode( aItem ); return node ? node->m_Children.size() : true; } -wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetParent( wxDataViewItem const& aItem ) const +wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetParent( const wxDataViewItem& aItem ) const { if( m_freeze ) return ToItem( nullptr ); @@ -440,7 +441,7 @@ wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetParent( wxDataViewItem const& aItem ) void LIB_TREE_MODEL_ADAPTER::GetValue( wxVariant& aVariant, - wxDataViewItem const& aItem, + const wxDataViewItem& aItem, unsigned int aCol ) const { if( IsFrozen() ) @@ -465,7 +466,7 @@ void LIB_TREE_MODEL_ADAPTER::GetValue( wxVariant& aVariant, } -bool LIB_TREE_MODEL_ADAPTER::GetAttr( wxDataViewItem const& aItem, +bool LIB_TREE_MODEL_ADAPTER::GetAttr( const wxDataViewItem& aItem, unsigned int aCol, wxDataViewItemAttr& aAttr ) const { @@ -495,7 +496,7 @@ bool LIB_TREE_MODEL_ADAPTER::GetAttr( wxDataViewItem const& aItem, void LIB_TREE_MODEL_ADAPTER::FindAndExpand( LIB_TREE_NODE& aNode, - std::function aFunc, + std::function aFunc, LIB_TREE_NODE** aHighScore ) { for( std::unique_ptr& node: aNode.m_Children ) diff --git a/common/plotters/plotter_hpgl.h b/common/plotters/plotter_hpgl.h index c34a1717d0..e325b2fa3a 100644 --- a/common/plotters/plotter_hpgl.h +++ b/common/plotters/plotter_hpgl.h @@ -160,7 +160,7 @@ protected: /// @param content is the content substring. /// /// @return whether a new item was made - bool startOrAppendItem( DPOINT location, wxString const& content ); + bool startOrAppendItem( DPOINT location, const wxString& content ); int penSpeed; int penNumber; diff --git a/common/plugins/altium/altium_parser_utils.cpp b/common/plugins/altium/altium_parser_utils.cpp index 565f061c78..26cfd5ec1a 100644 --- a/common/plugins/altium/altium_parser_utils.cpp +++ b/common/plugins/altium/altium_parser_utils.cpp @@ -28,11 +28,11 @@ #include -LIB_ID AltiumToKiCadLibID( wxString aLibName, wxString aLibReference ) +LIB_ID AltiumToKiCadLibID( const wxString& aLibName, const wxString& aLibReference ) { - aLibReference = EscapeString( aLibReference, CTX_LIBID ); + wxString libReference = EscapeString( aLibReference, CTX_LIBID ); - wxString key = !aLibName.empty() ? ( aLibName + ":" + aLibReference ) : aLibReference; + wxString key = !aLibName.empty() ? ( aLibName + ":" + libReference ) : libReference; LIB_ID libId; libId.Parse( key, true ); @@ -136,4 +136,4 @@ wxString AltiumSpecialStringsToKiCadVariables( const wxString& } while( delimiter != wxString::npos ); return result; -} \ No newline at end of file +} diff --git a/common/plugins/altium/altium_parser_utils.h b/common/plugins/altium/altium_parser_utils.h index 87c0ecbf37..f8c1de9dab 100644 --- a/common/plugins/altium/altium_parser_utils.h +++ b/common/plugins/altium/altium_parser_utils.h @@ -32,7 +32,7 @@ #include -LIB_ID AltiumToKiCadLibID( wxString aLibName, wxString aLibReference ); +LIB_ID AltiumToKiCadLibID( const wxString& aLibName, const wxString& aLibReference ); wxString AltiumPropertyToKiCadString( const wxString& aString ); diff --git a/common/plugins/cadstar/cadstar_archive_parser.cpp b/common/plugins/cadstar/cadstar_archive_parser.cpp index 12dae974cf..185469956e 100644 --- a/common/plugins/cadstar/cadstar_archive_parser.cpp +++ b/common/plugins/cadstar/cadstar_archive_parser.cpp @@ -738,7 +738,8 @@ void CADSTAR_ARCHIVE_PARSER::SETTINGS::Parse( XNODE* aNode, PARSER_CONTEXT* aCon } -wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_CONTEXT* aContext ) +wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( const wxString& aTextString, + PARSER_CONTEXT* aContext ) { static const std::map txtTokens = { @@ -764,7 +765,6 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C { TEXT_FIELD_NAME::HYPERLINK, wxT( "HYPERLINK" ) } }; - wxString remainingStr = aTextString; wxString returnStr; diff --git a/common/plugins/cadstar/cadstar_archive_parser.h b/common/plugins/cadstar/cadstar_archive_parser.h index 580211ff67..1baef29546 100644 --- a/common/plugins/cadstar/cadstar_archive_parser.h +++ b/common/plugins/cadstar/cadstar_archive_parser.h @@ -194,7 +194,7 @@ public: * @param aParserContext PARSER_CONTEXT in which to store the values of the found fields * @return */ - static wxString ParseTextFields( wxString aTextString, PARSER_CONTEXT* aParserContext ); + static wxString ParseTextFields( const wxString& aTextString, PARSER_CONTEXT* aParserContext ); struct PARSER diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index 3a71dcba69..48ded02326 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -33,7 +33,7 @@ const int colorsSchemaVersion = 2; -COLOR_SETTINGS::COLOR_SETTINGS( wxString aFilename ) : +COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename ) : JSON_SETTINGS( std::move( aFilename ), SETTINGS_LOC::COLORS, colorsSchemaVersion ), m_overrideSchItemColors( false ) { diff --git a/common/string.cpp b/common/string.cpp index 8d87844476..63a2b2ca9e 100644 --- a/common/string.cpp +++ b/common/string.cpp @@ -703,19 +703,19 @@ bool ApplyModifier( double& value, const wxString& aString ) } -int ValueStringCompare( wxString strFWord, wxString strSWord ) +int ValueStringCompare( const wxString& strFWord, const wxString& strSWord ) { // Compare unescaped text - strFWord = UnescapeString( strFWord ); - strSWord = UnescapeString( strSWord ); + wxString fWord = UnescapeString( strFWord ); + wxString sWord = UnescapeString( strSWord ); // The different sections of the two strings wxString strFWordBeg, strFWordMid, strFWordEnd; wxString strSWordBeg, strSWordMid, strSWordEnd; // Split the two strings into separate parts - SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd ); - SplitString( strSWord, &strSWordBeg, &strSWordMid, &strSWordEnd ); + SplitString( fWord, &strFWordBeg, &strFWordMid, &strFWordEnd ); + SplitString( sWord, &strSWordBeg, &strSWordMid, &strSWordEnd ); // Compare the Beginning section of the strings int isEqual = strFWordBeg.CmpNoCase( strSWordBeg ); diff --git a/common/tool/action_menu.cpp b/common/tool/action_menu.cpp index b6493d4240..c74e82bb21 100644 --- a/common/tool/action_menu.cpp +++ b/common/tool/action_menu.cpp @@ -202,7 +202,7 @@ wxMenuItem* ACTION_MENU::Add( ACTION_MENU* aMenu ) } -void ACTION_MENU::AddClose( wxString aAppname ) +void ACTION_MENU::AddClose( const wxString& aAppname ) { #ifdef __WINDOWS__ Add( _( "Close" ), diff --git a/common/widgets/unit_binder.cpp b/common/widgets/unit_binder.cpp index 5802007976..71fb83cf9f 100644 --- a/common/widgets/unit_binder.cpp +++ b/common/widgets/unit_binder.cpp @@ -257,7 +257,7 @@ void UNIT_BINDER::SetDoubleValue( double aValue ) } -void UNIT_BINDER::SetValue( wxString aValue ) +void UNIT_BINDER::SetValue( const wxString& aValue ) { wxTextEntry* textEntry = dynamic_cast( m_valueCtrl ); wxStaticText* staticText = dynamic_cast( m_valueCtrl ); diff --git a/cvpcb/listboxes.h b/cvpcb/listboxes.h index 0ba87a8b44..df7343a02b 100644 --- a/cvpcb/listboxes.h +++ b/cvpcb/listboxes.h @@ -117,7 +117,7 @@ public: * @param aFilterType defines the criteria to filter \a aList. */ void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent, - const wxString &aFootPrintFilterPattern, int aFilterType ); + const wxString& aFootPrintFilterPattern, int aFilterType ); wxString GetSelectedFootprint(); diff --git a/eeschema/dialogs/dialog_choose_symbol.h b/eeschema/dialogs/dialog_choose_symbol.h index 3b200e7b0c..5dbec805cb 100644 --- a/eeschema/dialogs/dialog_choose_symbol.h +++ b/eeschema/dialogs/dialog_choose_symbol.h @@ -185,19 +185,19 @@ protected: /** * Look up the footprint for a given symbol specified in the #LIB_ID and display it. */ - void ShowFootprintFor( LIB_ID const& aLibId ); + void ShowFootprintFor( const LIB_ID& aLibId ); /** * Display the given footprint by name. */ - void ShowFootprint( wxString const& aFootprint ); + void ShowFootprint( const wxString& aFootprint ); /** * Populate the footprint selector for a given alias. * * @param aLibId the #LIB_ID of the selection or invalid to clear. */ - void PopulateFootprintSelector( LIB_ID const& aLibId ); + void PopulateFootprintSelector( const LIB_ID& aLibId ); public: static std::mutex g_Mutex; diff --git a/eeschema/fields_grid_table.h b/eeschema/fields_grid_table.h index 03fbc82ce2..83e960a877 100644 --- a/eeschema/fields_grid_table.h +++ b/eeschema/fields_grid_table.h @@ -95,7 +95,7 @@ public: wxString GetValue( int aRow, int aCol ) override; bool GetValueAsBool( int aRow, int aCol ) override; - void SetValue( int aRow, int aCol, const wxString &aValue ) override; + void SetValue( int aRow, int aCol, const wxString& aValue ) override; void SetValueAsBool( int aRow, int aCol, bool aValue ) override; wxString StringFromBool( bool aValue ) const; diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index c198c1ee8f..b25ba9e402 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -270,7 +270,7 @@ wxString HIERARCHY_NAVIG_DLG::getRootString() } -wxString HIERARCHY_NAVIG_DLG::formatPageString( wxString aName, wxString aPage ) +wxString HIERARCHY_NAVIG_DLG::formatPageString( const wxString& aName, const wxString& aPage ) { return aName + wxT( " " ) + wxString::Format( _( "(page %s)" ), aPage ); } diff --git a/eeschema/hierarch.h b/eeschema/hierarch.h index 21c52a487d..5f2ea06f2f 100644 --- a/eeschema/hierarch.h +++ b/eeschema/hierarch.h @@ -101,7 +101,7 @@ private: /** * @return String with page number in parenthesis */ - wxString formatPageString( wxString aName, wxString aPage ); + wxString formatPageString( const wxString& aName, const wxString& aPage ); SCH_SHEET_PATH m_currSheet; SCH_SHEET_PATH m_list; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index e01c7a8190..184636e70a 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1148,7 +1148,7 @@ void SCH_SHEET::SetPageNumber( const SCH_SHEET_PATH& aInstance, const wxString& } -int SCH_SHEET::ComparePageNum( const wxString& aPageNumberA, const wxString aPageNumberB ) +int SCH_SHEET::ComparePageNum( const wxString& aPageNumberA, const wxString& aPageNumberB ) { if( aPageNumberA == aPageNumberB ) return 0; // A == B diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index c90f5d1659..ac518763e7 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -318,11 +318,12 @@ public: } // Set a new filename without changing anything else - void SetFileName( wxString aFilename ) + void SetFileName( const wxString& aFilename ) { // Filenames are stored using unix notation - aFilename.Replace( wxT("\\"), wxT("/") ); - m_fields[ SHEETFILENAME ].SetText( aFilename ); + wxString tmp = aFilename; + tmp.Replace( wxT( "\\" ), wxT( "/" ) ); + m_fields[ SHEETFILENAME ].SetText( tmp ); } // Geometric transforms (used in block operations): @@ -423,7 +424,7 @@ public: * * @return 0 if the page numbers are equal, -1 if aPageNumberA < aPageNumberB, 1 otherwise */ - static int ComparePageNum( const wxString& aPageNumberA, const wxString aPageNumberB ); + static int ComparePageNum( const wxString& aPageNumberA, const wxString& aPageNumberB ); #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override; diff --git a/eeschema/sch_validators.h b/eeschema/sch_validators.h index b59d81f4e0..e012be8509 100644 --- a/eeschema/sch_validators.h +++ b/eeschema/sch_validators.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com - * Copyright (C) 2016-2021 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -78,7 +78,7 @@ private: class SCH_NETNAME_VALIDATOR : public NETNAME_VALIDATOR { public: - SCH_NETNAME_VALIDATOR( wxString *aVal = nullptr ) : + SCH_NETNAME_VALIDATOR( wxString* aVal = nullptr ) : NETNAME_VALIDATOR( aVal ) { } diff --git a/eeschema/sim/sim_panel_base.cpp b/eeschema/sim/sim_panel_base.cpp index 9e51e8f776..c2efbf1864 100644 --- a/eeschema/sim/sim_panel_base.cpp +++ b/eeschema/sim/sim_panel_base.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. * @author Sylwester Kocjan * * This program is free software; you can redistribute it and/or @@ -34,12 +35,12 @@ SIM_PANEL_BASE::SIM_PANEL_BASE() : m_simCommand( wxEmptyString ) } -SIM_PANEL_BASE::SIM_PANEL_BASE( wxString aCommand ) : m_simCommand( aCommand ) +SIM_PANEL_BASE::SIM_PANEL_BASE( const wxString& aCommand ) : m_simCommand( aCommand ) { } -SIM_PANEL_BASE::SIM_PANEL_BASE( wxString aCommand, wxWindow* parent, wxWindowID id, +SIM_PANEL_BASE::SIM_PANEL_BASE( const wxString& aCommand, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxWindow( parent, id, pos, size, style, name ), @@ -74,7 +75,7 @@ SIM_TYPE SIM_PANEL_BASE::GetType() const } -SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( wxString aCommand, wxWindow* parent, wxWindowID id, +SIM_NOPLOT_PANEL::SIM_NOPLOT_PANEL( const wxString& aCommand, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ) diff --git a/eeschema/sim/sim_panel_base.h b/eeschema/sim/sim_panel_base.h index 90c320d8db..0e457fa346 100644 --- a/eeschema/sim/sim_panel_base.h +++ b/eeschema/sim/sim_panel_base.h @@ -39,8 +39,8 @@ class SIM_PANEL_BASE : public wxWindow public: SIM_PANEL_BASE(); - SIM_PANEL_BASE( wxString aCommand ); - SIM_PANEL_BASE( wxString aCommand, wxWindow* parent, wxWindowID id, + SIM_PANEL_BASE( const wxString& aCommand ); + SIM_PANEL_BASE( const wxString& aCommand, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr ); virtual ~SIM_PANEL_BASE(); @@ -72,7 +72,7 @@ private: class SIM_NOPLOT_PANEL : public SIM_PANEL_BASE { public: - SIM_NOPLOT_PANEL( wxString aCommand, wxWindow* parent, wxWindowID id, + SIM_NOPLOT_PANEL( const wxString& aCommand, wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr ); diff --git a/eeschema/sim/sim_plot_panel.cpp b/eeschema/sim/sim_plot_panel.cpp index ba1de261d7..9da0e3cc11 100644 --- a/eeschema/sim/sim_plot_panel.cpp +++ b/eeschema/sim/sim_plot_panel.cpp @@ -300,9 +300,9 @@ void CURSOR::UpdateReference() } -SIM_PLOT_PANEL::SIM_PLOT_PANEL( wxString aCommand, wxWindow* parent, SIM_PLOT_FRAME* aMainFrame, - wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) +SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aCommand, wxWindow* parent, + SIM_PLOT_FRAME* aMainFrame, wxWindowID id, const wxPoint& pos, + const wxSize& size, long style, const wxString& name ) : SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ), m_axis_x( nullptr ), m_axis_y1( nullptr ), diff --git a/eeschema/sim/sim_plot_panel.h b/eeschema/sim/sim_plot_panel.h index 7406502b92..17a7522216 100644 --- a/eeschema/sim/sim_plot_panel.h +++ b/eeschema/sim/sim_plot_panel.h @@ -178,9 +178,10 @@ class SIM_PLOT_PANEL : public SIM_PANEL_BASE friend class SIM_WORKBOOK; public: - SIM_PLOT_PANEL( wxString aCommand, wxWindow* parent, SIM_PLOT_FRAME* aMainFrame, wxWindowID id, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = wxPanelNameStr ); + SIM_PLOT_PANEL( const wxString& aCommand, wxWindow* parent, SIM_PLOT_FRAME* aMainFrame, + wxWindowID id, const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, long style = 0, + const wxString& name = wxPanelNameStr ); virtual ~SIM_PLOT_PANEL(); diff --git a/eeschema/sim/spice_settings.h b/eeschema/sim/spice_settings.h index c7e46e9697..b80052748c 100644 --- a/eeschema/sim/spice_settings.h +++ b/eeschema/sim/spice_settings.h @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2021 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. * * @author Wayne Stambaugh * @@ -44,7 +45,7 @@ public: bool operator!=( const SPICE_SIMULATOR_SETTINGS& aRhs ) const { return !( *this == aRhs ); } wxString GetWorkbookFilename() const { return m_workbookFilename; } - void SetWorkbookFilename( wxString aFilename ) { m_workbookFilename = aFilename; } + void SetWorkbookFilename( const wxString& aFilename ) { m_workbookFilename = aFilename; } bool GetFixPassiveVals() const { return m_fixPassiveVals; } void SetFixPassiveVals( bool aFixPassiveVals ) diff --git a/eeschema/widgets/symbol_preview_widget.h b/eeschema/widgets/symbol_preview_widget.h index 9bddedce1a..cf81b447df 100644 --- a/eeschema/widgets/symbol_preview_widget.h +++ b/eeschema/widgets/symbol_preview_widget.h @@ -51,7 +51,7 @@ public: /** * Set the contents of the status label and display it. */ - void SetStatusText( wxString const& aText ); + void SetStatusText( const wxString& aText ); /** * Set the currently displayed symbol. diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp index b18a44a54a..ed7ba0d740 100644 --- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp +++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp @@ -75,7 +75,8 @@ BEGIN_EVENT_TABLE( SELECT_LAYER_DIALOG, wxDialog ) END_EVENT_TABLE() -int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, wxString aGerberName ) +int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, + const wxString& aGerberName ) { SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount, aGerberName ); diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 0031106b5f..7889804c0c 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -448,7 +448,7 @@ public: * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), * or -1 if canceled */ - int SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, wxString aGerberName ); + int SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, const wxString& aGerberName ); /** * @return the color of the grid diff --git a/include/confirm.h b/include/confirm.h index abfd8c1d6b..20cd4258ac 100644 --- a/include/confirm.h +++ b/include/confirm.h @@ -105,7 +105,7 @@ bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage, * written back to the bool. * @return wxID_YES, wxID_CANCEL, wxID_NO. */ -int UnsavedChangesDialog( wxWindow* aParent, wxString aMessage, bool* aApplyToAll ); +int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage, bool* aApplyToAll ); int UnsavedChangesDialog( wxWindow* aParent, const wxString& aMessage ); @@ -169,8 +169,9 @@ bool IsOK( wxWindow* aParent, const wxString& aMessage ); * @return wxID_OK or wxID_CANCEL depending on the button the user selected. */ int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, - wxString aDetailedMessage = wxEmptyString, wxString aOKLabel = wxEmptyString, - wxString aCancelLabel = wxEmptyString, bool* aApplyToAll = nullptr ); + const wxString& aDetailedMessage = wxEmptyString, + const wxString& aOKLabel = wxEmptyString, + const wxString& aCancelLabel = wxEmptyString, bool* aApplyToAll = nullptr ); diff --git a/include/dialogs/panel_setup_netclasses.h b/include/dialogs/panel_setup_netclasses.h index 51f6c0449b..b74dcad6e7 100644 --- a/include/dialogs/panel_setup_netclasses.h +++ b/include/dialogs/panel_setup_netclasses.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2019 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,14 +34,17 @@ class NETCLASSES; class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE { -private: - PAGED_DIALOG* m_Parent; - NETCLASSES* m_netclasses; - std::vector m_netNames; +public: + PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses, + const std::vector& aNetNames, bool isEEschema ); + ~PANEL_SETUP_NETCLASSES( ) override; - int* m_originalColWidths; - bool m_netclassesDirty; // The netclass drop-down menus need rebuilding - int m_hoveredCol; // Column being hovered over, for tooltips + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + bool Validate() override; + + void ImportSettingsFrom( NETCLASSES* aBoard ); private: void OnAddNetclassClick( wxCommandEvent& event ) override; @@ -57,7 +60,7 @@ private: void OnAssignAll( wxCommandEvent& event ) override { doAssignments( true ); } void OnAssignSelected( wxCommandEvent& event ) override { doAssignments( false ); } - bool validateNetclassName( int aRow, wxString aName, bool focusFirst = true ); + bool validateNetclassName( int aRow, const wxString& aName, bool focusFirst = true ); void rebuildNetclassDropdowns(); @@ -68,17 +71,13 @@ private: void AdjustNetclassGridColumns( int aWidth ); void AdjustMembershipGridColumns( int aWidth ); -public: - PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses, - const std::vector& aNetNames, bool isEEschema ); - ~PANEL_SETUP_NETCLASSES( ) override; + PAGED_DIALOG* m_Parent; + NETCLASSES* m_netclasses; + std::vector m_netNames; - bool TransferDataToWindow() override; - bool TransferDataFromWindow() override; - - bool Validate() override; - - void ImportSettingsFrom( NETCLASSES* aBoard ); + int* m_originalColWidths; + bool m_netclassesDirty; // The netclass drop-down menus need rebuilding + int m_hoveredCol; // Column being hovered over, for tooltips }; #endif //PANEL_SETUP_NETCLASSES_H diff --git a/include/eda_pattern_match.h b/include/eda_pattern_match.h index d543279cbd..0d1b040a7f 100644 --- a/include/eda_pattern_match.h +++ b/include/eda_pattern_match.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -170,7 +170,7 @@ protected: class EDA_COMBINED_MATCHER { public: - EDA_COMBINED_MATCHER( const wxString &aPattern ); + EDA_COMBINED_MATCHER( const wxString& aPattern ); /* * Look in all existing matchers, return the earliest match of any of @@ -182,13 +182,13 @@ public: * * @return true if any matchers found the term */ - bool Find( const wxString &aTerm, int& aMatchersTriggered, int& aPosition ); + bool Find( const wxString& aTerm, int& aMatchersTriggered, int& aPosition ); - wxString const& GetPattern() const; + const wxString& GetPattern() const; private: // Add matcher if it can compile the pattern. - void AddMatcher( const wxString &aPattern, std::unique_ptr aMatcher ); + void AddMatcher( const wxString& aPattern, std::unique_ptr aMatcher ); std::vector> m_matchers; wxString m_pattern; diff --git a/include/filehistory.h b/include/filehistory.h index cd1daac902..6c95b3b0c8 100644 --- a/include/filehistory.h +++ b/include/filehistory.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Ian McInerney - * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -90,7 +90,7 @@ public: * * @param aFile is the filename of the file to add to the history. */ - void AddFileToHistory( const wxString &aFile ) override; + void AddFileToHistory( const wxString& aFile ) override; /** * Add the files to all registered menus. diff --git a/include/footprint_filter.h b/include/footprint_filter.h index ca884947af..c07af4aa71 100644 --- a/include/footprint_filter.h +++ b/include/footprint_filter.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -58,7 +58,7 @@ public: /** * Add library name to filter criteria. */ - void FilterByLibrary( wxString const& aLibName ); + void FilterByLibrary( const wxString& aLibName ); /** * Set a pin count to filter by. @@ -68,13 +68,13 @@ public: /** * Set a list of footprint filters to filter by. */ - void FilterByFootprintFilters( wxArrayString const& aFilters ); + void FilterByFootprintFilters( const wxArrayString& aFilters ); /** * Add a pattern to filter by name, including wildcards and optionally a colon-delimited * library name. */ - void FilterByTextPattern( wxString const& aPattern ); + void FilterByTextPattern( const wxString& aPattern ); /** * Inner iterator class returned by begin() and end(). @@ -84,7 +84,7 @@ public: { public: ITERATOR(); - ITERATOR( ITERATOR const& aOther ); + ITERATOR( const ITERATOR& aOther ); ITERATOR( FOOTPRINT_FILTER& aFilter ); private: @@ -92,7 +92,7 @@ public: friend class FOOTPRINT_FILTER; void increment(); - bool equal( ITERATOR const& aOther ) const; + bool equal( const ITERATOR& aOther ) const; FOOTPRINT_INFO& dereference() const; size_t m_pos; diff --git a/include/footprint_info.h b/include/footprint_info.h index a4bef76d9e..24ea31058c 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -273,7 +273,7 @@ protected: * Launch worker threads to load footprints. Part of the #FOOTPRINT_ASYNC_LOADER * implementation. */ - virtual void startWorkers( FP_LIB_TABLE* aTable, wxString const* aNickname, + virtual void startWorkers( FP_LIB_TABLE* aTable, const wxString* aNickname, FOOTPRINT_ASYNC_LOADER* aLoader, unsigned aNThreads ) = 0; /** @@ -327,7 +327,7 @@ public: * all known libraries in \a aTable. * @param aNThreads is the number of worker threads. */ - void Start( FP_LIB_TABLE* aTable, wxString const* aNickname = nullptr, + void Start( FP_LIB_TABLE* aTable, const wxString* aNickname = nullptr, unsigned aNThreads = DEFAULT_THREADS ); /** diff --git a/include/gr_basic.h b/include/gr_basic.h index 92b08f88d3..351ad26649 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -242,6 +242,6 @@ void GRDrawAnchor( EDA_RECT* aClipBox, wxDC* aDC, int x, int y, int aSize, const * @param aDC wxDC instance onto which the text will be drawn. * @param aText the text to draw. */ -void GRDrawWrappedText( wxDC& aDC, wxString const& aText ); +void GRDrawWrappedText( wxDC& aDC, const wxString& aText ); #endif /* define GR_BASIC */ diff --git a/include/kicad_string.h b/include/kicad_string.h index 75df0c39bd..e2fcab7c24 100644 --- a/include/kicad_string.h +++ b/include/kicad_string.h @@ -180,7 +180,7 @@ bool WildCompareString( const wxString& pattern, * @return -1 if first string is less than the second, 0 if the strings are equal, or * 1 if the first string is greater than the second. */ -int ValueStringCompare( wxString strFWord, wxString strSWord ); +int ValueStringCompare( const wxString& strFWord, const wxString& strSWord ); /** * Break a string into three parts: he alphabetic preamble, the numeric part, and any diff --git a/include/lib_table_grid.h b/include/lib_table_grid.h index 196b6cf826..e7107d9c17 100644 --- a/include/lib_table_grid.h +++ b/include/lib_table_grid.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -85,7 +85,7 @@ public: return false; } - void SetValue( int aRow, int aCol, const wxString &aValue ) override + void SetValue( int aRow, int aCol, const wxString& aValue ) override { if( aRow < (int) size() ) { diff --git a/include/lib_tree_model.h b/include/lib_tree_model.h index b5d04ee6e4..b31726151f 100644 --- a/include/lib_tree_model.h +++ b/include/lib_tree_model.h @@ -3,7 +3,7 @@ * * Copyright (C) 2017 Chris Pavlina * Copyright (C) 2014 Henner Zeller - * Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -241,7 +241,7 @@ public: * @param aName display name of the library * @param aDesc a description of the library */ - LIB_TREE_NODE_LIB( LIB_TREE_NODE* aParent, wxString const& aName, wxString const& aDesc ); + LIB_TREE_NODE_LIB( LIB_TREE_NODE* aParent, const wxString& aName, const wxString& aDesc ); /** * Construct a new alias node, add it to this library, and return it. diff --git a/include/lib_tree_model_adapter.h b/include/lib_tree_model_adapter.h index 3e63aa4897..de5763f49c 100644 --- a/include/lib_tree_model_adapter.h +++ b/include/lib_tree_model_adapter.h @@ -156,7 +156,7 @@ public: * @param aLibId symbol #LIB_ID to be selected * @param aUnit unit to be selected, if > 0 (0 selects the alias itself) */ - void SetPreselectNode( LIB_ID const& aLibId, int aUnit ); + void SetPreselectNode( const LIB_ID& aLibId, int aUnit ); /** * Add the given list of symbols by alias. To be called in the setup @@ -166,8 +166,8 @@ public: * @param aDesc the description field of the parent node * @param aItemList list of symbols */ - void DoAddLibrary( wxString const& aNodeName, wxString const& aDesc, - std::vector const& aItemList, bool presorted ); + void DoAddLibrary( const wxString& aNodeName, const wxString& aDesc, + const std::vector& aItemList, bool presorted ); /** @@ -181,7 +181,7 @@ public: * @param aSearch full, unprocessed search text * @param aState if true, we are keeping the state and so we shouldn't collapse the tree */ - void UpdateSearchString( wxString const& aSearch, bool aState ); + void UpdateSearchString( const wxString& aSearch, bool aState ); /** * Attach to a wxDataViewCtrl and initialize it. This will set up columns @@ -230,7 +230,7 @@ public: LIB_TREE_NODE* GetTreeNodeFor( const wxDataViewItem& aSelection ) const; - virtual wxString GenerateInfo( LIB_ID const& aLibId, int aUnit ) { return wxEmptyString; }; + virtual wxString GenerateInfo( const LIB_ID& aLibId, int aUnit ) { return wxEmptyString; }; /** * Return the number of symbols loaded in the tree. @@ -258,7 +258,7 @@ public: * * @return number of children */ - unsigned int GetChildren( wxDataViewItem const& aItem, + unsigned int GetChildren( const wxDataViewItem& aItem, wxDataViewItemArray& aChildren ) const override; // Freezing/Thawing. Used when updating the table model so that we don't try and fetch @@ -277,7 +277,7 @@ protected: /** * Convert #SYM_TREE_NODE -> wxDataViewItem. */ - static wxDataViewItem ToItem( LIB_TREE_NODE const* aNode ); + static wxDataViewItem ToItem( const LIB_TREE_NODE* aNode ); /** * Convert wxDataViewItem -> #SYM_TREE_NODE. @@ -287,7 +287,7 @@ protected: /** * Convert SYM_TREE_NODE's children to wxDataViewItemArray. */ - static unsigned int IntoArray( LIB_TREE_NODE const& aNode, wxDataViewItemArray& aChildren ); + static unsigned int IntoArray( const LIB_TREE_NODE& aNode, wxDataViewItemArray& aChildren ); /** * Create the adapter. @@ -295,26 +295,26 @@ protected: * @param aParent is the parent frame * @param aPinnedKey is the key to load the pinned libraries list from the project file */ - LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, wxString aPinnedKey ); + LIB_TREE_MODEL_ADAPTER( EDA_BASE_FRAME* aParent, const wxString& aPinnedKey ); - LIB_TREE_NODE_LIB& DoAddLibraryNode( wxString const& aNodeName, wxString const& aDesc ); + LIB_TREE_NODE_LIB& DoAddLibraryNode( const wxString& aNodeName, const wxString& aDesc ); /** * Check whether a container has columns too */ - bool HasContainerColumns( wxDataViewItem const& aItem ) const override; + bool HasContainerColumns( const wxDataViewItem& aItem ) const override; /** * Check whether an item can have children. */ - bool IsContainer( wxDataViewItem const& aItem ) const override; + bool IsContainer( const wxDataViewItem& aItem ) const override; /** * Get the parent of an item. * * @return parent of aItem, or an invalid wxDataViewItem if parent is root */ - wxDataViewItem GetParent( wxDataViewItem const& aItem ) const override; + wxDataViewItem GetParent( const wxDataViewItem& aItem ) const override; unsigned int GetColumnCount() const override { return NUM_COLS; } @@ -331,15 +331,15 @@ protected: * @param aCol column number of the data */ void GetValue( wxVariant& aVariant, - wxDataViewItem const& aItem, + const wxDataViewItem& aItem, unsigned int aCol ) const override; /** * Set the value of an item. Does nothing - this model doesn't support * editing. */ - bool SetValue( wxVariant const& aVariant, - wxDataViewItem const& aItem, + bool SetValue( const wxVariant& aVariant, + const wxDataViewItem& aItem, unsigned int aCol ) override { return false; } /** @@ -350,7 +350,7 @@ protected: * @param aAttr receiver for attributes * @return true if the item has non-default attributes */ - bool GetAttr( wxDataViewItem const& aItem, + bool GetAttr( const wxDataViewItem& aItem, unsigned int aCol, wxDataViewItemAttr& aAttr ) const override; @@ -369,7 +369,7 @@ private: * Find any results worth highlighting and expand them, according to given criteria * The highest-scoring node is written to aHighScore */ - void FindAndExpand( LIB_TREE_NODE& aNode, std::function aFunc, + void FindAndExpand( LIB_TREE_NODE& aNode, std::function aFunc, LIB_TREE_NODE** aHighScore ); /** diff --git a/include/pcb_group.h b/include/pcb_group.h index 0f426f5cdb..80c7b50ba8 100644 --- a/include/pcb_group.h +++ b/include/pcb_group.h @@ -63,7 +63,7 @@ public: } wxString GetName() const { return m_name; } - void SetName( wxString aName ) { m_name = aName; } + void SetName( const wxString& aName ) { m_name = aName; } std::unordered_set& GetItems() { @@ -125,7 +125,7 @@ public: } /** Set layer for all items within the group. - * + * * To avoid freezes with circular references, the maximum depth is 20 by default. */ void SetLayerRecursive( PCB_LAYER_ID aLayer, int aDepth ); diff --git a/include/settings/color_settings.h b/include/settings/color_settings.h index b0a554d438..fa54edd902 100644 --- a/include/settings/color_settings.h +++ b/include/settings/color_settings.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -58,7 +58,7 @@ public: */ std::vector m_Palette; - explicit COLOR_SETTINGS( wxString aFilename = "user" ); + explicit COLOR_SETTINGS( const wxString& aFilename = wxT( "user" ) ); virtual ~COLOR_SETTINGS() {} diff --git a/include/settings/parameters.h b/include/settings/parameters.h index 17a2b494b0..7e8f163027 100644 --- a/include/settings/parameters.h +++ b/include/settings/parameters.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Jon Evans - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -173,7 +173,7 @@ protected: class PARAM_PATH : public PARAM { public: - PARAM_PATH( const std::string& aJsonPath, wxString* aPtr, wxString aDefault, + PARAM_PATH( const std::string& aJsonPath, wxString* aPtr, const wxString& aDefault, bool aReadOnly = false ) : PARAM( aJsonPath, aPtr, aDefault, aReadOnly ) { } diff --git a/include/tool/action_menu.h b/include/tool/action_menu.h index 8d99ecabcb..cf43deb32c 100644 --- a/include/tool/action_menu.h +++ b/include/tool/action_menu.h @@ -115,7 +115,7 @@ public: * * @param aAppname is the application name to append to the tooltip. */ - void AddClose( wxString aAppname = "" ); + void AddClose( const wxString& aAppname = "" ); /** * Add either a standard Quit or Close item to the menu. diff --git a/include/validators.h b/include/validators.h index cdb1c20fe8..5422dca106 100644 --- a/include/validators.h +++ b/include/validators.h @@ -194,7 +194,7 @@ public: class NETNAME_VALIDATOR : public wxTextValidator { public: - NETNAME_VALIDATOR( wxString *aVal = nullptr ); + NETNAME_VALIDATOR( wxString* aVal = nullptr ); NETNAME_VALIDATOR( bool aAllowSpaces ); diff --git a/include/widgets/footprint_choice.h b/include/widgets/footprint_choice.h index 5ee5b4b994..a8bf7b0a24 100644 --- a/include/widgets/footprint_choice.h +++ b/include/widgets/footprint_choice.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -44,14 +44,14 @@ public: protected: virtual void DoSetPopupControl( wxComboPopup* aPopup ) override; - virtual void OnDrawItem( wxDC& aDC, wxRect const& aRect, int aItem, int aFlags ) const override; + virtual void OnDrawItem( wxDC& aDC, const wxRect& aRect, int aItem, int aFlags ) const override; virtual wxCoord OnMeasureItem( size_t aItem ) const override; virtual wxCoord OnMeasureItemWidth( size_t aItem ) const override; /** * Draw a fragment of text, then return the next x coordinate to continue drawing. */ - static wxCoord DrawTextFragment( wxDC& aDC, wxCoord x, wxCoord y, wxString const& aText ); + static wxCoord DrawTextFragment( wxDC& aDC, wxCoord x, wxCoord y, const wxString& aText ); /// Veto a mouseover event if in the separator void TryVetoMouse( wxMouseEvent& aEvent ); diff --git a/include/widgets/footprint_preview_widget.h b/include/widgets/footprint_preview_widget.h index 5990a7130f..c81c9bddf5 100644 --- a/include/widgets/footprint_preview_widget.h +++ b/include/widgets/footprint_preview_widget.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017 Chris Pavlina * * This program is free software: you can redistribute it and/or modify it @@ -57,7 +57,7 @@ public: /** * Set the contents of the status label and display it. */ - void SetStatusText( wxString const& aText ); + void SetStatusText( const wxString& aText ); /** * Clear the contents of the status label and hide it. diff --git a/include/widgets/footprint_select_widget.h b/include/widgets/footprint_select_widget.h index e6629c495b..2e0da07bfe 100644 --- a/include/widgets/footprint_select_widget.h +++ b/include/widgets/footprint_select_widget.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -95,13 +95,13 @@ public: * @param aZeroFilters - if true, zero filters = zero footprints. If false, zero filters = * not filtering. */ - void FilterByFootprintFilters( wxArrayString const& aFilters, bool aZeroFilters ); + void FilterByFootprintFilters( const wxArrayString& aFilters, bool aZeroFilters ); /** * Set the default footprint for a part. This will be listed at the * top. May be an empty string. */ - void SetDefaultFootprint( wxString const& aFp ); + void SetDefaultFootprint( const wxString& aFp ); /** * Update the contents of the list to match the filters. Has no effect if diff --git a/include/widgets/grid_combobox.h b/include/widgets/grid_combobox.h index 9a32a7e430..b3913d15e7 100644 --- a/include/widgets/grid_combobox.h +++ b/include/widgets/grid_combobox.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -45,7 +45,7 @@ public: void SetSize( const wxRect& aRect ) override; void BeginEdit( int aRow, int aCol, wxGrid* aGrid ) override; - bool EndEdit( int , int , const wxGrid* , const wxString& , wxString *aNewVal ) override; + bool EndEdit( int aRow, int aCol, const wxGrid*, const wxString&, wxString* aNewVal ) override; void ApplyEdit( int aRow, int aCol, wxGrid* aGrid ) override; void Reset() override; diff --git a/include/widgets/grid_text_button_helpers.h b/include/widgets/grid_text_button_helpers.h index 043910ff09..a446edc2bc 100644 --- a/include/widgets/grid_text_button_helpers.h +++ b/include/widgets/grid_text_button_helpers.h @@ -149,7 +149,7 @@ public: */ GRID_CELL_PATH_EDITOR( DIALOG_SHIM* aParentDialog, WX_GRID* aGrid, wxString* aCurrentDir, const wxString& aExt, bool aNormalize = false, - wxString aNormalizeBasePath = wxEmptyString ) : + const wxString& aNormalizeBasePath = wxEmptyString ) : m_dlg( aParentDialog ), m_grid( aGrid ), m_currentDir( aCurrentDir ), diff --git a/include/widgets/msgpanel.h b/include/widgets/msgpanel.h index 6dccaeeadd..fb42318f52 100644 --- a/include/widgets/msgpanel.h +++ b/include/widgets/msgpanel.h @@ -105,7 +105,7 @@ class EDA_MSG_PANEL : public wxPanel public: EDA_MSG_PANEL( wxWindow* aParent, int aId, const wxPoint& aPosition, const wxSize& aSize, - long style=wxTAB_TRAVERSAL, const wxString &name=wxPanelNameStr); + long style=wxTAB_TRAVERSAL, const wxString& name=wxPanelNameStr); ~EDA_MSG_PANEL(); /** diff --git a/include/widgets/unit_binder.h b/include/widgets/unit_binder.h index d9ff3253be..dec3712365 100644 --- a/include/widgets/unit_binder.h +++ b/include/widgets/unit_binder.h @@ -86,7 +86,7 @@ public: */ virtual void SetValue( int aValue ); - void SetValue( wxString aValue ); + void SetValue( const wxString& aValue ); /** * Set new value (in Internal Units) for the text field, taking care of units conversion. diff --git a/kicad/import_project.cpp b/kicad/import_project.cpp index 4a432f512e..8aa1aea2b9 100644 --- a/kicad/import_project.cpp +++ b/kicad/import_project.cpp @@ -51,8 +51,11 @@ #include "kicad_manager_frame.h" -void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString aFilesWildcard, - wxString aSchFileExtension, wxString aPcbFileExtension, int aSchFileType, int aPcbFileType ) +void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle, + const wxString& aFilesWildcard, + const wxString& aSchFileExtension, + const wxString& aPcbFileExtension, + int aSchFileType, int aPcbFileType ) { wxString msg; wxString default_dir = GetMruPath(); diff --git a/kicad/kicad_manager_frame.h b/kicad/kicad_manager_frame.h index 87ea0baaec..2c32bd5d4d 100644 --- a/kicad/kicad_manager_frame.h +++ b/kicad/kicad_manager_frame.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 CERN (www.cern.ch) - * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -71,19 +71,20 @@ public: return GetProjectFileName(); } - /** * @brief Creates a project and imports a non-KiCad Schematic and PCB * @param aWindowTitle to display to the user when opening the files - * @param aFilesWildcard that includes both PCB and Schematic files (from wildcards_and_files_ext.h) + * @param aFilesWildcard that includes both PCB and Schematic files (from + * wildcards_and_files_ext.h) * @param aSchFileExtension e.g. "sch" or "csa" * @param aPcbFileExtension e.g. "brd" or "cpa" * @param aSchFileType Type of Schematic File to import (from SCH_IO_MGR::SCH_FILE_T) * @param aPcbFileType Type of PCB File to import (from IO_MGR::PCB_FILE_T) */ - void ImportNonKiCadProject( wxString aWindowTitle, wxString aFilesWildcard, - wxString aSchFileExtension, wxString aPcbFileExtension, int aSchFileType, - int aPcbFileType ); + void ImportNonKiCadProject( const wxString& aWindowTitle, const wxString& aFilesWildcard, + const wxString& aSchFileExtension, + const wxString& aPcbFileExtension, int aSchFileType, + int aPcbFileType ); /** * Open dialog to import CADSTAR Schematic and PCB Archive files. diff --git a/pcb_calculator/class_regulator_data.h b/pcb_calculator/class_regulator_data.h index d62eee846b..86449fbf39 100644 --- a/pcb_calculator/class_regulator_data.h +++ b/pcb_calculator/class_regulator_data.h @@ -100,7 +100,7 @@ public: return nullptr; } - void Remove( const wxString & aRegName ) + void Remove( const wxString& aRegName ) { for( unsigned ii = 0; ii < m_List.size(); ii++ ) { diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index f4a0adea43..4e6944ac88 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -470,7 +470,7 @@ wxString DIALOG_BOARD_REANNOTATE::CoordTowxString( int aX, int aY ) } -void DIALOG_BOARD_REANNOTATE::ShowReport( wxString aMessage, SEVERITY aSeverity ) +void DIALOG_BOARD_REANNOTATE::ShowReport( const wxString& aMessage, SEVERITY aSeverity ) { size_t pos = 0, prev = 0; @@ -790,7 +790,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector& aBadR void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector& aFootprints, - unsigned int aStartRefDes, wxString aPrefix, + unsigned int aStartRefDes, const wxString& aPrefix, bool aRemovePrefix, std::vector& aBadRefDes ) { diff --git a/pcbnew/dialogs/dialog_board_reannotate.h b/pcbnew/dialogs/dialog_board_reannotate.h index 5695021426..b11e573f1d 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.h +++ b/pcbnew/dialogs/dialog_board_reannotate.h @@ -143,7 +143,7 @@ private: void FilterBackPrefix( wxCommandEvent& event ) override; /// Break report into strings separated by \n and sent to the reporter. - void ShowReport( wxString aMessage, SEVERITY aSeverity ); + void ShowReport( const wxString& aMessage, SEVERITY aSeverity ); /// Create a list of the footprints and their coordinates. void LogFootprints( const wxString& aMessage, const std::vector& aFootprints ); @@ -161,7 +161,7 @@ private: /// Scan through the footprint arrays and create the from -> to array. void BuildChangeArray( std::vector& aFootprints, unsigned int aStartRefDes, - wxString aPrefix, bool aRemovePrefix, + const wxString& aPrefix, bool aRemovePrefix, std::vector& aBadRefDes ); /// @return the new reference for this footprint. diff --git a/pcbnew/dialogs/dialog_board_statistics.h b/pcbnew/dialogs/dialog_board_statistics.h index ef076bdd5d..125a4be8ad 100644 --- a/pcbnew/dialogs/dialog_board_statistics.h +++ b/pcbnew/dialogs/dialog_board_statistics.h @@ -50,7 +50,7 @@ public: template struct typeContainer_t { - typeContainer_t( T aAttribute, wxString aTitle ) + typeContainer_t( T aAttribute, const wxString& aTitle ) : attribute( aAttribute ), title( aTitle ), qty( 0 ) diff --git a/pcbnew/dialogs/dialog_imported_layers.cpp b/pcbnew/dialogs/dialog_imported_layers.cpp index 7f58d8bc52..23c7e30b61 100644 --- a/pcbnew/dialogs/dialog_imported_layers.cpp +++ b/pcbnew/dialogs/dialog_imported_layers.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Roberto Fernandez Bautista - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -24,27 +24,33 @@ #include + wxString DIALOG_IMPORTED_LAYERS::WrapRequired( const wxString& aLayerName ) { return aLayerName + " *"; } + wxString DIALOG_IMPORTED_LAYERS::UnwrapRequired( const wxString& aLayerName ) { if( !aLayerName.EndsWith( " *" ) ) return aLayerName; + return aLayerName.Left( aLayerName.Length() - 2 ); } + const INPUT_LAYER_DESC* DIALOG_IMPORTED_LAYERS::GetLayerDescription( const wxString& aLayerName ) const { wxString layerName = UnwrapRequired( aLayerName ); + for( const INPUT_LAYER_DESC& layerDescription : m_input_layers ) { if( layerDescription.Name == layerName ) return &layerDescription; } + return nullptr; } @@ -80,7 +86,7 @@ PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetSelectedLayerID() } -PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetAutoMatchLayerID( wxString aInputLayerName ) +PCB_LAYER_ID DIALOG_IMPORTED_LAYERS::GetAutoMatchLayerID( const wxString& aInputLayerName ) { wxString pureInputLayerName = UnwrapRequired( aInputLayerName ); for( INPUT_LAYER_DESC inputLayerDesc : m_input_layers ) @@ -299,22 +305,27 @@ DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS( wxWindow* aParent, finishDialogSettings(); } + std::vector DIALOG_IMPORTED_LAYERS::GetUnmappedRequiredLayers() const { std::vector unmappedLayers; + for( const wxString& layerName : m_unmatched_layer_names ) { const INPUT_LAYER_DESC* layerDesc = GetLayerDescription( layerName ); wxASSERT_MSG( layerDesc != nullptr, "Expected to find layer description" ); + if( layerDesc->Required ) unmappedLayers.push_back( layerDesc->Name ); } + return unmappedLayers; } -std::map DIALOG_IMPORTED_LAYERS::GetMapModal( wxWindow* aParent, - const std::vector& aLayerDesc ) +std::map + DIALOG_IMPORTED_LAYERS::GetMapModal( wxWindow* aParent, + const std::vector& aLayerDesc ) { DIALOG_IMPORTED_LAYERS dlg( aParent, aLayerDesc ); bool dataOk = false; @@ -328,7 +339,7 @@ std::map DIALOG_IMPORTED_LAYERS::GetMapModal( wxWindow* wxMessageBox( _( "All required layers (marked with '*') must be matched. " "Please click on 'Auto-Match Layers' to " "automatically match the remaining layers" ), - _( "Unmatched Layers" ), wxICON_ERROR | wxOK ); + _( "Unmatched Layers" ), wxICON_ERROR | wxOK ); } else { diff --git a/pcbnew/dialogs/dialog_imported_layers.h b/pcbnew/dialogs/dialog_imported_layers.h index 1c3be71467..a1af6cc8b5 100644 --- a/pcbnew/dialogs/dialog_imported_layers.h +++ b/pcbnew/dialogs/dialog_imported_layers.h @@ -49,7 +49,7 @@ public: private: //Helper functions PCB_LAYER_ID GetSelectedLayerID(); - PCB_LAYER_ID GetAutoMatchLayerID( wxString aInputLayerName ); + PCB_LAYER_ID GetAutoMatchLayerID( const wxString& aInputLayerName ); void AddMappings(); void RemoveMappings( int aStatus ); diff --git a/pcbnew/footprint_info_impl.h b/pcbnew/footprint_info_impl.h index 329a2d1e15..cf5a954aa2 100644 --- a/pcbnew/footprint_info_impl.h +++ b/pcbnew/footprint_info_impl.h @@ -94,7 +94,7 @@ public: PROGRESS_REPORTER* aProgressReporter = nullptr ) override; protected: - void startWorkers( FP_LIB_TABLE* aTable, wxString const* aNickname, + void startWorkers( FP_LIB_TABLE* aTable, const wxString* aNickname, FOOTPRINT_ASYNC_LOADER* aLoader, unsigned aNThreads ) override; bool joinWorkers() override; diff --git a/pcbnew/fp_text_grid_table.h b/pcbnew/fp_text_grid_table.h index bdea262307..ec8e965e8a 100644 --- a/pcbnew/fp_text_grid_table.h +++ b/pcbnew/fp_text_grid_table.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -76,7 +76,7 @@ public: bool GetValueAsBool( int aRow, int aCol ) override; long GetValueAsLong( int aRow, int aCol ) override; - void SetValue( int aRow, int aCol, const wxString &aValue ) override; + void SetValue( int aRow, int aCol, const wxString& aValue ) override; void SetValueAsBool( int aRow, int aCol, bool aValue ) override; void SetValueAsLong( int aRow, int aCol, long aValue ) override; diff --git a/pcbnew/import_gfx/dxf_import_plugin.h b/pcbnew/import_gfx/dxf_import_plugin.h index a01cf088c4..8db120ea94 100644 --- a/pcbnew/import_gfx/dxf_import_plugin.h +++ b/pcbnew/import_gfx/dxf_import_plugin.h @@ -124,7 +124,7 @@ public: wxString m_layerName; int m_lineWeight; - DXF_IMPORT_LAYER( wxString aName, int aLineWeight ) + DXF_IMPORT_LAYER( const wxString& aName, int aLineWeight ) { m_layerName = aName; m_lineWeight = aLineWeight; @@ -142,7 +142,7 @@ public: GRAPHICS_IMPORTER_BUFFER m_buffer; - DXF_IMPORT_BLOCK( wxString aName, double aX, double aY ) + DXF_IMPORT_BLOCK( const wxString& aName, double aX, double aY ) { m_name = aName; m_baseX = aX; @@ -162,7 +162,7 @@ public: bool m_bold; bool m_italic; - DXF_IMPORT_STYLE( wxString aName, double aTextHeight, double aWidthFactor, bool aBold, + DXF_IMPORT_STYLE( const wxString& aName, double aTextHeight, double aWidthFactor, bool aBold, bool aItalic ) { m_name = aName; diff --git a/pcbnew/import_gfx/graphics_importer.h b/pcbnew/import_gfx/graphics_importer.h index 22a011d402..b14c2dd19e 100644 --- a/pcbnew/import_gfx/graphics_importer.h +++ b/pcbnew/import_gfx/graphics_importer.h @@ -66,7 +66,7 @@ public: * Load file and get its basic data * */ - bool Load( const wxString &aFileName ); + bool Load( const wxString& aFileName ); /** diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 48afc18741..00ef3a14b2 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -581,7 +581,7 @@ public: * @param aReporter is a #REPORTER object to display messages. * @return true if the netlist was read successfully. */ - bool ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist, REPORTER& aReporter ); + bool ReadNetlistFromFile( const wxString& aFilename, NETLIST& aNetlist, REPORTER& aReporter ); /** * Called after netlist is updated. diff --git a/pcbnew/pcb_expr_evaluator.h b/pcbnew/pcb_expr_evaluator.h index 0540ccc72f..fe288a679d 100644 --- a/pcbnew/pcb_expr_evaluator.h +++ b/pcbnew/pcb_expr_evaluator.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,7 +43,8 @@ public: PCB_EXPR_UCODE() {}; virtual ~PCB_EXPR_UCODE() {}; - virtual std::unique_ptr CreateVarRef( const wxString& aVar, const wxString& aField ) override; + virtual std::unique_ptr CreateVarRef( const wxString& aVar, + const wxString& aField ) override; virtual LIBEVAL::FUNC_CALL_REF CreateFuncCall( const wxString& aName ) override; }; @@ -157,7 +158,7 @@ public: return self; } - LIBEVAL::FUNC_CALL_REF Get( const wxString &name ) + LIBEVAL::FUNC_CALL_REF Get( const wxString& name ) { return m_funcs[ name ]; } diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index c01abeb251..059dcb7dd7 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -136,7 +136,7 @@ public: void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; } PLOT_FORMAT GetFormat() const { return m_format; } - void SetOutputDirectory( wxString aDir ) { m_outputDirectory = aDir; } + void SetOutputDirectory( const wxString& aDir ) { m_outputDirectory = aDir; } wxString GetOutputDirectory() const { return m_outputDirectory; } void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; } diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index b8e07da180..7da57e5536 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019-2020 Thomas Pointhuber + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1391,7 +1392,7 @@ void ALTIUM_PCB::ParseDimensions6Data( const CFB::CompoundFileReader& aReader, void ALTIUM_PCB::ParseModelsData( const CFB::CompoundFileReader& aReader, - const CFB::COMPOUND_FILE_ENTRY* aEntry, const wxString aRootDir ) + const CFB::COMPOUND_FILE_ENTRY* aEntry, const wxString& aRootDir ) { if( m_progressReporter ) m_progressReporter->Report( "Loading 3D models..." ); diff --git a/pcbnew/plugins/altium/altium_pcb.h b/pcbnew/plugins/altium/altium_pcb.h index 0086b097de..f9b655ab8e 100644 --- a/pcbnew/plugins/altium/altium_pcb.h +++ b/pcbnew/plugins/altium/altium_pcb.h @@ -144,7 +144,7 @@ private: void ParseDimensions6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ); void ParseModelsData( const CFB::CompoundFileReader& aReader, - const CFB::COMPOUND_FILE_ENTRY* aEntry, const wxString aRootDir ); + const CFB::COMPOUND_FILE_ENTRY* aEntry, const wxString& aRootDir ); void ParseNets6Data( const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ); void ParsePolygons6Data( diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.h index 714e615f7a..ee54dd27ca 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_parser.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Roberto Fernandez Bautista - * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -42,7 +42,7 @@ class CADSTAR_PCB_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_PARSER { public: - explicit CADSTAR_PCB_ARCHIVE_PARSER( wxString aFilename ) + explicit CADSTAR_PCB_ARCHIVE_PARSER( const wxString& aFilename ) : Filename( aFilename ), Header(), Assignments(), CADSTAR_ARCHIVE_PARSER() { KiCadUnitMultiplier = 10; // assume hundredth micron @@ -474,8 +474,8 @@ public: /** * @brief From CADSTAR Help: "This parameter indicates the physical layers on which the selected - * pad is placed. Note: When you change the Side parameter in PCB Design, the Side assigned to the - * pad in the library is not overwritten." + * pad is placed. Note: When you change the Side parameter in PCB Design, the Side assigned to + * the pad in the library is not overwritten." */ enum class PAD_SIDE { @@ -490,14 +490,14 @@ public: static PAD_SIDE GetPadSide( const wxString& aPadSideString ); /** - * @brief From CADSTAR help: "For specifying the directions in which routes can enter or exit the - * pad. There are eight pre-defined directions to choose from, North, South, East, West, - * North-East, North-West, South-East and South-West, plus "Free Angle" which allows routes to exit - * in any direction. + * @brief From CADSTAR help: "For specifying the directions in which routes can enter or exit + * the pad. There are eight pre-defined directions to choose from, North, South, East, West, + * North-East, North-West, South-East and South-West, plus "Free Angle" which allows routes to + * exit in any direction. * - * If none of the direction boxes are checked, the system uses the default which is all directions - * (as shown above) for all pad shapes, except the long (drawn) Routes exit from the short sides of - * long pads - in other words in line with the long axis. + * If none of the direction boxes are checked, the system uses the default which is all + * directions (as shown above) for all pad shapes, except the long (drawn) Routes exit from + * the short sides of long pads - in other words in line with the long axis. * * Note: These Exit Directions are applied to the PCB component. If the PCB component is rotated * when it is used on a PCB Design, the Exit Directions will rotate with it." @@ -801,9 +801,11 @@ public: std::map AttributeValues; bool Fixed = false; - GROUP_ID GroupID = wxEmptyString; ///< If not empty, this CADSTAR_BOARD is part of a group - REUSEBLOCKREF ReuseBlockRef; ///< Normally CADSTAR_BOARD cannot be part of a reuseblock, - ///< but included for completeness + ///< If not empty, this CADSTAR_BOARD is part of a group + GROUP_ID GroupID = wxEmptyString; + + ///< Normally CADSTAR_BOARD cannot be part of a reuseblock, but included for completeness. + REUSEBLOCKREF ReuseBlockRef; void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override; }; @@ -984,7 +986,8 @@ public: bool Fixed = false; VERTEX Vertex; - XNODE* Parse( XNODE* aNode, PARSER_CONTEXT* aContext ); ///< Returns a pointer to the last node + ///< Returns a pointer to the last node. + XNODE* Parse( XNODE* aNode, PARSER_CONTEXT* aContext ); }; struct ROUTE : PARSER ///< "ROUTE" nodename @@ -1069,7 +1072,8 @@ public: long AdditionalIsolation; ///< This is the gap to apply in routes and pads ///< in addition to the existing pad-to-copper or ///< route-to-copper spacing (see SPACINGCODE.ID) - long ThermalReliefPadsAngle; ///< Orientation for the thermal reliefs. Disabled when !ThermalReliefOnPads (param5) + long ThermalReliefPadsAngle; ///< Orientation for the thermal reliefs. Disabled when + ///< !ThermalReliefOnPads (param5) long ThermalReliefViasAngle; ///< Disabled when !ThermalReliefOnVias (param6) long MinIsolatedCopper = UNDEFINED_VALUE; ///< The value is the length of one side of ///< a notional square. Disabled when diff --git a/pcbnew/plugins/pcad/pcad2kicad_common.cpp b/pcbnew/plugins/pcad/pcad2kicad_common.cpp index a86c694dac..564371bd62 100644 --- a/pcbnew/plugins/pcad/pcad2kicad_common.cpp +++ b/pcbnew/plugins/pcad/pcad2kicad_common.cpp @@ -231,60 +231,71 @@ int StrToInt1Units( const wxString& aStr ) } -wxString ValidateName( wxString aName ) +wxString ValidateName( const wxString& aName ) { - aName.Replace( wxT( " " ), wxT( "_" ) ); + wxString retv = aName; + retv.Replace( wxT( " " ), wxT( "_" ) ); - return aName; + return retv; } -wxString ValidateReference( wxString aRef ) +wxString ValidateReference( const wxString& aRef ) { wxRegEx reRef; reRef.Compile( wxT( "^[[:digit:]][[:digit:]]*$" ) ); - if( reRef.Matches( aRef ) ) - aRef.Prepend( wxT( '.' ) ); + wxString retv = aRef; - return aRef; + if( reRef.Matches( retv ) ) + retv.Prepend( wxT( '.' ) ); + + return retv; } -void SetWidth( wxString aStr, const wxString& aDefaultMeasurementUnit, int* aWidth, +void SetWidth( const wxString& aStr, const wxString& aDefaultMeasurementUnit, int* aWidth, const wxString& aActualConversion ) { - *aWidth = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), + wxString tmp = aStr; + + *aWidth = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( ' ' ), aActualConversion ); } -void SetHeight( wxString aStr, const wxString& aDefaultMeasurementUnit, int* aHeight, +void SetHeight( const wxString& aStr, const wxString& aDefaultMeasurementUnit, int* aHeight, const wxString& aActualConversion ) { - *aHeight = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), + wxString tmp = aStr; + + *aHeight = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( ' ' ), aActualConversion ); } -void SetPosition( wxString aStr, const wxString& aDefaultMeasurementUnit, int* aX, int* aY, +void SetPosition( const wxString& aStr, const wxString& aDefaultMeasurementUnit, int* aX, int* aY, const wxString& aActualConversion ) { - *aX = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), + wxString tmp = aStr; + + *aX = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( 'X' ), aActualConversion ); - *aY = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), + *aY = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( 'Y' ), aActualConversion ); } -void SetDoublePrecisionPosition( wxString aStr, const wxString& aDefaultMeasurementUnit, double* aX, - double* aY, const wxString& aActualConversion ) +void SetDoublePrecisionPosition( const wxString& aStr, const wxString& aDefaultMeasurementUnit, + double* aX, double* aY, const wxString& aActualConversion ) { + wxString tmp = aStr; + *aX = StrToDoublePrecisionUnits( - GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxT( 'X' ), + GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( 'X' ), aActualConversion ); *aY = StrToDoublePrecisionUnits( - GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxT( 'Y' ), + GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( 'Y' ), aActualConversion ); } diff --git a/pcbnew/plugins/pcad/pcad2kicad_common.h b/pcbnew/plugins/pcad/pcad2kicad_common.h index 31786e2bfb..8f0366ec28 100644 --- a/pcbnew/plugins/pcad/pcad2kicad_common.h +++ b/pcbnew/plugins/pcad/pcad2kicad_common.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -68,22 +68,23 @@ struct TTEXTVALUE extern wxString GetWord( wxString* aStr ); extern XNODE* FindPinMap( XNODE* aNode ); -extern int StrToIntUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion ); +extern int StrToIntUnits( const wxString& aStr, char aAxe, + const wxString& aActualConversion ); extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr, const wxString& aDefaultMeasurementUnit ); extern int StrToInt1Units( const wxString& aStr ); -extern wxString ValidateName( wxString aName ); -extern wxString ValidateReference( wxString aRef ); -extern void SetWidth( wxString aStr, +extern wxString ValidateName( const wxString& aName ); +extern wxString ValidateReference( const wxString& aRef ); +extern void SetWidth( const wxString& aStr, const wxString& aDefaultMeasurementUnit, int* aWidth, const wxString& aActualConversion ); -extern void SetPosition( wxString aStr, +extern void SetPosition( const wxString& aStr, const wxString& aDefaultMeasurementUnit, int* aX, int* aY, const wxString& aActualConversion ); -extern void SetDoublePrecisionPosition( wxString aStr, +extern void SetDoublePrecisionPosition( const wxString& aStr, const wxString& aDefaultMeasurementUnit, double* aX, double* aY, diff --git a/pcbnew/plugins/pcad/pcb_component.h b/pcbnew/plugins/pcad/pcb_component.h index 2f2637535f..ae862411d7 100644 --- a/pcbnew/plugins/pcad/pcb_component.h +++ b/pcbnew/plugins/pcad/pcb_component.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2021 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -54,7 +54,11 @@ public: virtual void AddToBoard() = 0; PCB_LAYER_ID GetKiCadLayer() const { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } - int GetNetCode( wxString aNetName ) const { return m_callbacks->GetNetCode( aNetName ); } + + int GetNetCode( const wxString& aNetName ) const + { + return m_callbacks->GetNetCode( aNetName ); + } int m_tag; char m_objType; diff --git a/pcbnew/python/scripting/pcbnew_footprint_wizards.h b/pcbnew/python/scripting/pcbnew_footprint_wizards.h index f7e73886f0..bf75a9fdcd 100644 --- a/pcbnew/python/scripting/pcbnew_footprint_wizards.h +++ b/pcbnew/python/scripting/pcbnew_footprint_wizards.h @@ -56,7 +56,7 @@ public: // must return an empty string or an error description: wxString SetParameterValues( int aPage, wxArrayString& aValues ) override; - FOOTPRINT* GetFootprint( wxString * aMessages ) override; + FOOTPRINT* GetFootprint( wxString* aMessages ) override; void* GetObject() override; wxArrayString GetParameterHints( int aPage ) override; wxArrayString GetParameterDesignators( int aPage = 0 ) override; diff --git a/qa/drc_proto/drc_proto.cpp b/qa/drc_proto/drc_proto.cpp index 83f7eedd1e..619c28d346 100644 --- a/qa/drc_proto/drc_proto.cpp +++ b/qa/drc_proto/drc_proto.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -56,7 +56,7 @@ #include "drc_proto.h" -PROJECT_CONTEXT loadKicadProject( wxString filename, OPT rulesFilePath ) +PROJECT_CONTEXT loadKicadProject( const wxString& filename, OPT rulesFilePath ) { PROJECT_CONTEXT rv; @@ -72,8 +72,6 @@ PROJECT_CONTEXT loadKicadProject( wxString filename, OPT rulesFilePath schName.SetExt( KiCadSchematicFileExtension ); ruleFileName.SetExt( DesignRulesFileExtension ); - - brdName.MakeAbsolute(); schName.MakeAbsolute(); ruleFileName.MakeAbsolute(); @@ -89,8 +87,7 @@ PROJECT_CONTEXT loadKicadProject( wxString filename, OPT rulesFilePath if( rulesFilePath ) rv.rulesFilePath = *rulesFilePath; else - rv.rulesFilePath = ruleFileName.GetFullPath(); - + rv.rulesFilePath = ruleFileName.GetFullPath(); if( wxFileExists( schName.GetFullPath() ) ) { diff --git a/qa/drc_proto/drc_proto.h b/qa/drc_proto/drc_proto.h index 8117495d51..fe9701193c 100644 --- a/qa/drc_proto/drc_proto.h +++ b/qa/drc_proto/drc_proto.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -112,7 +112,10 @@ private: virtual bool updateUI() override { m_log->SetColor( CONSOLE_LOG::GREEN ); - m_log->PrintProgress( wxString::Format( " | %s : %.02f%%", m_rptMessage, (double) m_progress / (double) m_maxProgress * 100.0 ) ); + m_log->PrintProgress( wxString::Format( " | %s : %.02f%%", + m_rptMessage, + (double) m_progress / (double) m_maxProgress * + 100.0 ) ); return true; } @@ -128,7 +131,8 @@ public: ~CONSOLE_MSG_REPORTER() {}; - virtual REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override + virtual REPORTER& Report( const wxString& aText, + SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override { switch( aSeverity ) { @@ -157,15 +161,18 @@ private: }; -struct PROJECT_CONTEXT { +struct PROJECT_CONTEXT +{ PROJECT* project; wxString rulesFilePath; std::shared_ptr board; std::shared_ptr netlist; }; -PROJECT_CONTEXT loadKicadProject( wxString filename, OPT rulesFilePath ); -int runDRCProto( PROJECT_CONTEXT project, std::shared_ptr aDebugOverlay = nullptr); +PROJECT_CONTEXT loadKicadProject( const wxString& filename, OPT rulesFilePath ); + +int runDRCProto( PROJECT_CONTEXT project, + std::shared_ptr aDebugOverlay = nullptr ); #endif diff --git a/qa/pns/pns_log.h b/qa/pns/pns_log.h index d05fd88c9b..c5545e9ca5 100644 --- a/qa/pns/pns_log.h +++ b/qa/pns/pns_log.h @@ -217,24 +217,24 @@ public: virtual void SetIteration( int iter ) override { m_iter = iter; } - virtual void Message( const wxString msg, + virtual void Message( const wxString& msg, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void NewStage( const std::string& name, int iter, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; - virtual void BeginGroup( const std::string name, + virtual void BeginGroup( const std::string& name, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void EndGroup( const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void AddPoint( VECTOR2I aP, const KIGFX::COLOR4D& aColor, int aSize, - const std::string aName, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const KIGFX::COLOR4D& aColor, - int aWidth, const std::string aName, + int aWidth, const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void AddSegment( SEG aS, const KIGFX::COLOR4D& aColor, - const std::string aName, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor, - const std::string aName, + const std::string& aName, const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; virtual void Clear(){};