From 5d429ed977e7509a7916e796c1392fff32188b32 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 14 Dec 2015 09:00:49 +0100 Subject: [PATCH] Pcbnew: drill file generation: always creates a NPTH file in separate files mode (as it was made in initial code) to avoid mistakes (old broken NPTH file after board edition for instance). Eeschema: prepare case sensitive label comparison in netlist generation. --- eeschema/netlist.cpp | 22 +++++++++++++++++-- pcbnew/exporters/gendrill_Excellon_writer.cpp | 9 +++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 3a4c61fcfd..a518ec07b2 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -50,6 +50,24 @@ #define IS_WIRE false #define IS_BUS true +/** @brief Kicad can use case sensitive or case insensitive comparisons for labels + * Currently, it uses case insensitive. + * Can be changed by defining LABEL_KEEPCASE (uncomment next line). + */ +//#define LABEL_KEEPCASE +/// Compiler controlled string compare function, either case independent or not: +inline int CmpLabel_KEEPCASE( const wxString& aString1, const wxString& aString2 ) +{ +#ifdef LABEL_KEEPCASE + // case specificity, the normal behavior: + return aString1.Cmp( aString2 ); +#else + // case independence (only for guys who want that: not recommended) + return aString1.CmpNoCase( aString2 ); +#endif +} + + //Imported function: int TestDuplicateSheetNames( bool aCreateMarker ); @@ -602,7 +620,7 @@ void NETLIST_OBJECT_LIST::sheetLabelConnect( NETLIST_OBJECT* SheetLabel ) if( ObjetNet->GetNet() == SheetLabel->GetNet() ) continue; //already connected. - if( ObjetNet->m_Label.CmpNoCase( SheetLabel->m_Label ) != 0 ) + if( CmpLabel_KEEPCASE( ObjetNet->m_Label, SheetLabel->m_Label ) != 0 ) continue; //different names. // Propagate Netcode having all the objects of the same Netcode. @@ -853,7 +871,7 @@ void NETLIST_OBJECT_LIST::labelConnect( NETLIST_OBJECT* aLabelRef ) // NET_PINLABEL is a kind of global label (generated by a power pin invisible) if( item->IsLabelType() ) { - if( item->m_Label.CmpNoCase( aLabelRef->m_Label ) != 0 ) + if( CmpLabel_KEEPCASE( item->m_Label, aLabelRef->m_Label ) != 0 ) continue; if( item->GetNet() ) diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index b6d0bfe6d0..af2747ffe8 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -6,8 +6,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 Jean_Pierre Charras - * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean_Pierre Charras + * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 1992-2015 KiCad Developers, see change_log.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 @@ -100,7 +101,9 @@ void EXCELLON_WRITER::CreateDrillandMapFilesSet( const wxString& aPlotDirectory, BuildHolesList( pair, doing_npth ); - if( GetHolesCount() > 0 ) // has holes? + // The file is created if it has holes, or if it is the non plated drill file + // to be sure the NPTH file is up to date in separate files mode. + if( GetHolesCount() > 0 || doing_npth ) { fn = drillFileName( pair, doing_npth ); fn.SetPath( aPlotDirectory );