From e3d69b619fe1b82026d0410a3b7a9be6a4b81112 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 30 Jun 2017 16:03:01 +0200 Subject: [PATCH] Pcbnew: fix issue in dialog_fp_lib_table: when the only changes were the plugin name, changes were not taken in account. Because the FP_LIB_TABLE::operator == was incorrect --- common/fp_lib_table.cpp | 17 +++++++++++++++++ include/fp_lib_table.h | 5 +++++ pcbnew/dialogs/dialog_fp_lib_table.cpp | 2 +- pcbnew/router/pns_kicad_iface.cpp | 8 ++++---- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 358d95ac97..24d32a1e07 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -186,6 +186,23 @@ void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) } +bool FP_LIB_TABLE::operator==( const FP_LIB_TABLE& aFpTable ) const +{ + if( rows.size() == aFpTable.rows.size() ) + { + for( unsigned i = 0; i < rows.size(); ++i ) + { + if( (FP_LIB_TABLE_ROW&)rows[i] != (FP_LIB_TABLE_ROW&)aFpTable.rows[i] ) + return false; + } + + return true; + } + + return false; +} + + void FP_LIB_TABLE::Format( OUTPUTFORMATTER* aOutput, int aIndentLevel ) const { aOutput->Print( aIndentLevel, "(fp_lib_table\n" ); diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 7d1e6c62ac..b28756d5e9 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -122,6 +122,11 @@ public: */ FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable = NULL ); + + bool operator==( const FP_LIB_TABLE& aFpTable ) const; + + bool operator!=( const FP_LIB_TABLE& r ) const { return !( *this == r ); } + /** * Function FindRow * diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index 9b1c65066a..08d981b569 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2013 CERN - * Copyright (C) 2012-2017 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2012-2017 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 diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index db8f7b4436..0c5ea1f0a4 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -248,25 +248,25 @@ int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( wxString aNetName, wxString& aCompl aComplementNet = "P"; rv = -1; } - // Match P followed by 2 digits + // Match P followed by 2 digits else if( aNetName.Right( 2 ).IsNumber() && aNetName.Right( 3 ).Left( 1 ) == "P" ) { aComplementNet = "N" + aNetName.Right( 2 ); rv = 1; } - // Match P followed by 1 digit + // Match P followed by 1 digit else if( aNetName.Right( 1 ).IsNumber() && aNetName.Right( 2 ).Left( 1 ) == "P" ) { aComplementNet = "N" + aNetName.Right( 1 ); rv = 1; } - // Match N followed by 2 digits + // Match N followed by 2 digits else if( aNetName.Right( 2 ).IsNumber() && aNetName.Right( 3 ).Left( 1 ) == "N" ) { aComplementNet = "P" + aNetName.Right( 2 ); rv = -1; } - // Match N followed by 1 digit + // Match N followed by 1 digit else if( aNetName.Right( 1 ).IsNumber() && aNetName.Right( 2 ).Left( 1 ) == "N" ) { aComplementNet = "P" + aNetName.Right( 1 );