Pass wxString objects by reference instead of on the stack.

This commit is contained in:
Wayne Stambaugh 2021-07-27 08:22:27 -04:00
parent 78e5e98ea0
commit 37b200cb3e
77 changed files with 305 additions and 260 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -68,7 +68,7 @@ public:
* *
* @param aModelPathName 3D model path name. * @param aModelPathName 3D model path name.
*/ */
void Set3DModel( wxString const& aModelPathName ); void Set3DModel( const wxString& aModelPathName );
/** /**
* Unload the displayed 3D model. * Unload the displayed 3D model.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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; 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, int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage,
wxString aDetailedMessage, wxString aOKLabel, wxString aCancelLabel, const wxString& aDetailedMessage, const wxString& aOKLabel,
bool* aApplyToAll ) const wxString& aCancelLabel, bool* aApplyToAll )
{ {
wxRichMessageDialog dlg( aParent, aMessage, aWarning, wxRichMessageDialog dlg( aParent, aMessage, aWarning,
wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER ); wxOK | wxCANCEL | wxOK_DEFAULT | wxICON_WARNING | wxCENTER );
if( aOKLabel.IsEmpty() ) dlg.SetOKCancelLabels( ( aOKLabel.IsEmpty() ) ? _( "OK" ) : aOKLabel,
aOKLabel = _( "OK" ); ( aCancelLabel.IsEmpty() ) ? _( "Cancel" ) : aCancelLabel );
if( aCancelLabel.IsEmpty() )
aCancelLabel = _( "Cancel" );
dlg.SetOKCancelLabels( aOKLabel, aCancelLabel );
if( !aDetailedMessage.IsEmpty() ) if( !aDetailedMessage.IsEmpty() )
dlg.SetExtendedMessage( aDetailedMessage ); dlg.SetExtendedMessage( aDetailedMessage );

View File

@ -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 ); wxString tmp = aName;
aName.Trim( false );
if( aName.IsEmpty() ) tmp.Trim( true );
tmp.Trim( false );
if( tmp.IsEmpty() )
{ {
wxString msg = _( "Netclass must have a name." ); wxString msg = _( "Netclass must have a name." );
m_Parent->SetError( msg, this, m_netclassGrid, aRow, GRID_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++ ) 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." ); wxString msg = _( "Netclass name already in use." );
m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME ); m_Parent->SetError( msg, this, m_netclassGrid, focusFirst ? aRow : ii, GRID_NAME );

View File

@ -37,7 +37,7 @@
static const int kDataViewIndent = 20; 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<void*>( static_cast<void const*>( aNode ) ) ); return wxDataViewItem( const_cast<void*>( static_cast<void const*>( 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 ) wxDataViewItemArray& aChildren )
{ {
unsigned int n = 0; 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_parent( aParent ),
m_filter( SYM_FILTER_NONE ), m_filter( SYM_FILTER_NONE ),
m_show_units( true ), 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_lib_id = aLibId;
m_preselect_unit = aUnit; m_preselect_unit = aUnit;
} }
LIB_TREE_NODE_LIB& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( wxString const& aNodeName, LIB_TREE_NODE_LIB& LIB_TREE_MODEL_ADAPTER::DoAddLibraryNode( const wxString& aNodeName,
wxString const& aDesc ) const wxString& aDesc )
{ {
LIB_TREE_NODE_LIB& lib_node = m_tree.AddLib( aNodeName, 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, void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( const wxString& aNodeName, const wxString& aDesc,
std::vector<LIB_TREE_ITEM*> const& aItemList, const std::vector<LIB_TREE_ITEM*>& aItemList,
bool presorted ) bool presorted )
{ {
LIB_TREE_NODE_LIB& lib_node = DoAddLibraryNode( aNodeName, aDesc ); 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 ); 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 wxDataViewItemArray& aChildren ) const
{ {
const LIB_TREE_NODE* node = ( aItem.IsOk() ? ToNode( aItem ) : &m_tree ); 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 ); 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 ); LIB_TREE_NODE* node = ToNode( aItem );
return node ? node->m_Children.size() : true; 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 ) if( m_freeze )
return ToItem( nullptr ); return ToItem( nullptr );
@ -440,7 +441,7 @@ wxDataViewItem LIB_TREE_MODEL_ADAPTER::GetParent( wxDataViewItem const& aItem )
void LIB_TREE_MODEL_ADAPTER::GetValue( wxVariant& aVariant, void LIB_TREE_MODEL_ADAPTER::GetValue( wxVariant& aVariant,
wxDataViewItem const& aItem, const wxDataViewItem& aItem,
unsigned int aCol ) const unsigned int aCol ) const
{ {
if( IsFrozen() ) 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, unsigned int aCol,
wxDataViewItemAttr& aAttr ) const 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, void LIB_TREE_MODEL_ADAPTER::FindAndExpand( LIB_TREE_NODE& aNode,
std::function<bool( LIB_TREE_NODE const* )> aFunc, std::function<bool( const LIB_TREE_NODE* )> aFunc,
LIB_TREE_NODE** aHighScore ) LIB_TREE_NODE** aHighScore )
{ {
for( std::unique_ptr<LIB_TREE_NODE>& node: aNode.m_Children ) for( std::unique_ptr<LIB_TREE_NODE>& node: aNode.m_Children )

View File

@ -160,7 +160,7 @@ protected:
/// @param content is the content substring. /// @param content is the content substring.
/// ///
/// @return whether a new item was made /// @return whether a new item was made
bool startOrAppendItem( DPOINT location, wxString const& content ); bool startOrAppendItem( DPOINT location, const wxString& content );
int penSpeed; int penSpeed;
int penNumber; int penNumber;

View File

@ -28,11 +28,11 @@
#include <lib_id.h> #include <lib_id.h>
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; LIB_ID libId;
libId.Parse( key, true ); libId.Parse( key, true );

View File

@ -32,7 +32,7 @@
#include <iostream> #include <iostream>
LIB_ID AltiumToKiCadLibID( wxString aLibName, wxString aLibReference ); LIB_ID AltiumToKiCadLibID( const wxString& aLibName, const wxString& aLibReference );
wxString AltiumPropertyToKiCadString( const wxString& aString ); wxString AltiumPropertyToKiCadString( const wxString& aString );

View File

@ -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<TEXT_FIELD_NAME, wxString> txtTokens = static const std::map<TEXT_FIELD_NAME, wxString> txtTokens =
{ {
@ -764,7 +765,6 @@ wxString CADSTAR_ARCHIVE_PARSER::ParseTextFields( wxString aTextString, PARSER_C
{ TEXT_FIELD_NAME::HYPERLINK, wxT( "HYPERLINK" ) } { TEXT_FIELD_NAME::HYPERLINK, wxT( "HYPERLINK" ) }
}; };
wxString remainingStr = aTextString; wxString remainingStr = aTextString;
wxString returnStr; wxString returnStr;

View File

@ -194,7 +194,7 @@ public:
* @param aParserContext PARSER_CONTEXT in which to store the values of the found fields * @param aParserContext PARSER_CONTEXT in which to store the values of the found fields
* @return * @return
*/ */
static wxString ParseTextFields( wxString aTextString, PARSER_CONTEXT* aParserContext ); static wxString ParseTextFields( const wxString& aTextString, PARSER_CONTEXT* aParserContext );
struct PARSER struct PARSER

View File

@ -33,7 +33,7 @@
const int colorsSchemaVersion = 2; 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 ), JSON_SETTINGS( std::move( aFilename ), SETTINGS_LOC::COLORS, colorsSchemaVersion ),
m_overrideSchItemColors( false ) m_overrideSchItemColors( false )
{ {

View File

@ -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 // Compare unescaped text
strFWord = UnescapeString( strFWord ); wxString fWord = UnescapeString( strFWord );
strSWord = UnescapeString( strSWord ); wxString sWord = UnescapeString( strSWord );
// The different sections of the two strings // The different sections of the two strings
wxString strFWordBeg, strFWordMid, strFWordEnd; wxString strFWordBeg, strFWordMid, strFWordEnd;
wxString strSWordBeg, strSWordMid, strSWordEnd; wxString strSWordBeg, strSWordMid, strSWordEnd;
// Split the two strings into separate parts // Split the two strings into separate parts
SplitString( strFWord, &strFWordBeg, &strFWordMid, &strFWordEnd ); SplitString( fWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
SplitString( strSWord, &strSWordBeg, &strSWordMid, &strSWordEnd ); SplitString( sWord, &strSWordBeg, &strSWordMid, &strSWordEnd );
// Compare the Beginning section of the strings // Compare the Beginning section of the strings
int isEqual = strFWordBeg.CmpNoCase( strSWordBeg ); int isEqual = strFWordBeg.CmpNoCase( strSWordBeg );

View File

@ -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__ #ifdef __WINDOWS__
Add( _( "Close" ), Add( _( "Close" ),

View File

@ -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<wxTextEntry*>( m_valueCtrl ); wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( m_valueCtrl );
wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl ); wxStaticText* staticText = dynamic_cast<wxStaticText*>( m_valueCtrl );

View File

@ -185,19 +185,19 @@ protected:
/** /**
* Look up the footprint for a given symbol specified in the #LIB_ID and display it. * 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. * Display the given footprint by name.
*/ */
void ShowFootprint( wxString const& aFootprint ); void ShowFootprint( const wxString& aFootprint );
/** /**
* Populate the footprint selector for a given alias. * Populate the footprint selector for a given alias.
* *
* @param aLibId the #LIB_ID of the selection or invalid to clear. * @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: public:
static std::mutex g_Mutex; static std::mutex g_Mutex;

View File

@ -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 ); return aName + wxT( " " ) + wxString::Format( _( "(page %s)" ), aPage );
} }

View File

@ -101,7 +101,7 @@ private:
/** /**
* @return String with page number in parenthesis * @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_currSheet;
SCH_SHEET_PATH m_list; SCH_SHEET_PATH m_list;

View File

@ -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 ) if( aPageNumberA == aPageNumberB )
return 0; // A == B return 0; // A == B

View File

@ -318,11 +318,12 @@ public:
} }
// Set a new filename without changing anything else // Set a new filename without changing anything else
void SetFileName( wxString aFilename ) void SetFileName( const wxString& aFilename )
{ {
// Filenames are stored using unix notation // Filenames are stored using unix notation
aFilename.Replace( wxT("\\"), wxT("/") ); wxString tmp = aFilename;
m_fields[ SHEETFILENAME ].SetText( aFilename ); tmp.Replace( wxT( "\\" ), wxT( "/" ) );
m_fields[ SHEETFILENAME ].SetText( tmp );
} }
// Geometric transforms (used in block operations): // 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 * @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) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override; void Show( int nestLevel, std::ostream& os ) const override;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * 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 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 CERN * Copyright (C) 2016 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Sylwester Kocjan <s.kocjan@o2.pl> * @author Sylwester Kocjan <s.kocjan@o2.pl>
* *
* This program is free software; you can redistribute it and/or * 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 wxPoint& pos, const wxSize& size, long style,
const wxString& name ) : const wxString& name ) :
wxWindow( parent, id, pos, size, style, 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 wxPoint& pos, const wxSize& size, long style,
const wxString& name ) : const wxString& name ) :
SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ) SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name )

View File

@ -39,8 +39,8 @@ class SIM_PANEL_BASE : public wxWindow
public: public:
SIM_PANEL_BASE(); SIM_PANEL_BASE();
SIM_PANEL_BASE( wxString aCommand ); SIM_PANEL_BASE( const wxString& aCommand );
SIM_PANEL_BASE( wxString aCommand, wxWindow* parent, wxWindowID id, SIM_PANEL_BASE( const wxString& aCommand, wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxPanelNameStr ); long style = 0, const wxString& name = wxPanelNameStr );
virtual ~SIM_PANEL_BASE(); virtual ~SIM_PANEL_BASE();
@ -72,7 +72,7 @@ private:
class SIM_NOPLOT_PANEL : public SIM_PANEL_BASE class SIM_NOPLOT_PANEL : public SIM_PANEL_BASE
{ {
public: 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, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, const wxString& name = wxPanelNameStr ); long style = 0, const wxString& name = wxPanelNameStr );

View File

@ -300,9 +300,9 @@ void CURSOR::UpdateReference()
} }
SIM_PLOT_PANEL::SIM_PLOT_PANEL( wxString aCommand, wxWindow* parent, SIM_PLOT_FRAME* aMainFrame, SIM_PLOT_PANEL::SIM_PLOT_PANEL( const wxString& aCommand, wxWindow* parent,
wxWindowID id, const wxPoint& pos, const wxSize& size, SIM_PLOT_FRAME* aMainFrame, wxWindowID id, const wxPoint& pos,
long style, const wxString& name ) const wxSize& size, long style, const wxString& name )
: SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ), : SIM_PANEL_BASE( aCommand, parent, id, pos, size, style, name ),
m_axis_x( nullptr ), m_axis_x( nullptr ),
m_axis_y1( nullptr ), m_axis_y1( nullptr ),

View File

@ -178,9 +178,10 @@ class SIM_PLOT_PANEL : public SIM_PANEL_BASE
friend class SIM_WORKBOOK; friend class SIM_WORKBOOK;
public: public:
SIM_PLOT_PANEL( wxString aCommand, wxWindow* parent, SIM_PLOT_FRAME* aMainFrame, wxWindowID id, SIM_PLOT_PANEL( const wxString& aCommand, wxWindow* parent, SIM_PLOT_FRAME* aMainFrame,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString& name = wxPanelNameStr ); const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = wxPanelNameStr );
virtual ~SIM_PLOT_PANEL(); virtual ~SIM_PLOT_PANEL();

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2021 CERN * Copyright (C) 2021 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Wayne Stambaugh <stambaughw@gmail.com> * @author Wayne Stambaugh <stambaughw@gmail.com>
* *
@ -44,7 +45,7 @@ public:
bool operator!=( const SPICE_SIMULATOR_SETTINGS& aRhs ) const { return !( *this == aRhs ); } bool operator!=( const SPICE_SIMULATOR_SETTINGS& aRhs ) const { return !( *this == aRhs ); }
wxString GetWorkbookFilename() const { return m_workbookFilename; } 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; } bool GetFixPassiveVals() const { return m_fixPassiveVals; }
void SetFixPassiveVals( bool aFixPassiveVals ) void SetFixPassiveVals( bool aFixPassiveVals )

View File

@ -51,7 +51,7 @@ public:
/** /**
* Set the contents of the status label and display it. * 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. * Set the currently displayed symbol.

View File

@ -75,7 +75,8 @@ BEGIN_EVENT_TABLE( SELECT_LAYER_DIALOG, wxDialog )
END_EVENT_TABLE() 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 = SELECT_LAYER_DIALOG* frame =
new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount, aGerberName ); new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount, aGerberName );

View File

@ -448,7 +448,7 @@ public:
* @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected),
* or -1 if canceled * 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 * @return the color of the grid

View File

@ -105,7 +105,7 @@ bool HandleUnsavedChanges( wxWindow* aParent, const wxString& aMessage,
* written back to the bool. * written back to the bool.
* @return wxID_YES, wxID_CANCEL, wxID_NO. * @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 ); 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. * @return wxID_OK or wxID_CANCEL depending on the button the user selected.
*/ */
int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage, int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxString& aMessage,
wxString aDetailedMessage = wxEmptyString, wxString aOKLabel = wxEmptyString, const wxString& aDetailedMessage = wxEmptyString,
wxString aCancelLabel = wxEmptyString, bool* aApplyToAll = nullptr ); const wxString& aOKLabel = wxEmptyString,
const wxString& aCancelLabel = wxEmptyString, bool* aApplyToAll = nullptr );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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 class PANEL_SETUP_NETCLASSES : public PANEL_SETUP_NETCLASSES_BASE
{ {
private: public:
PAGED_DIALOG* m_Parent; PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses,
NETCLASSES* m_netclasses; const std::vector<wxString>& aNetNames, bool isEEschema );
std::vector<wxString> m_netNames; ~PANEL_SETUP_NETCLASSES( ) override;
int* m_originalColWidths; bool TransferDataToWindow() override;
bool m_netclassesDirty; // The netclass drop-down menus need rebuilding bool TransferDataFromWindow() override;
int m_hoveredCol; // Column being hovered over, for tooltips
bool Validate() override;
void ImportSettingsFrom( NETCLASSES* aBoard );
private: private:
void OnAddNetclassClick( wxCommandEvent& event ) override; void OnAddNetclassClick( wxCommandEvent& event ) override;
@ -57,7 +60,7 @@ private:
void OnAssignAll( wxCommandEvent& event ) override { doAssignments( true ); } void OnAssignAll( wxCommandEvent& event ) override { doAssignments( true ); }
void OnAssignSelected( wxCommandEvent& event ) override { doAssignments( false ); } 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(); void rebuildNetclassDropdowns();
@ -68,17 +71,13 @@ private:
void AdjustNetclassGridColumns( int aWidth ); void AdjustNetclassGridColumns( int aWidth );
void AdjustMembershipGridColumns( int aWidth ); void AdjustMembershipGridColumns( int aWidth );
public: PAGED_DIALOG* m_Parent;
PANEL_SETUP_NETCLASSES( PAGED_DIALOG* aParent, NETCLASSES* aNetclasses, NETCLASSES* m_netclasses;
const std::vector<wxString>& aNetNames, bool isEEschema ); std::vector<wxString> m_netNames;
~PANEL_SETUP_NETCLASSES( ) override;
bool TransferDataToWindow() override; int* m_originalColWidths;
bool TransferDataFromWindow() override; bool m_netclassesDirty; // The netclass drop-down menus need rebuilding
int m_hoveredCol; // Column being hovered over, for tooltips
bool Validate() override;
void ImportSettingsFrom( NETCLASSES* aBoard );
}; };
#endif //PANEL_SETUP_NETCLASSES_H #endif //PANEL_SETUP_NETCLASSES_H

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -184,7 +184,7 @@ public:
*/ */
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: private:
// Add matcher if it can compile the pattern. // Add matcher if it can compile the pattern.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org> * Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * 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 * under the terms of the GNU General Public License as published by the
@ -58,7 +58,7 @@ public:
/** /**
* Add library name to filter criteria. * Add library name to filter criteria.
*/ */
void FilterByLibrary( wxString const& aLibName ); void FilterByLibrary( const wxString& aLibName );
/** /**
* Set a pin count to filter by. * Set a pin count to filter by.
@ -68,13 +68,13 @@ public:
/** /**
* Set a list of footprint filters to filter by. * 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 * Add a pattern to filter by name, including wildcards and optionally a colon-delimited
* library name. * library name.
*/ */
void FilterByTextPattern( wxString const& aPattern ); void FilterByTextPattern( const wxString& aPattern );
/** /**
* Inner iterator class returned by begin() and end(). * Inner iterator class returned by begin() and end().
@ -84,7 +84,7 @@ public:
{ {
public: public:
ITERATOR(); ITERATOR();
ITERATOR( ITERATOR const& aOther ); ITERATOR( const ITERATOR& aOther );
ITERATOR( FOOTPRINT_FILTER& aFilter ); ITERATOR( FOOTPRINT_FILTER& aFilter );
private: private:
@ -92,7 +92,7 @@ public:
friend class FOOTPRINT_FILTER; friend class FOOTPRINT_FILTER;
void increment(); void increment();
bool equal( ITERATOR const& aOther ) const; bool equal( const ITERATOR& aOther ) const;
FOOTPRINT_INFO& dereference() const; FOOTPRINT_INFO& dereference() const;
size_t m_pos; size_t m_pos;

View File

@ -273,7 +273,7 @@ protected:
* Launch worker threads to load footprints. Part of the #FOOTPRINT_ASYNC_LOADER * Launch worker threads to load footprints. Part of the #FOOTPRINT_ASYNC_LOADER
* implementation. * 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; FOOTPRINT_ASYNC_LOADER* aLoader, unsigned aNThreads ) = 0;
/** /**
@ -327,7 +327,7 @@ public:
* all known libraries in \a aTable. * all known libraries in \a aTable.
* @param aNThreads is the number of worker threads. * @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 ); unsigned aNThreads = DEFAULT_THREADS );
/** /**

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* 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 * 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 * 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 aDC wxDC instance onto which the text will be drawn.
* @param aText the text to draw. * @param aText the text to draw.
*/ */
void GRDrawWrappedText( wxDC& aDC, wxString const& aText ); void GRDrawWrappedText( wxDC& aDC, const wxString& aText );
#endif /* define GR_BASIC */ #endif /* define GR_BASIC */

View File

@ -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 * @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. * 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 * Break a string into three parts: he alphabetic preamble, the numeric part, and any

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * 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 * under the terms of the GNU General Public License as published by the

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com> * Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org> * Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* 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 * 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 * 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 aName display name of the library
* @param aDesc a description 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. * Construct a new alias node, add it to this library, and return it.

View File

@ -156,7 +156,7 @@ public:
* @param aLibId symbol #LIB_ID to be selected * @param aLibId symbol #LIB_ID to be selected
* @param aUnit unit to be selected, if > 0 (0 selects the alias itself) * @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 * 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 aDesc the description field of the parent node
* @param aItemList list of symbols * @param aItemList list of symbols
*/ */
void DoAddLibrary( wxString const& aNodeName, wxString const& aDesc, void DoAddLibrary( const wxString& aNodeName, const wxString& aDesc,
std::vector<LIB_TREE_ITEM*> const& aItemList, bool presorted ); const std::vector<LIB_TREE_ITEM*>& aItemList, bool presorted );
/** /**
@ -181,7 +181,7 @@ public:
* @param aSearch full, unprocessed search text * @param aSearch full, unprocessed search text
* @param aState if true, we are keeping the state and so we shouldn't collapse the tree * @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 * 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; 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. * Return the number of symbols loaded in the tree.
@ -258,7 +258,7 @@ public:
* *
* @return number of children * @return number of children
*/ */
unsigned int GetChildren( wxDataViewItem const& aItem, unsigned int GetChildren( const wxDataViewItem& aItem,
wxDataViewItemArray& aChildren ) const override; wxDataViewItemArray& aChildren ) const override;
// Freezing/Thawing. Used when updating the table model so that we don't try and fetch // 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. * 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. * Convert wxDataViewItem -> #SYM_TREE_NODE.
@ -287,7 +287,7 @@ protected:
/** /**
* Convert SYM_TREE_NODE's children to wxDataViewItemArray. * 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. * Create the adapter.
@ -295,26 +295,26 @@ protected:
* @param aParent is the parent frame * @param aParent is the parent frame
* @param aPinnedKey is the key to load the pinned libraries list from the project file * @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 * 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. * 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. * Get the parent of an item.
* *
* @return parent of aItem, or an invalid wxDataViewItem if parent is root * @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; } unsigned int GetColumnCount() const override { return NUM_COLS; }
@ -331,15 +331,15 @@ protected:
* @param aCol column number of the data * @param aCol column number of the data
*/ */
void GetValue( wxVariant& aVariant, void GetValue( wxVariant& aVariant,
wxDataViewItem const& aItem, const wxDataViewItem& aItem,
unsigned int aCol ) const override; unsigned int aCol ) const override;
/** /**
* Set the value of an item. Does nothing - this model doesn't support * Set the value of an item. Does nothing - this model doesn't support
* editing. * editing.
*/ */
bool SetValue( wxVariant const& aVariant, bool SetValue( const wxVariant& aVariant,
wxDataViewItem const& aItem, const wxDataViewItem& aItem,
unsigned int aCol ) override { return false; } unsigned int aCol ) override { return false; }
/** /**
@ -350,7 +350,7 @@ protected:
* @param aAttr receiver for attributes * @param aAttr receiver for attributes
* @return true if the item has non-default attributes * @return true if the item has non-default attributes
*/ */
bool GetAttr( wxDataViewItem const& aItem, bool GetAttr( const wxDataViewItem& aItem,
unsigned int aCol, unsigned int aCol,
wxDataViewItemAttr& aAttr ) const override; wxDataViewItemAttr& aAttr ) const override;
@ -369,7 +369,7 @@ private:
* Find any results worth highlighting and expand them, according to given criteria * Find any results worth highlighting and expand them, according to given criteria
* The highest-scoring node is written to aHighScore * The highest-scoring node is written to aHighScore
*/ */
void FindAndExpand( LIB_TREE_NODE& aNode, std::function<bool( LIB_TREE_NODE const* )> aFunc, void FindAndExpand( LIB_TREE_NODE& aNode, std::function<bool( const LIB_TREE_NODE* )> aFunc,
LIB_TREE_NODE** aHighScore ); LIB_TREE_NODE** aHighScore );
/** /**

View File

@ -63,7 +63,7 @@ public:
} }
wxString GetName() const { return m_name; } wxString GetName() const { return m_name; }
void SetName( wxString aName ) { m_name = aName; } void SetName( const wxString& aName ) { m_name = aName; }
std::unordered_set<BOARD_ITEM*>& GetItems() std::unordered_set<BOARD_ITEM*>& GetItems()
{ {

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com> * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* 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 * 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 * under the terms of the GNU General Public License as published by the
@ -58,7 +58,7 @@ public:
*/ */
std::vector<COLOR4D> m_Palette; std::vector<COLOR4D> m_Palette;
explicit COLOR_SETTINGS( wxString aFilename = "user" ); explicit COLOR_SETTINGS( const wxString& aFilename = wxT( "user" ) );
virtual ~COLOR_SETTINGS() {} virtual ~COLOR_SETTINGS() {}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com> * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* 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 * 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 * under the terms of the GNU General Public License as published by the
@ -173,7 +173,7 @@ protected:
class PARAM_PATH : public PARAM<wxString> class PARAM_PATH : public PARAM<wxString>
{ {
public: 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 ) : bool aReadOnly = false ) :
PARAM( aJsonPath, aPtr, aDefault, aReadOnly ) PARAM( aJsonPath, aPtr, aDefault, aReadOnly )
{ } { }

View File

@ -115,7 +115,7 @@ public:
* *
* @param aAppname is the application name to append to the tooltip. * @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. * Add either a standard Quit or Close item to the menu.

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * 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 * under the terms of the GNU General Public License as published by the
@ -44,14 +44,14 @@ public:
protected: protected:
virtual void DoSetPopupControl( wxComboPopup* aPopup ) override; 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 OnMeasureItem( size_t aItem ) const override;
virtual wxCoord OnMeasureItemWidth( 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. * 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 /// Veto a mouseover event if in the separator
void TryVetoMouse( wxMouseEvent& aEvent ); void TryVetoMouse( wxMouseEvent& aEvent );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 <pavlina.chris@gmail.com> * Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify it * 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. * 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. * Clear the contents of the status label and hide it.

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * 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 * 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 = * @param aZeroFilters - if true, zero filters = zero footprints. If false, zero filters =
* not filtering. * 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 * Set the default footprint for a part. This will be listed at the
* top. May be an empty string. * 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 * Update the contents of the list to match the filters. Has no effect if

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -45,7 +45,7 @@ public:
void SetSize( const wxRect& aRect ) override; void SetSize( const wxRect& aRect ) override;
void BeginEdit( int aRow, int aCol, wxGrid* aGrid ) 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 ApplyEdit( int aRow, int aCol, wxGrid* aGrid ) override;
void Reset() override; void Reset() override;

View File

@ -149,7 +149,7 @@ public:
*/ */
GRID_CELL_PATH_EDITOR( DIALOG_SHIM* aParentDialog, WX_GRID* aGrid, wxString* aCurrentDir, GRID_CELL_PATH_EDITOR( DIALOG_SHIM* aParentDialog, WX_GRID* aGrid, wxString* aCurrentDir,
const wxString& aExt, bool aNormalize = false, const wxString& aExt, bool aNormalize = false,
wxString aNormalizeBasePath = wxEmptyString ) : const wxString& aNormalizeBasePath = wxEmptyString ) :
m_dlg( aParentDialog ), m_dlg( aParentDialog ),
m_grid( aGrid ), m_grid( aGrid ),
m_currentDir( aCurrentDir ), m_currentDir( aCurrentDir ),

View File

@ -86,7 +86,7 @@ public:
*/ */
virtual void SetValue( int aValue ); 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. * Set new value (in Internal Units) for the text field, taking care of units conversion.

View File

@ -51,8 +51,11 @@
#include "kicad_manager_frame.h" #include "kicad_manager_frame.h"
void KICAD_MANAGER_FRAME::ImportNonKiCadProject( wxString aWindowTitle, wxString aFilesWildcard, void KICAD_MANAGER_FRAME::ImportNonKiCadProject( const wxString& aWindowTitle,
wxString aSchFileExtension, wxString aPcbFileExtension, int aSchFileType, int aPcbFileType ) const wxString& aFilesWildcard,
const wxString& aSchFileExtension,
const wxString& aPcbFileExtension,
int aSchFileType, int aPcbFileType )
{ {
wxString msg; wxString msg;
wxString default_dir = GetMruPath(); wxString default_dir = GetMruPath();

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN (www.cern.ch) * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -71,18 +71,19 @@ public:
return GetProjectFileName(); return GetProjectFileName();
} }
/** /**
* @brief Creates a project and imports a non-KiCad Schematic and PCB * @brief Creates a project and imports a non-KiCad Schematic and PCB
* @param aWindowTitle to display to the user when opening the files * @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 aSchFileExtension e.g. "sch" or "csa"
* @param aPcbFileExtension e.g. "brd" or "cpa" * @param aPcbFileExtension e.g. "brd" or "cpa"
* @param aSchFileType Type of Schematic File to import (from SCH_IO_MGR::SCH_FILE_T) * @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) * @param aPcbFileType Type of PCB File to import (from IO_MGR::PCB_FILE_T)
*/ */
void ImportNonKiCadProject( wxString aWindowTitle, wxString aFilesWildcard, void ImportNonKiCadProject( const wxString& aWindowTitle, const wxString& aFilesWildcard,
wxString aSchFileExtension, wxString aPcbFileExtension, int aSchFileType, const wxString& aSchFileExtension,
const wxString& aPcbFileExtension, int aSchFileType,
int aPcbFileType ); int aPcbFileType );
/** /**

View File

@ -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; size_t pos = 0, prev = 0;
@ -790,7 +790,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadR
void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootprints, void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootprints,
unsigned int aStartRefDes, wxString aPrefix, unsigned int aStartRefDes, const wxString& aPrefix,
bool aRemovePrefix, bool aRemovePrefix,
std::vector<RefDesInfo>& aBadRefDes ) std::vector<RefDesInfo>& aBadRefDes )
{ {

View File

@ -143,7 +143,7 @@ private:
void FilterBackPrefix( wxCommandEvent& event ) override; void FilterBackPrefix( wxCommandEvent& event ) override;
/// Break report into strings separated by \n and sent to the reporter. /// 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. /// Create a list of the footprints and their coordinates.
void LogFootprints( const wxString& aMessage, const std::vector<RefDesInfo>& aFootprints ); void LogFootprints( const wxString& aMessage, const std::vector<RefDesInfo>& aFootprints );
@ -161,7 +161,7 @@ private:
/// Scan through the footprint arrays and create the from -> to array. /// Scan through the footprint arrays and create the from -> to array.
void BuildChangeArray( std::vector<RefDesInfo>& aFootprints, unsigned int aStartRefDes, void BuildChangeArray( std::vector<RefDesInfo>& aFootprints, unsigned int aStartRefDes,
wxString aPrefix, bool aRemovePrefix, const wxString& aPrefix, bool aRemovePrefix,
std::vector<RefDesInfo>& aBadRefDes ); std::vector<RefDesInfo>& aBadRefDes );
/// @return the new reference for this footprint. /// @return the new reference for this footprint.

View File

@ -50,7 +50,7 @@ public:
template <typename T> template <typename T>
struct typeContainer_t struct typeContainer_t
{ {
typeContainer_t<T>( T aAttribute, wxString aTitle ) typeContainer_t<T>( T aAttribute, const wxString& aTitle )
: attribute( aAttribute ), : attribute( aAttribute ),
title( aTitle ), title( aTitle ),
qty( 0 ) qty( 0 )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com> * Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
* 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 * 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 * under the terms of the GNU General Public License as published by the
@ -24,27 +24,33 @@
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
wxString DIALOG_IMPORTED_LAYERS::WrapRequired( const wxString& aLayerName ) wxString DIALOG_IMPORTED_LAYERS::WrapRequired( const wxString& aLayerName )
{ {
return aLayerName + " *"; return aLayerName + " *";
} }
wxString DIALOG_IMPORTED_LAYERS::UnwrapRequired( const wxString& aLayerName ) wxString DIALOG_IMPORTED_LAYERS::UnwrapRequired( const wxString& aLayerName )
{ {
if( !aLayerName.EndsWith( " *" ) ) if( !aLayerName.EndsWith( " *" ) )
return aLayerName; return aLayerName;
return aLayerName.Left( aLayerName.Length() - 2 ); return aLayerName.Left( aLayerName.Length() - 2 );
} }
const INPUT_LAYER_DESC* DIALOG_IMPORTED_LAYERS::GetLayerDescription( const INPUT_LAYER_DESC* DIALOG_IMPORTED_LAYERS::GetLayerDescription(
const wxString& aLayerName ) const const wxString& aLayerName ) const
{ {
wxString layerName = UnwrapRequired( aLayerName ); wxString layerName = UnwrapRequired( aLayerName );
for( const INPUT_LAYER_DESC& layerDescription : m_input_layers ) for( const INPUT_LAYER_DESC& layerDescription : m_input_layers )
{ {
if( layerDescription.Name == layerName ) if( layerDescription.Name == layerName )
return &layerDescription; return &layerDescription;
} }
return nullptr; 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 ); wxString pureInputLayerName = UnwrapRequired( aInputLayerName );
for( INPUT_LAYER_DESC inputLayerDesc : m_input_layers ) for( INPUT_LAYER_DESC inputLayerDesc : m_input_layers )
@ -299,21 +305,26 @@ DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS( wxWindow* aParent,
finishDialogSettings(); finishDialogSettings();
} }
std::vector<wxString> DIALOG_IMPORTED_LAYERS::GetUnmappedRequiredLayers() const std::vector<wxString> DIALOG_IMPORTED_LAYERS::GetUnmappedRequiredLayers() const
{ {
std::vector<wxString> unmappedLayers; std::vector<wxString> unmappedLayers;
for( const wxString& layerName : m_unmatched_layer_names ) for( const wxString& layerName : m_unmatched_layer_names )
{ {
const INPUT_LAYER_DESC* layerDesc = GetLayerDescription( layerName ); const INPUT_LAYER_DESC* layerDesc = GetLayerDescription( layerName );
wxASSERT_MSG( layerDesc != nullptr, "Expected to find layer description" ); wxASSERT_MSG( layerDesc != nullptr, "Expected to find layer description" );
if( layerDesc->Required ) if( layerDesc->Required )
unmappedLayers.push_back( layerDesc->Name ); unmappedLayers.push_back( layerDesc->Name );
} }
return unmappedLayers; return unmappedLayers;
} }
std::map<wxString, PCB_LAYER_ID> DIALOG_IMPORTED_LAYERS::GetMapModal( wxWindow* aParent, std::map<wxString, PCB_LAYER_ID>
DIALOG_IMPORTED_LAYERS::GetMapModal( wxWindow* aParent,
const std::vector<INPUT_LAYER_DESC>& aLayerDesc ) const std::vector<INPUT_LAYER_DESC>& aLayerDesc )
{ {
DIALOG_IMPORTED_LAYERS dlg( aParent, aLayerDesc ); DIALOG_IMPORTED_LAYERS dlg( aParent, aLayerDesc );

View File

@ -49,7 +49,7 @@ public:
private: private:
//Helper functions //Helper functions
PCB_LAYER_ID GetSelectedLayerID(); PCB_LAYER_ID GetSelectedLayerID();
PCB_LAYER_ID GetAutoMatchLayerID( wxString aInputLayerName ); PCB_LAYER_ID GetAutoMatchLayerID( const wxString& aInputLayerName );
void AddMappings(); void AddMappings();
void RemoveMappings( int aStatus ); void RemoveMappings( int aStatus );

View File

@ -94,7 +94,7 @@ public:
PROGRESS_REPORTER* aProgressReporter = nullptr ) override; PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
protected: 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; FOOTPRINT_ASYNC_LOADER* aLoader, unsigned aNThreads ) override;
bool joinWorkers() override; bool joinWorkers() override;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -124,7 +124,7 @@ public:
wxString m_layerName; wxString m_layerName;
int m_lineWeight; int m_lineWeight;
DXF_IMPORT_LAYER( wxString aName, int aLineWeight ) DXF_IMPORT_LAYER( const wxString& aName, int aLineWeight )
{ {
m_layerName = aName; m_layerName = aName;
m_lineWeight = aLineWeight; m_lineWeight = aLineWeight;
@ -142,7 +142,7 @@ public:
GRAPHICS_IMPORTER_BUFFER m_buffer; 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_name = aName;
m_baseX = aX; m_baseX = aX;
@ -162,7 +162,7 @@ public:
bool m_bold; bool m_bold;
bool m_italic; 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 ) bool aItalic )
{ {
m_name = aName; m_name = aName;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -43,7 +43,8 @@ public:
PCB_EXPR_UCODE() {}; PCB_EXPR_UCODE() {};
virtual ~PCB_EXPR_UCODE() {}; virtual ~PCB_EXPR_UCODE() {};
virtual std::unique_ptr<LIBEVAL::VAR_REF> CreateVarRef( const wxString& aVar, const wxString& aField ) override; virtual std::unique_ptr<LIBEVAL::VAR_REF> CreateVarRef( const wxString& aVar,
const wxString& aField ) override;
virtual LIBEVAL::FUNC_CALL_REF CreateFuncCall( const wxString& aName ) override; virtual LIBEVAL::FUNC_CALL_REF CreateFuncCall( const wxString& aName ) override;
}; };

View File

@ -136,7 +136,7 @@ public:
void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; } void SetFormat( PLOT_FORMAT aFormat ) { m_format = aFormat; }
PLOT_FORMAT GetFormat() const { return m_format; } 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; } wxString GetOutputDirectory() const { return m_outputDirectory; }
void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; } void SetDisableGerberMacros( bool aDisable ) { m_gerberDisableApertMacros = aDisable; }

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at> * Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * 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, 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 ) if( m_progressReporter )
m_progressReporter->Report( "Loading 3D models..." ); m_progressReporter->Report( "Loading 3D models..." );

View File

@ -144,7 +144,7 @@ private:
void ParseDimensions6Data( void ParseDimensions6Data(
const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ); const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry );
void ParseModelsData( const CFB::CompoundFileReader& aReader, 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( void ParseNets6Data(
const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry ); const CFB::CompoundFileReader& aReader, const CFB::COMPOUND_FILE_ENTRY* aEntry );
void ParsePolygons6Data( void ParsePolygons6Data(

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com> * Copyright (C) 2020 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
* 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 * 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 * 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 class CADSTAR_PCB_ARCHIVE_PARSER : public CADSTAR_ARCHIVE_PARSER
{ {
public: public:
explicit CADSTAR_PCB_ARCHIVE_PARSER( wxString aFilename ) explicit CADSTAR_PCB_ARCHIVE_PARSER( const wxString& aFilename )
: Filename( aFilename ), Header(), Assignments(), CADSTAR_ARCHIVE_PARSER() : Filename( aFilename ), Header(), Assignments(), CADSTAR_ARCHIVE_PARSER()
{ {
KiCadUnitMultiplier = 10; // assume hundredth micron KiCadUnitMultiplier = 10; // assume hundredth micron
@ -474,8 +474,8 @@ public:
/** /**
* @brief From CADSTAR Help: "This parameter indicates the physical layers on which the selected * @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 is placed. Note: When you change the Side parameter in PCB Design, the Side assigned to
* pad in the library is not overwritten." * the pad in the library is not overwritten."
*/ */
enum class PAD_SIDE enum class PAD_SIDE
{ {
@ -490,14 +490,14 @@ public:
static PAD_SIDE GetPadSide( const wxString& aPadSideString ); static PAD_SIDE GetPadSide( const wxString& aPadSideString );
/** /**
* @brief From CADSTAR help: "For specifying the directions in which routes can enter or exit the * @brief From CADSTAR help: "For specifying the directions in which routes can enter or exit
* pad. There are eight pre-defined directions to choose from, North, South, East, West, * 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 * North-East, North-West, South-East and South-West, plus "Free Angle" which allows routes to
* in any direction. * exit in any direction.
* *
* If none of the direction boxes are checked, the system uses the default which is all directions * If none of the direction boxes are checked, the system uses the default which is all
* (as shown above) for all pad shapes, except the long (drawn) Routes exit from the short sides of * directions (as shown above) for all pad shapes, except the long (drawn) Routes exit from
* long pads - in other words in line with the long axis. * 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 * 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." * when it is used on a PCB Design, the Exit Directions will rotate with it."
@ -801,9 +801,11 @@ public:
std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues; std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> AttributeValues;
bool Fixed = false; bool Fixed = false;
GROUP_ID GroupID = wxEmptyString; ///< If not empty, this CADSTAR_BOARD is part of a group ///< If not empty, this CADSTAR_BOARD is part of a group
REUSEBLOCKREF ReuseBlockRef; ///< Normally CADSTAR_BOARD cannot be part of a reuseblock, GROUP_ID GroupID = wxEmptyString;
///< but included for completeness
///< Normally CADSTAR_BOARD cannot be part of a reuseblock, but included for completeness.
REUSEBLOCKREF ReuseBlockRef;
void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override; void Parse( XNODE* aNode, PARSER_CONTEXT* aContext ) override;
}; };
@ -984,7 +986,8 @@ public:
bool Fixed = false; bool Fixed = false;
VERTEX Vertex; 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 struct ROUTE : PARSER ///< "ROUTE" nodename
@ -1069,7 +1072,8 @@ public:
long AdditionalIsolation; ///< This is the gap to apply in routes and pads long AdditionalIsolation; ///< This is the gap to apply in routes and pads
///< in addition to the existing pad-to-copper or ///< in addition to the existing pad-to-copper or
///< route-to-copper spacing (see SPACINGCODE.ID) ///< 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 ThermalReliefViasAngle; ///< Disabled when !ThermalReliefOnVias (param6)
long MinIsolatedCopper = UNDEFINED_VALUE; ///< The value is the length of one side of long MinIsolatedCopper = UNDEFINED_VALUE; ///< The value is the length of one side of
///< a notional square. Disabled when ///< a notional square. Disabled when

View File

@ -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; wxRegEx reRef;
reRef.Compile( wxT( "^[[:digit:]][[:digit:]]*$" ) ); reRef.Compile( wxT( "^[[:digit:]][[:digit:]]*$" ) );
if( reRef.Matches( aRef ) ) wxString retv = aRef;
aRef.Prepend( wxT( '.' ) );
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 ) const wxString& aActualConversion )
{ {
*aWidth = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxString tmp = aStr;
*aWidth = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ),
wxT( ' ' ), aActualConversion ); wxT( ' ' ), aActualConversion );
} }
void SetHeight( wxString aStr, const wxString& aDefaultMeasurementUnit, int* aHeight, void SetHeight( const wxString& aStr, const wxString& aDefaultMeasurementUnit, int* aHeight,
const wxString& aActualConversion ) const wxString& aActualConversion )
{ {
*aHeight = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxString tmp = aStr;
*aHeight = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ),
wxT( ' ' ), aActualConversion ); 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 ) const wxString& aActualConversion )
{ {
*aX = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxString tmp = aStr;
*aX = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ),
wxT( 'X' ), aActualConversion ); wxT( 'X' ), aActualConversion );
*aY = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), *aY = StrToIntUnits( GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ),
wxT( 'Y' ), aActualConversion ); wxT( 'Y' ), aActualConversion );
} }
void SetDoublePrecisionPosition( wxString aStr, const wxString& aDefaultMeasurementUnit, double* aX, void SetDoublePrecisionPosition( const wxString& aStr, const wxString& aDefaultMeasurementUnit,
double* aY, const wxString& aActualConversion ) double* aX, double* aY, const wxString& aActualConversion )
{ {
wxString tmp = aStr;
*aX = StrToDoublePrecisionUnits( *aX = StrToDoublePrecisionUnits(
GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxT( 'X' ), GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( 'X' ),
aActualConversion ); aActualConversion );
*aY = StrToDoublePrecisionUnits( *aY = StrToDoublePrecisionUnits(
GetAndCutWordWithMeasureUnits( &aStr, aDefaultMeasurementUnit ), wxT( 'Y' ), GetAndCutWordWithMeasureUnits( &tmp, aDefaultMeasurementUnit ), wxT( 'Y' ),
aActualConversion ); aActualConversion );
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk> * Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2008, 2012 Alexander Lunev <al.lunev@yahoo.com> * Copyright (C) 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -68,22 +68,23 @@ struct TTEXTVALUE
extern wxString GetWord( wxString* aStr ); extern wxString GetWord( wxString* aStr );
extern XNODE* FindPinMap( XNODE* aNode ); 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, extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
const wxString& aDefaultMeasurementUnit ); const wxString& aDefaultMeasurementUnit );
extern int StrToInt1Units( const wxString& aStr ); extern int StrToInt1Units( const wxString& aStr );
extern wxString ValidateName( wxString aName ); extern wxString ValidateName( const wxString& aName );
extern wxString ValidateReference( wxString aRef ); extern wxString ValidateReference( const wxString& aRef );
extern void SetWidth( wxString aStr, extern void SetWidth( const wxString& aStr,
const wxString& aDefaultMeasurementUnit, const wxString& aDefaultMeasurementUnit,
int* aWidth, int* aWidth,
const wxString& aActualConversion ); const wxString& aActualConversion );
extern void SetPosition( wxString aStr, extern void SetPosition( const wxString& aStr,
const wxString& aDefaultMeasurementUnit, const wxString& aDefaultMeasurementUnit,
int* aX, int* aX,
int* aY, int* aY,
const wxString& aActualConversion ); const wxString& aActualConversion );
extern void SetDoublePrecisionPosition( wxString aStr, extern void SetDoublePrecisionPosition( const wxString& aStr,
const wxString& aDefaultMeasurementUnit, const wxString& aDefaultMeasurementUnit,
double* aX, double* aX,
double* aY, double* aY,

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk> * Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com> * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev <al.lunev@yahoo.com>
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -54,7 +54,11 @@ public:
virtual void AddToBoard() = 0; virtual void AddToBoard() = 0;
PCB_LAYER_ID GetKiCadLayer() const { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } 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; int m_tag;
char m_objType; char m_objType;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -56,7 +56,7 @@
#include "drc_proto.h" #include "drc_proto.h"
PROJECT_CONTEXT loadKicadProject( wxString filename, OPT<wxString> rulesFilePath ) PROJECT_CONTEXT loadKicadProject( const wxString& filename, OPT<wxString> rulesFilePath )
{ {
PROJECT_CONTEXT rv; PROJECT_CONTEXT rv;
@ -72,8 +72,6 @@ PROJECT_CONTEXT loadKicadProject( wxString filename, OPT<wxString> rulesFilePath
schName.SetExt( KiCadSchematicFileExtension ); schName.SetExt( KiCadSchematicFileExtension );
ruleFileName.SetExt( DesignRulesFileExtension ); ruleFileName.SetExt( DesignRulesFileExtension );
brdName.MakeAbsolute(); brdName.MakeAbsolute();
schName.MakeAbsolute(); schName.MakeAbsolute();
ruleFileName.MakeAbsolute(); ruleFileName.MakeAbsolute();
@ -91,7 +89,6 @@ PROJECT_CONTEXT loadKicadProject( wxString filename, OPT<wxString> rulesFilePath
else else
rv.rulesFilePath = ruleFileName.GetFullPath(); rv.rulesFilePath = ruleFileName.GetFullPath();
if( wxFileExists( schName.GetFullPath() ) ) if( wxFileExists( schName.GetFullPath() ) )
{ {
//printf("Generating SCH netlist for '%s'\n", (const char*) schName.GetFullPath() ); //printf("Generating SCH netlist for '%s'\n", (const char*) schName.GetFullPath() );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -112,7 +112,10 @@ private:
virtual bool updateUI() override virtual bool updateUI() override
{ {
m_log->SetColor( CONSOLE_LOG::GREEN ); 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; return true;
} }
@ -128,7 +131,8 @@ public:
~CONSOLE_MSG_REPORTER() {}; ~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 ) switch( aSeverity )
{ {
@ -157,15 +161,18 @@ private:
}; };
struct PROJECT_CONTEXT { struct PROJECT_CONTEXT
{
PROJECT* project; PROJECT* project;
wxString rulesFilePath; wxString rulesFilePath;
std::shared_ptr<BOARD> board; std::shared_ptr<BOARD> board;
std::shared_ptr<NETLIST> netlist; std::shared_ptr<NETLIST> netlist;
}; };
PROJECT_CONTEXT loadKicadProject( wxString filename, OPT<wxString> rulesFilePath ); PROJECT_CONTEXT loadKicadProject( const wxString& filename, OPT<wxString> rulesFilePath );
int runDRCProto( PROJECT_CONTEXT project, std::shared_ptr<KIGFX::VIEW_OVERLAY> aDebugOverlay = nullptr);
int runDRCProto( PROJECT_CONTEXT project,
std::shared_ptr<KIGFX::VIEW_OVERLAY> aDebugOverlay = nullptr );
#endif #endif

View File

@ -217,24 +217,24 @@ public:
virtual void SetIteration( int iter ) override { m_iter = iter; } 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; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
virtual void NewStage( const std::string& name, int iter, virtual void NewStage( const std::string& name, int iter,
const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override; 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; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
virtual void EndGroup( 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, 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; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
virtual void AddLine( const SHAPE_LINE_CHAIN& aLine, const KIGFX::COLOR4D& aColor, 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; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
virtual void AddSegment( SEG aS, const KIGFX::COLOR4D& aColor, 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; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
virtual void AddBox( BOX2I aB, const KIGFX::COLOR4D& aColor, 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; const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
virtual void Clear(){}; virtual void Clear(){};