diff --git a/.gitignore b/.gitignore index 61fe3ddd64..d6e5901ea8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,9 @@ common/netlist_keywords.* common/netlist_lexer.h common/pcb_plot_params_lexer.h common/page_layout/page_layout_reader_keywords.cpp -common/fp_lib_table_keywords.* +common/lib_table_keywords.* common/gal/opengl/shader_src.h -include/fp_lib_table_lexer.h +include/lib_table_lexer.h include/netlist_lexer.h include/page_layout_reader_lexer.h eeschema/cmp_library_lexer.h diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 79b5dbc132..53fce545cf 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -229,8 +229,8 @@ set( COMMON_SRCS eda_pattern_match.cpp exceptions.cpp filter_reader.cpp - fpid.cpp - fp_lib_table_keywords.cpp + lib_id.cpp + lib_table_keywords.cpp # findkicadhelppath.cpp.notused deprecated, use searchhelpfilefullpath.cpp gbr_metadata.cpp gestfich.cpp @@ -470,20 +470,20 @@ add_dependencies( pcbcommon pcb_lexer_source_files ) # auto-generate s-expression library table code. make_lexer( - ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table.keywords - ${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h - ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp - FP_LIB_TABLE_T + ${CMAKE_CURRENT_SOURCE_DIR}/lib_table.keywords + ${PROJECT_SOURCE_DIR}/include/lib_table_lexer.h + ${CMAKE_CURRENT_SOURCE_DIR}/lib_table_keywords.cpp + LIB_TABLE_T ) add_custom_target( - fp_lib_table_lexer_source_files ALL + lib_table_lexer_source_files ALL DEPENDS - ${PROJECT_SOURCE_DIR}/include/fp_lib_table_lexer.h - ${CMAKE_CURRENT_SOURCE_DIR}/fp_lib_table_keywords.cpp + ${PROJECT_SOURCE_DIR}/include/lib_table_lexer.h + ${CMAKE_CURRENT_SOURCE_DIR}/lib_table_keywords.cpp ) -add_dependencies( common fp_lib_table_lexer_source_files ) +add_dependencies( common lib_table_lexer_source_files ) # auto-generate page layout reader s-expression page_layout_reader_lexer.h # and title_block_reader_keywords.cpp. diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index aafe27d799..ddf79508a9 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -268,14 +268,14 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName ) for( FOOTPRINT_INFO& fp : m_list ) { - FPID fpid; + LIB_ID fpid; wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL, - wxString::Format( wxT( "'%s' is not a valid FPID." ), + wxString::Format( wxT( "'%s' is not a valid LIB_ID." ), GetChars( aFootprintName ) ) ); wxString libNickname = fpid.GetLibNickname(); - wxString footprintName = fpid.GetFootprintName(); + wxString footprintName = fpid.GetLibItemName(); if( libNickname == fp.GetNickname() && footprintName == fp.GetFootprintName() ) return &fp; diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index bc7a89cc92..edd9031993 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -28,14 +28,14 @@ #include #include #include -#include -#include +#include +#include #include #include #define OPT_SEP '|' ///< options separator character -using namespace FP_LIB_TABLE_T; +using namespace LIB_TABLE_T; static const wxChar global_tbl_name[] = wxT( "fp-lib-table" ); @@ -64,7 +64,7 @@ FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) : } -void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw() +void FP_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) throw() { T tok; @@ -244,11 +244,11 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& if( ret ) { // remove "const"-ness, I really do want to set nickname without - // having to copy the FPID and its two strings, twice each. - FPID& fpid = (FPID&) ret->GetFPID(); + // having to copy the LIB_ID and its two strings, twice each. + LIB_ID& fpid = (LIB_ID&) ret->GetFPID(); // Catch any misbehaving plugin, which should be setting internal footprint name properly: - wxASSERT( aFootprintName == (wxString) fpid.GetFootprintName() ); + wxASSERT( aFootprintName == (wxString) fpid.GetLibItemName() ); // and clearing nickname wxASSERT( !fpid.GetLibNickname().size() ); @@ -271,7 +271,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, // Try loading the footprint to see if it already exists, caller wants overwrite // protection, which is atypical, not the default. - wxString fpname = aFootprint->GetFPID().GetFootprintName(); + wxString fpname = aFootprint->GetFPID().GetLibItemName(); std::unique_ptr footprint( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) ); @@ -319,11 +319,11 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname ) } -MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const FPID& aFootprintId ) +MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) { wxString nickname = aFootprintId.GetLibNickname(); - wxString fpname = aFootprintId.GetFootprintName(); + wxString fpname = aFootprintId.GetLibItemName(); if( nickname.size() ) { diff --git a/common/fpid.cpp b/common/lib_id.cpp similarity index 78% rename from common/fpid.cpp rename to common/lib_id.cpp index ba70c67dde..a7be36c6c6 100644 --- a/common/fpid.cpp +++ b/common/lib_id.cpp @@ -2,8 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2012-2016 Wayne Stambaugh + * Copyright (C) 2010-2016 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 @@ -28,7 +28,7 @@ #include // _() #include // TO_UTF8() -#include +#include #include @@ -111,15 +111,15 @@ static int okRevision( const std::string& aField ) //----------------------------------------- -void FPID::clear() +void LIB_ID::clear() { nickname.clear(); - footprint.clear(); + item_name.clear(); revision.clear(); } -int FPID::Parse( const UTF8& aId ) +int LIB_ID::Parse( const UTF8& aId ) { clear(); @@ -130,7 +130,7 @@ int FPID::Parse( const UTF8& aId ) int offset; //============================================== - // in a FPID like discret:R3/rev4 + // in a LIB_ID like discret:R3/rev4 if( rev ) { revNdx = rev - buffer; @@ -161,28 +161,27 @@ int FPID::Parse( const UTF8& aId ) partNdx = 0; } - //========================================= + //========================================= if( partNdx >= revNdx ) - return partNdx; // Error: no footprint name. + return partNdx; // Error: no library item name. - // Be sure the footprint name is valid. - // Some chars can be found in board file (in old board files - // or converted files from an other EDA tool + // Be sure the item name is valid. + // Some chars can be found in legacy files converted files from an other EDA tools. std::string fpname = aId.substr( partNdx, revNdx-partNdx ); ReplaceIllegalFileNameChars( &fpname, '_' ); - SetFootprintName( UTF8( fpname ) ); + SetLibItemName( UTF8( fpname ) ); return -1; } -FPID::FPID( const std::string& aId ) throw( PARSE_ERROR ) +LIB_ID::LIB_ID( const std::string& aId ) throw( PARSE_ERROR ) { int offset = Parse( aId ); if( offset != -1 ) { - THROW_PARSE_ERROR( _( "Illegal character found in FPID string" ), + THROW_PARSE_ERROR( _( "Illegal character found in LIB_ID string" ), wxString::FromUTF8( aId.c_str() ), aId.c_str(), 0, @@ -191,7 +190,7 @@ FPID::FPID( const std::string& aId ) throw( PARSE_ERROR ) } -FPID::FPID( const wxString& aId ) throw( PARSE_ERROR ) +LIB_ID::LIB_ID( const wxString& aId ) throw( PARSE_ERROR ) { UTF8 id = aId; @@ -199,7 +198,7 @@ FPID::FPID( const wxString& aId ) throw( PARSE_ERROR ) if( offset != -1 ) { - THROW_PARSE_ERROR( _( "Illegal character found in FPID string" ), + THROW_PARSE_ERROR( _( "Illegal character found in LIB_ID string" ), aId, id.c_str(), 0, @@ -208,7 +207,7 @@ FPID::FPID( const wxString& aId ) throw( PARSE_ERROR ) } -int FPID::SetLibNickname( const UTF8& aLogical ) +int LIB_ID::SetLibNickname( const UTF8& aLogical ) { int offset = okLogical( aLogical ); @@ -221,25 +220,25 @@ int FPID::SetLibNickname( const UTF8& aLogical ) } -int FPID::SetFootprintName( const UTF8& aFootprintName ) +int LIB_ID::SetLibItemName( const UTF8& aLibItemName ) { - int separation = int( aFootprintName.find_first_of( "/" ) ); + int separation = int( aLibItemName.find_first_of( "/" ) ); if( separation != -1 ) { - footprint = aFootprintName.substr( 0, separation-1 ); + item_name = aLibItemName.substr( 0, separation-1 ); return separation; } else { - footprint = aFootprintName; + item_name = aLibItemName; } return -1; } -int FPID::SetRevision( const UTF8& aRevision ) +int LIB_ID::SetRevision( const UTF8& aRevision ) { int offset = okRevision( aRevision ); @@ -252,7 +251,7 @@ int FPID::SetRevision( const UTF8& aRevision ) } -UTF8 FPID::Format() const +UTF8 LIB_ID::Format() const { UTF8 ret; @@ -262,7 +261,7 @@ UTF8 FPID::Format() const ret += ':'; } - ret += footprint; + ret += item_name; if( revision.size() ) { @@ -274,7 +273,7 @@ UTF8 FPID::Format() const } -UTF8 FPID::GetFootprintNameAndRev() const +UTF8 LIB_ID::GetLibItemNameAndRev() const { UTF8 ret; @@ -288,10 +287,9 @@ UTF8 FPID::GetFootprintNameAndRev() const } -#if 0 // this is broken, it does not output aFootprintName for some reason +#if 0 // this is broken, it does not output aLibItemName for some reason -UTF8 FPID::Format( const UTF8& aLogicalLib, const UTF8& aFootprintName, - const UTF8& aRevision ) +UTF8 LIB_ID::Format( const UTF8& aLogicalLib, const UTF8& aLibItemName, const UTF8& aRevision ) throw( PARSE_ERROR ) { UTF8 ret; @@ -336,23 +334,23 @@ UTF8 FPID::Format( const UTF8& aLogicalLib, const UTF8& aFootprintName, #endif -int FPID::compare( const FPID& aFPID ) const +int LIB_ID::compare( const LIB_ID& aLibId ) const { // Don't bother comparing the same object. - if( this == &aFPID ) + if( this == &aLibId ) return 0; - int retv = nickname.compare( aFPID.nickname ); + int retv = nickname.compare( aLibId.nickname ); if( retv != 0 ) return retv; - retv = footprint.compare( aFPID.footprint ); + retv = item_name.compare( aLibId.item_name ); if( retv != 0 ) return retv; - return revision.compare( aFPID.revision ); + return revision.compare( aLibId.revision ); } @@ -360,7 +358,7 @@ int FPID::compare( const FPID& aFPID ) const // build this with Debug CMAKE_BUILD_TYPE -void FPID::Test() +void LIB_ID::Test() { static const char* lpids[] = { "smt:R_0805/rev0", @@ -372,14 +370,14 @@ void FPID::Test() { // test some round tripping - FPID lpid( lpids[i] ); // parse + LIB_ID lpid( lpids[i] ); // parse // format - printf( "input:'%s' full:'%s' nickname: %s footprint:'%s' rev:'%s'\n", + printf( "input:'%s' full:'%s' nickname: %s item_name:'%s' rev:'%s'\n", lpids[i], lpid.Format().c_str(), lpid.GetLibNickname().c_str(), - lpid.GetFootprintName().c_str(), + lpid.GetLibItemName().c_str(), lpid.GetRevision().c_str() ); } } @@ -387,7 +385,7 @@ void FPID::Test() int main( int argc, char** argv ) { - FPID::Test(); + LIB_ID::Test(); return 0; } diff --git a/common/fp_lib_table.keywords b/common/lib_table.keywords similarity index 100% rename from common/fp_lib_table.keywords rename to common/lib_table.keywords diff --git a/common/lib_table_base.cpp b/common/lib_table_base.cpp index 625563f7a3..73ebf6cfc0 100644 --- a/common/lib_table_base.cpp +++ b/common/lib_table_base.cpp @@ -32,14 +32,14 @@ #include #include #include -#include +#include #include #define OPT_SEP '|' ///< options separator character -using namespace FP_LIB_TABLE_T; +using namespace LIB_TABLE_T; LIB_TABLE_ROW* new_clone( const LIB_TABLE_ROW& aRow ) @@ -93,7 +93,7 @@ void LIB_TABLE_ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const } -void LIB_TABLE_ROW::Parse( std::unique_ptr< LIB_TABLE_ROW >& aRow, FP_LIB_TABLE_LEXER* in ) +void LIB_TABLE_ROW::Parse( std::unique_ptr< LIB_TABLE_ROW >& aRow, LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR ) { /* @@ -350,7 +350,7 @@ void LIB_TABLE::Load( const wxString& aFileName ) if( wxFileName::IsFileReadable( aFileName ) ) { FILE_LINE_READER reader( aFileName ); - FP_LIB_TABLE_LEXER lexer( &reader ); + LIB_TABLE_LEXER lexer( &reader ); Parse( &lexer ); } diff --git a/cvpcb/autosel.cpp b/cvpcb/autosel.cpp index 5b4f21fb15..a60583cd51 100644 --- a/cvpcb/autosel.cpp +++ b/cvpcb/autosel.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -26,7 +26,7 @@ */ // This file handle automatic selection of footprints, from .equ files which give -// a footprint FPID associated to a component value. +// a footprint LIB_ID associated to a component value. // These associations have this form: // 'FT232BL' 'QFP:LQFP-32_7x7mm_Pitch0.8mm' diff --git a/cvpcb/autosel.h b/cvpcb/autosel.h index 30abce0c7c..d329c0871e 100644 --- a/cvpcb/autosel.h +++ b/cvpcb/autosel.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -24,7 +24,7 @@ #ifndef AUTOSEL_H #define AUTOSEL_H -// A helper class to handle info read in .equ files, which gives a footprint FPID +// A helper class to handle info read in .equ files, which gives a footprint LIB_ID // corresponding to a component value. // Each line is something like: // 'FT232BL' 'QFP:LQFP-32_7x7mm_Pitch0.8mm' @@ -35,7 +35,7 @@ class FOOTPRINT_EQUIVALENCE { public: wxString m_ComponentValue; // The value of a component - wxString m_FootprintFPID; // the footprint FPID corresponding to this value + wxString m_FootprintFPID; // the footprint LIB_ID corresponding to this value FOOTPRINT_EQUIVALENCE() {} }; diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 285727ac9c..50706ecb58 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -2,8 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2015 Wayne Stambaugh - * Copyright (C) 2007-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2016 Wayne Stambaugh + * Copyright (C) 2007-2016 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 @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -446,7 +446,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName ) try { - FPID fpid; + LIB_ID fpid; if( fpid.Parse( aFootprintName ) >= 0 ) { @@ -456,7 +456,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName ) } std::string nickname = fpid.GetLibNickname(); - std::string fpname = fpid.GetFootprintName(); + std::string fpname = fpid.GetLibItemName(); wxLogDebug( wxT( "Load footprint <%s> from library <%s>." ), fpname.c_str(), nickname.c_str() ); diff --git a/cvpcb/class_footprints_listbox.cpp b/cvpcb/class_footprints_listbox.cpp index a1afa951a3..74965c3f83 100644 --- a/cvpcb/class_footprints_listbox.cpp +++ b/cvpcb/class_footprints_listbox.cpp @@ -162,7 +162,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a && aComponent->GetNetCount() != aList.GetItem( ii ).GetUniquePadCount() ) continue; - // We can search (Using case insensitive search) in full FPID or only + // We can search (Using case insensitive search) in full LIB_ID or only // in the fp name itself. // After tests, only in the fp name itself looks better. // However, the code to take in account the nickname is just commented, no removed. diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 495a47b365..f4c6ffeda9 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -381,7 +381,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event ) for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) { - FPID fpid; + LIB_ID fpid; m_netlist.GetComponent( i )->SetFPID( fpid ); SetNewPkg( wxEmptyString ); @@ -808,8 +808,8 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist ) // not the actual name of the footprint. for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ ) { - if( m_netlist.GetComponent( ii )->GetFPID().GetFootprintName() == std::string( "$noname" ) ) - m_netlist.GetComponent( ii )->SetFPID( FPID( wxEmptyString ) ); + if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) ) + m_netlist.GetComponent( ii )->SetFPID( LIB_ID( wxEmptyString ) ); } // Sort components by reference: @@ -956,7 +956,7 @@ DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame() const wxString CVPCB_MAINFRAME::GetSelectedFootprint() { - // returns the FPID of the selected footprint in footprint listview + // returns the LIB_ID of the selected footprint in footprint listview // or a empty string return m_footprintListBox->GetSelectedFootprint(); } diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index eb405403e1..5471aa8a1c 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -279,7 +279,7 @@ public: COMPONENT* GetSelectedComponent(); /** - * @return the FPID of the selected footprint in footprint listview + * @return the LIB_ID of the selected footprint in footprint listview * or a empty string if no selection */ const wxString GetSelectedFootprint(); diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index f74c744341..4eadc9a1f6 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -6,8 +6,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2011-2016 Wayne Stambaugh + * Copyright (C) 1992-2016 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 @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -74,12 +74,12 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) // Check to see if the component has already a footprint set. hasFootprint = !component->GetFPID().empty(); - FPID fpid; + LIB_ID fpid; if( !aFootprintName.IsEmpty() ) { wxCHECK_RET( fpid.Parse( aFootprintName ) < 0, - wxString::Format( wxT( "<%s> is not a valid FPID." ), + wxString::Format( wxT( "<%s> is not a valid LIB_ID." ), GetChars( aFootprintName ) ) ); } @@ -116,16 +116,16 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) } -/// Return true if the resultant FPID has a certain nickname. The guess +/// Return true if the resultant LIB_ID has a certain nickname. The guess /// is only made if this footprint resides in only one library. /// @return int - 0 on success, 1 on not found, 2 on ambiguous i.e. multiple matches -static int guessNickname( FP_LIB_TABLE* aTbl, FPID* aFootprintId ) +static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId ) { if( aFootprintId->GetLibNickname().size() ) return 0; wxString nick; - wxString fpname = aFootprintId->GetFootprintName(); + wxString fpname = aFootprintId->GetLibItemName(); std::vector nicks = aTbl->GetLogicalLibs(); @@ -194,7 +194,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) { msg = _( "Some of the assigned footprints are legacy entries (are missing lib nicknames). " - "Would you like CvPcb to attempt to convert them to the new required FPID format? " + "Would you like CvPcb to attempt to convert them to the new required LIB_ID format? " "(If you answer no, then these assignments will be cleared out and you will " "have to re-assign these footprints yourself.)" ); @@ -214,7 +214,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) // get this first here, it's possibly obsoleted if we get it too soon. FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs(); - int guess = guessNickname( tbl, (FPID*) &component->GetFPID() ); + int guess = guessNickname( tbl, (LIB_ID*) &component->GetFPID() ); switch( guess ) { @@ -228,7 +228,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) msg += wxString::Format( _( "Component '%s' footprint '%s' was not found in any library.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().GetFootprintName() ) + GetChars( component->GetFPID().GetLibItemName() ) ); break; @@ -236,7 +236,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) msg += wxString::Format( _( "Component '%s' footprint '%s' was found in multiple libraries.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().GetFootprintName() ) + GetChars( component->GetFPID().GetLibItemName() ) ); break; } @@ -281,7 +281,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles( const std::string& aNetlist ) if( component->GetFPID().IsLegacy() ) { - component->SetFPID( FPID() /* empty */ ); + component->SetFPID( LIB_ID() /* empty */ ); m_modified = true; } } diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index c2acf5b7e9..9dafa4c37d 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -31,7 +31,7 @@ #define CLASS_LIBENTRY_H #include -#include +#include #include #include #include @@ -189,7 +189,7 @@ class LIB_PART : public EDA_ITEM PART_SPTR m_me; ///< http://www.boost.org/doc/libs/1_55_0/libs/smart_ptr/sp_techniques.html#weak_without_shared wxString m_name; - FPID m_libId; + LIB_ID m_libId; int m_pinNameOffset; ///< The offset in mils to draw the pin name. Set to 0 ///< to draw the pin name above the pin. bool m_unitsLocked; ///< True if part has multiple units and changing @@ -239,8 +239,8 @@ public: const wxString& GetName() { return m_name; } - const FPID& GetFPID() const { return m_libId; } - void SetFPID( const FPID& aFPID ) { m_libId = aFPID; } + const LIB_ID& GetLibId() const { return m_libId; } + void SetLibId( const LIB_ID& aLibId ) { m_libId = aLibId; } const wxString GetLibraryName(); diff --git a/eeschema/symbol_lib_table.cpp b/eeschema/symbol_lib_table.cpp index 4be719c513..213079ca82 100644 --- a/eeschema/symbol_lib_table.cpp +++ b/eeschema/symbol_lib_table.cpp @@ -27,14 +27,14 @@ #include #include #include -#include -#include +#include +#include #include #include #define OPT_SEP '|' ///< options separator character -using namespace FP_LIB_TABLE_T; +using namespace LIB_TABLE_T; static const wxChar global_tbl_name[] = wxT( "sym-lib-table" ); @@ -63,7 +63,7 @@ SYMBOL_LIB_TABLE::SYMBOL_LIB_TABLE( SYMBOL_LIB_TABLE* aFallBackTable ) : } -void SYMBOL_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw() +void SYMBOL_LIB_TABLE::Parse( LIB_TABLE_LEXER* in ) throw() { T tok; @@ -243,16 +243,16 @@ LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbol( const wxString& aNickname, const wxStri if( ret ) { // remove "const"-ness, I really do want to set nickname without - // having to copy the FPID and its two strings, twice each. - FPID& fpid = (FPID&) ret->GetPart()->GetFPID(); + // having to copy the LIB_ID and its two strings, twice each. + LIB_ID& id = (LIB_ID&) ret->GetPart()->GetLibId(); // Catch any misbehaving plugin, which should be setting internal alias name properly: - wxASSERT( aAliasName == (wxString) fpid.GetFootprintName() ); + wxASSERT( aAliasName == (wxString) id.GetLibItemName() ); // and clearing nickname - wxASSERT( !fpid.GetLibNickname().size() ); + wxASSERT( !id.GetLibNickname().size() ); - fpid.SetLibNickname( row->GetNickName() ); + id.SetLibNickname( row->GetNickName() ); } return ret; @@ -270,7 +270,7 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname // Try loading the footprint to see if it already exists, caller wants overwrite // protection, which is atypical, not the default. - wxString name = aSymbol->GetFPID().GetFootprintName(); + wxString name = aSymbol->GetLibId().GetLibItemName(); std::unique_ptr< LIB_ALIAS > symbol( row->plugin->LoadSymbol( row->GetFullURI( true ), name, @@ -328,11 +328,11 @@ void SYMBOL_LIB_TABLE::CreateSymbolLib( const wxString& aNickname ) } -LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const FPID& aFootprintId ) +LIB_ALIAS* SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname( const LIB_ID& aLibId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) { - wxString nickname = aFootprintId.GetLibNickname(); - wxString name = aFootprintId.GetFootprintName(); + wxString nickname = aLibId.GetLibNickname(); + wxString name = aLibId.GetLibItemName(); if( nickname.size() ) { diff --git a/eeschema/symbol_lib_table.h b/eeschema/symbol_lib_table.h index 65d5f92288..ac2a301efa 100644 --- a/eeschema/symbol_lib_table.h +++ b/eeschema/symbol_lib_table.h @@ -29,7 +29,6 @@ #include class LIB_PART; -class IO_ERROR; /** * Class SYMBOL_LIB_TABLE_ROW @@ -102,7 +101,7 @@ class SYMBOL_LIB_TABLE : public LIB_TABLE { public: - virtual void Parse( FP_LIB_TABLE_LEXER* aLexer ) throw() override; + virtual void Parse( LIB_TABLE_LEXER* aLexer ) throw() override; virtual void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw() override; @@ -254,7 +253,7 @@ public: * is thrown in the case where aId cannot be found. * @throw PARSE_ERROR if @a atId is not parsed OK. */ - LIB_ALIAS* LoadSymbolWithOptionalNickname( const FPID& aId ) + LIB_ALIAS* LoadSymbolWithOptionalNickname( const LIB_ID& aId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ); /** diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 38783fcc5c..572185ff99 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -31,7 +31,6 @@ class MODULE; class FP_TBL_MODEL; -class IO_ERROR; /** * Class FP_LIB_TABLE_ROW @@ -104,7 +103,7 @@ class FP_LIB_TABLE : public LIB_TABLE { public: - virtual void Parse( FP_LIB_TABLE_LEXER* aLexer ) throw() override; + virtual void Parse( LIB_TABLE_LEXER* aLexer ) throw() override; virtual void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw() override; @@ -234,7 +233,7 @@ public: * is thrown in the case where aFootprintName cannot be found. * @throw PARSE_ERROR if @a aFootprintId is not parsed OK. */ - MODULE* FootprintLoadWithOptionalNickname( const FPID& aFootprintId ) + MODULE* FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ); /** diff --git a/include/fpid.h b/include/fpid.h deleted file mode 100644 index 137137d257..0000000000 --- a/include/fpid.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 2010 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 - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef _FPID_H_ -#define _FPID_H_ - -#include -#include - -/** - * Class FPID - * is a Logical Footprint ID and consists of various portions much like a URI. - * It is a container for the separated portions of a logical footprint id so they - * can be accessed individually. The various portions of an FPID are: - * logicalLibraryName (nick name), footprint name, and revision. The logical library - * name and the footprint name are mandatory. The revision is optional and currently is - * not used. - * - * Example FPID string: - * "smt:R_0805/rev0". - * - *

- *

    - *
  • "smt" is the logical library name used to look up library information saved in the - * #FP_LIB_TABLE. - *
  • "R" is the name of the footprint within the library. - *
  • "rev0" is the revision, which is optional. If missing then its - * / delimiter should also not be present. A revision must begin with - * "rev" and be followed by at least one or more decimal digits. - *
- * - * @author Dick Hollenbeck - */ -class FPID -{ -public: - - FPID() {} - - /** - * Constructor FPID - * takes \a aId string and parses it. A typical FPID string consists of a - * library nickname followed by a footprint name. - * e.g.: "smt:R_0805", or - * e.g.: "mylib:R_0805" - * - * @param aId is a string to be parsed into the FPID object. - */ - FPID( const std::string& aId ) throw( PARSE_ERROR ); - - FPID( const wxString& aId ) throw( PARSE_ERROR ); - - /** - * Function Parse - * [re-]stuffs this FPID with the information from @a aId. - * - * @param aId is the string to populate the #FPID object. - * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into - * aId at which an error was detected. - */ - int Parse( const UTF8& aId ); - - - /** - * Function GetLibNickname - * returns the logical library name portion of a FPID. - */ - const UTF8& GetLibNickname() const - { - return nickname; - } - - /** - * Function SetLibNickname - * overrides the logical footprint library name portion of the FPID to @a aNickname. - * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset - * into the parameter at which an error was detected, usually because it - * contained '/' or ':'. - */ - int SetLibNickname( const UTF8& aNickname ); - - /** - * Function GetFootprintName - * returns the footprint name, i.e. footprintName. - */ - const UTF8& GetFootprintName() const { return footprint; } - - /** - * Function SetFootprintName - * overrides the footprint name portion of the FPID to @a aFootprintName - * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset - * into the parameter at which an error was detected, usually because it - * contained '/'. - */ - int SetFootprintName( const UTF8& aFootprintName ); - - int SetRevision( const UTF8& aRevision ); - - const UTF8& GetRevision() const { return revision; } - - UTF8 GetFootprintNameAndRev() const; - - /** - * Function Format - * returns the fully formatted text of the FPID. - */ - UTF8 Format() const; - - /** - * Function Format - * returns a wxString in the proper format as an FPID for a combination of - * aLibNickname, aFootprintName, and aRevision. - * - * @throw PARSE_ERROR if any of the pieces are illegal. - static UTF8 Format( const UTF8& aLibNickname, const UTF8& aFootprintName, - const UTF8& aRevision = "" ) - throw( PARSE_ERROR ); - */ - - /** - * Function IsValid - * @return true is the #FPID is valid. - * - * A valid #FPID must have both the footprint library nickname and the footprint name - * defined. The revision field is optional. - * - * @note A return value of true does not indicated that the #FPID is a valid #FP_LIB_TABLE - * entry. - */ - bool IsValid() const { return !nickname.empty() && !footprint.empty(); } - - /** - * Function IsLegacy - * @return true if the #FPID only has the #footprint name defined. - */ - bool IsLegacy() const { return nickname.empty() && !footprint.empty() && revision.empty(); } - - /** - * Function clear - * clears the contents of the library nickname, footprint name, and revision strings. - */ - void clear(); - - /** - * Function empty - * @return a boolean true value if the FPID is empty. Otherwise return false. - */ - bool empty() const { return nickname.empty() && footprint.empty() && revision.empty(); } - - /** - * Function Compare - * compares the contents of FPID objects by performing a std::string comparison of the - * library nickname, footprint name, and revision strings respectively. - * - * @param aFPID is the FPID to compare against. - * @return -1 if less than \a aFPID, 1 if greater than \a aFPID, and 0 if equal to \a aFPID. - */ - int compare( const FPID& aFPID ) const; - - bool operator < ( const FPID& aFPID ) const { return this->compare( aFPID ) < 0; } - bool operator > ( const FPID& aFPID ) const { return this->compare( aFPID ) > 0; } - bool operator ==( const FPID& aFPID ) const { return this->compare( aFPID ) == 0; } - bool operator !=( const FPID& aFPID ) const { return !(*this == aFPID); } - -#if defined(DEBUG) - static void Test(); -#endif - -protected: - UTF8 nickname; ///< The nickname of the footprint library or empty. - UTF8 footprint; ///< The name of the footprint in the logical library. - UTF8 revision; ///< The footprint revision. -}; - - -#endif // _FPID_H_ diff --git a/include/lib_id.h b/include/lib_id.h new file mode 100644 index 0000000000..ca38ceef54 --- /dev/null +++ b/include/lib_id.h @@ -0,0 +1,216 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2012-2016 Wayne Stambaugh + * Copyright (C) 2010-2016 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 + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _LIB_ID_H_ +#define _LIB_ID_H_ + +#include +#include + +/** + * Class LIB_ID + * + * is a logical library item identifier and consists of various portions much like a URI. + * It consists of of triad of the library nickname, the name of the item in the library, + * and an optional revision of the item. This is a generic library identifier that can be + * used for any type of library that contains multiple named items such as footprint or + * symbol libraries. + * + * Example LIB_ID string: + * "smt:R_0805/rev0". + * + *

+ *

    + *
  • "smt" is the logical library name used to look up library information saved in the + * #LIB_TABLE. + *
  • "R" is the name of the item within the library. + *
  • "rev0" is the revision, which is optional. If missing then its + * / delimiter should also not be present. A revision must begin with + * "rev" and be followed by at least one or more decimal digits. + *
+ * + * @author Dick Hollenbeck + */ +class LIB_ID +{ +public: + + LIB_ID() {} + + /** + * Constructor LIB_ID + * + * takes \a aId string and parses it. A typical LIB_ID string consists of a + * library nickname followed by a library item name. + * e.g.: "smt:R_0805", or + * e.g.: "mylib:R_0805", or + * e.g.: "ttl:7400" + * + * @param aId is a string to be parsed into the LIB_ID object. + */ + LIB_ID( const std::string& aId ) throw( PARSE_ERROR ); + + LIB_ID( const wxString& aId ) throw( PARSE_ERROR ); + + /** + * Function Parse + * + * [re-]stuffs this LIB_ID with the information from @a aId. + * + * @param aId is the string to populate the #LIB_ID object. + * + * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into + * aId at which an error was detected. + */ + int Parse( const UTF8& aId ); + + + /** + * Function GetLibNickname + * + * returns the logical library name portion of a LIB_ID. + */ + const UTF8& GetLibNickname() const + { + return nickname; + } + + /** + * Function SetLibNickname + * + * overrides the logical library name portion of the LIB_ID to @a aNickname. + * + * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset + * into the parameter at which an error was detected, usually because it + * contained '/' or ':'. + */ + int SetLibNickname( const UTF8& aNickname ); + + /** + * Function GetLibItemName + * + * @return the library item name, i.e. footprintName. + */ + const UTF8& GetLibItemName() const { return item_name; } + + /** + * Function SetLibItemName + * + * overrides the library item name portion of the LIB_ID to @a aLibItemName + * + * @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset + * into the parameter at which an error was detected, usually because it + * contained '/'. + */ + int SetLibItemName( const UTF8& aLibItemName ); + + int SetRevision( const UTF8& aRevision ); + + const UTF8& GetRevision() const { return revision; } + + UTF8 GetLibItemNameAndRev() const; + + /** + * Function Format + * + * @return the fully formatted text of the LIB_ID. + */ + UTF8 Format() const; + + /** + * Function Format + * + * @return a string in the proper format as an LIB_ID for a combination of + * aLibNickname, aLibItemName, and aRevision. + * + * @throw PARSE_ERROR if any of the pieces are illegal. + static UTF8 Format( const UTF8& aLibNickname, const UTF8& aLibItemName, + const UTF8& aRevision = "" ) + throw( PARSE_ERROR ); + */ + + /** + * Function IsValid + * + * @return true is the #LIB_ID is valid. + * + * A valid #LIB_ID must have both the library nickname and the library item name defined. + * The revision field is optional. + * + * @note A return value of true does not indicated that the #LIB_ID is a valid #LIB_TABLE + * entry. + */ + bool IsValid() const { return !nickname.empty() && !item_name.empty(); } + + /** + * Function IsLegacy + * + * @return true if the #LIB_ID only has the #item_name name defined. + */ + bool IsLegacy() const { return nickname.empty() && !item_name.empty() && revision.empty(); } + + /** + * Function clear + * + * clears the contents of the library nickname, library entry name, and revision strings. + */ + void clear(); + + /** + * Function empty + * + * @return a boolean true value if the LIB_ID is empty. Otherwise return false. + */ + bool empty() const { return nickname.empty() && item_name.empty() && revision.empty(); } + + /** + * Function Compare + * + * compares the contents of LIB_ID objects by performing a std::string comparison of the + * library nickname, library entry name, and revision strings respectively. + * + * @param aLibId is the LIB_ID to compare against. + * + * @return -1 if less than \a aLibId, 1 if greater than \a aLibId, and 0 if equal to \a aLibId. + */ + int compare( const LIB_ID& aLIB_ID ) const; + + bool operator < ( const LIB_ID& aLibId ) const { return this->compare( aLibId ) < 0; } + bool operator > ( const LIB_ID& aLibId ) const { return this->compare( aLibId ) > 0; } + bool operator ==( const LIB_ID& aLibId ) const { return this->compare( aLibId ) == 0; } + bool operator !=( const LIB_ID& aLibId ) const { return !(*this == aLibId); } + +#if defined(DEBUG) + static void Test(); +#endif + +protected: + UTF8 nickname; ///< The nickname of the library or empty. + UTF8 item_name; ///< The name of the entry in the logical library. + UTF8 revision; ///< The revision of the entry. +}; + + +#endif // _LIB_ID_H_ diff --git a/include/lib_table_base.h b/include/lib_table_base.h index 07ab075aaa..9b34916a7b 100644 --- a/include/lib_table_base.h +++ b/include/lib_table_base.h @@ -40,8 +40,8 @@ #define FP_LATE_ENVVAR 1 ///< late=1/early=0 environment variable expansion class OUTPUTFORMATTER; -class FP_LIB_TABLE_LEXER; -class FPID; +class LIB_TABLE_LEXER; +class LIB_ID; class LIB_TABLE_ROW; class IO_ERROR; @@ -181,7 +181,7 @@ public: void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw( IO_ERROR, boost::interprocess::lock_exception ); - static void Parse( std::unique_ptr< LIB_TABLE_ROW >& aRow, FP_LIB_TABLE_LEXER* in ) + static void Parse( std::unique_ptr< LIB_TABLE_ROW >& aRow, LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR ); LIB_TABLE_ROW* clone() const @@ -279,7 +279,7 @@ class LIB_TABLE : public PROJECT::_ELEM public: - virtual void Parse( FP_LIB_TABLE_LEXER* aLexer ) throw() = 0; + virtual void Parse( LIB_TABLE_LEXER* aLexer ) throw() = 0; virtual void Format( OUTPUTFORMATTER* out, int nestLevel ) const throw() = 0; diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 521a22423c..6aad46a3fe 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -2,8 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2008-2016 Wayne Stambaugh + * Copyright (C) 1992-2016 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 @@ -57,7 +57,7 @@ class BOARD_DESIGN_SETTINGS; class ZONE_SETTINGS; class PCB_PLOT_PARAMS; class FP_LIB_TABLE; -class FPID; +class LIB_ID; /** * class PCB_BASE_FRAME @@ -89,13 +89,13 @@ protected: * Function loadFootprint * attempts to load \a aFootprintId from the footprint library table. * - * @param aFootprintId is the #FPID of component footprint to load. + * @param aFootprintId is the #LIB_ID of component footprint to load. * @return the #MODULE if found or NULL if \a aFootprintId not found in any of the * libraries in the table returned from #Prj().PcbFootprintLibs(). * @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error * occurs while reading footprint library files. */ - MODULE* loadFootprint( const FPID& aFootprintId ) + MODULE* loadFootprint( const LIB_ID& aFootprintId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ); public: @@ -114,11 +114,11 @@ public: * Function LoadFootprint * attempts to load \a aFootprintId from the footprint library table. * - * @param aFootprintId is the #FPID of component footprint to load. + * @param aFootprintId is the #LIB_ID of component footprint to load. * @return the #MODULE if found or NULL if \a aFootprintId not found in any of the * libraries in table returned from #Prj().PcbFootprintLibs(). */ - MODULE* LoadFootprint( const FPID& aFootprintId ); + MODULE* LoadFootprint( const LIB_ID& aFootprintId ); /** * Function GetBoardBoundingBox diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index ade7ef2168..921eaf9d7f 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -66,7 +66,7 @@ class cmp public: wxString m_Ref; wxString m_Val; - FPID m_fpid; + LIB_ID m_fpid; int m_Id; int m_CmpCount; }; @@ -173,7 +173,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) msg << current->m_Id << wxT( ";\"" ); msg << current->m_Ref << wxT( "\";\"" ); - msg << FROM_UTF8( current->m_fpid.GetFootprintName().c_str() ) << wxT( "\";" ); + msg << FROM_UTF8( current->m_fpid.GetLibItemName().c_str() ) << wxT( "\";" ); msg << current->m_CmpCount << wxT( ";\"" ); msg << current->m_Val << wxT( "\";;;\n" ); fprintf( fp_bom, "%s", TO_UTF8( msg ) ); diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 66a8afee42..b536e4dd06 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -37,7 +37,7 @@ #include // ALL_LAYERS definition. #include #include -#include +#include #include #include @@ -144,8 +144,8 @@ public: double GetOrientationDegrees() const { return m_Orient/10.0; } double GetOrientationRadians() const { return m_Orient*M_PI/1800; } - const FPID& GetFPID() const { return m_fpid; } - void SetFPID( const FPID& aFPID ) { m_fpid = aFPID; } + const LIB_ID& GetFPID() const { return m_fpid; } + void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; } const wxString& GetDescription() const { return m_Doc; } void SetDescription( const wxString& aDoc ) { m_Doc = aDoc; } @@ -650,7 +650,7 @@ private: wxPoint m_Pos; ///< Position of module on the board in internal units. TEXTE_MODULE* m_Reference; ///< Component reference designator value (U34, R18..) TEXTE_MODULE* m_Value; ///< Component value (74LS00, 22K..) - FPID m_fpid; ///< The #FPID of the MODULE. + LIB_ID m_fpid; ///< The #LIB_ID of the MODULE. int m_Attributs; ///< Flag bits ( see Mod_Attribut ) int m_ModuleStatus; ///< For autoplace: flags (LOCKED, AUTOPLACED) EDA_RECT m_BoundaryBox; ///< Bounding box : coordinates on board, real orientation. diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index d5e88b4fe9..4d2bb7c448 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -9,7 +9,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com - * Copyright (C) 2008-2015 Wayne Stambaugh + * Copyright (C) 2008-2016 Wayne Stambaugh * Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -493,7 +493,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) // Init footprint name in library if( ! footprintName.IsEmpty() ) - m_currentModule->SetFPID( FPID( footprintName ) ); + m_currentModule->SetFPID( LIB_ID( footprintName ) ); // Init Fields: TEXTE_MODULE& reference = m_currentModule->Reference(); diff --git a/pcbnew/dialogs/dialog_fp_lib_table.cpp b/pcbnew/dialogs/dialog_fp_lib_table.cpp index 516b8bb591..730716ba15 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table.cpp @@ -39,7 +39,7 @@ #include <3d_viewer.h> // for KISYS3DMOD #include #include -#include +#include #include #include #include @@ -240,7 +240,7 @@ protected: // at column 0 regardless of current cursor column. STRING_LINE_READER slr( TO_UTF8( cb_text ), "Clipboard" ); - FP_LIB_TABLE_LEXER lexer( &slr ); + LIB_TABLE_LEXER lexer( &slr ); FP_LIB_TABLE tmp_tbl; bool parsed = true; diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index ee83efab87..3c26df49f9 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -2128,7 +2128,7 @@ MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const string& aPkgName ) con { std::unique_ptr m( new MODULE( m_board ) ); - m->SetFPID( FPID( aPkgName ) ); + m->SetFPID( LIB_ID( aPkgName ) ); opt_string description = aPackage.get_optional( "description" ); if( description ) diff --git a/pcbnew/exporters/gen_modules_placefile.cpp b/pcbnew/exporters/gen_modules_placefile.cpp index 8d2d2acac9..5bbfd0370c 100644 --- a/pcbnew/exporters/gen_modules_placefile.cpp +++ b/pcbnew/exporters/gen_modules_placefile.cpp @@ -4,7 +4,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2015-2016 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -487,7 +487,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, lenRefText = std::max( lenRefText, int(item.m_Reference.length()) ); lenValText = std::max( lenValText, int(item.m_Value.length()) ); - lenPkgText = std::max( lenPkgText, int(item.m_Module->GetFPID().GetFootprintName().length()) ); + lenPkgText = std::max( lenPkgText, int(item.m_Module->GetFPID().GetLibItemName().length()) ); } if( aFullFileName.IsEmpty() ) @@ -524,7 +524,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, line << csv_sep; line << list[ii].m_Value; line << csv_sep; - line << wxString( list[ii].m_Module->GetFPID().GetFootprintName() ); + line << wxString( list[ii].m_Module->GetFPID().GetLibItemName() ); line << csv_sep; line << wxString::Format( "%f%c%f%c%f", @@ -579,7 +579,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, const wxString& ref = list[ii].m_Reference; const wxString& val = list[ii].m_Value; - const wxString& pkg = list[ii].m_Module->GetFPID().GetFootprintName(); + const wxString& pkg = list[ii].m_Module->GetFPID().GetLibItemName(); fprintf(file, "%-*s %-*s %-*s %9.4f %9.4f %8.4f %s\n", lenRefText, TO_UTF8( ref ), diff --git a/pcbnew/github/github_plugin.cpp b/pcbnew/github/github_plugin.cpp index bc6e0f9ac6..409acbe432 100644 --- a/pcbnew/github/github_plugin.cpp +++ b/pcbnew/github/github_plugin.cpp @@ -181,7 +181,7 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, if( local ) { // It has worked, see /scripts/test_kicad_plugin.py. So this was not firing: - // wxASSERT( aFootprintName == FROM_UTF8( local->GetFPID().GetFootprintName().c_str() ) ); + // wxASSERT( aFootprintName == FROM_UTF8( local->GetFPID().GetLibItemName().c_str() ) ); // Moving it to higher API layer FP_LIB_TABLE::FootprintLoad(). return local; diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index a41d026582..6e620c6061 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Wayne Stambaugh + * Copyright (C) 2012-2016 Wayne Stambaugh * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -311,7 +311,7 @@ void GPCB_FPL_CACHE::Load() MODULE* footprint = parseMODULE( &reader ); // The footprint name is the file name without the extension. - footprint->SetFPID( FPID( fn.GetName() ) ); + footprint->SetFPID( LIB_ID( fn.GetName() ) ); m_modules.insert( name, new GPCB_FPL_CACHE_ITEM( footprint, fn.GetName() ) ); } while( dir.GetNext( &fpFileName ) ); diff --git a/pcbnew/kicad_netlist_reader.cpp b/pcbnew/kicad_netlist_reader.cpp index 18e75cf47a..1573c9bda0 100644 --- a/pcbnew/kicad_netlist_reader.cpp +++ b/pcbnew/kicad_netlist_reader.cpp @@ -5,7 +5,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2011 Jean-Pierre Charras. - * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -282,7 +282,7 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR, boost: * A component need a reference, value, footprint name and a full time stamp * The full time stamp is the sheetpath time stamp + the component time stamp */ - FPID fpid; + LIB_ID fpid; wxString footprint; wxString ref; wxString value; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index f6d516e31e..8df1655603 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -300,7 +300,7 @@ void FP_CACHE::Load() MODULE* footprint = (MODULE*) m_owner->m_parser->Parse(); // The footprint name is the file name without the extension. - footprint->SetFPID( FPID( fullPath.GetName() ) ); + footprint->SetFPID( LIB_ID( fullPath.GetName() ) ); m_modules.insert( name, new FP_CACHE_ITEM( footprint, fullPath ) ); } while( dir.GetNext( &fpFileName ) ); @@ -1879,12 +1879,13 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri THROW_IO_ERROR( msg ); } - std::string footprintName = aFootprint->GetFPID().GetFootprintName(); + std::string footprintName = aFootprint->GetFPID().GetLibItemName(); MODULE_MAP& mods = m_cache->GetModules(); // Quietly overwrite module and delete module file from path for any by same name. - wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetFootprintName(), KiCadFootprintFileExtension ); + wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(), + KiCadFootprintFileExtension ); if( !fn.IsOk() ) { diff --git a/pcbnew/legacy_netlist_reader.cpp b/pcbnew/legacy_netlist_reader.cpp index b4af895103..691adde951 100644 --- a/pcbnew/legacy_netlist_reader.cpp +++ b/pcbnew/legacy_netlist_reader.cpp @@ -6,8 +6,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2011 Jean-Pierre Charras. - * Copyright (C) 2013 Wayne Stambaugh . - * Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013-2016 Wayne Stambaugh . + * Copyright (C) 1992-2016 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 @@ -166,10 +166,10 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) name = FROM_UTF8( text ).AfterFirst( wxChar( '=' ) ).BeforeLast( wxChar( '}' ) ); } - FPID fpid; + LIB_ID fpid; if( !footprintName.IsEmpty() ) - fpid.SetFootprintName( footprintName ); + fpid.SetLibItemName( footprintName ); COMPONENT* component = new COMPONENT( fpid, reference, value, timeStamp ); component->SetName( name ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index bc8f23c7ef..fe58d6089c 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -434,7 +434,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) { unique_ptr module( new MODULE( m_board ) ); - FPID fpid; + LIB_ID fpid; std::string fpName = StrPurge( line + SZ( "$MODULE" ) ); // The footprint names in legacy libraries can contain the '/' and ':' @@ -442,7 +442,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend ) ReplaceIllegalFileNameChars( &fpName ); if( !fpName.empty() ) - fpid = FPID( fpName ); + fpid = LIB_ID( fpName ); module->SetFPID( fpid ); @@ -1377,7 +1377,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) wxString msg = wxString::Format( wxT( "Missing '$EndMODULE' for MODULE '%s'" ), - GetChars( aModule->GetFPID().GetFootprintName() ) ); + GetChars( aModule->GetFPID().GetLibItemName() ) ); THROW_IO_ERROR( msg ); } @@ -1432,7 +1432,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) padchar, padchar, m_reader->LineNumber(), - GetChars( aModule->GetFPID().GetFootprintName() ) + GetChars( aModule->GetFPID().GetLibItemName() ) ); THROW_IO_ERROR( m_error ); } @@ -1638,7 +1638,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) (unsigned char) line[1], (unsigned char) line[1], m_reader->LineNumber(), - GetChars( aModule->GetFPID().GetFootprintName() ) + GetChars( aModule->GetFPID().GetLibItemName() ) ); THROW_IO_ERROR( m_error ); } @@ -3318,11 +3318,11 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) std::string footprintName = StrPurge( line + SZ( "$MODULE" ) ); // The footprint names in legacy libraries can contain the '/' and ':' - // characters which will cause the FPID parser to choke. + // characters which will cause the LIB_ID parser to choke. ReplaceIllegalFileNameChars( &footprintName ); // set the footprint name first thing, so exceptions can use name. - module->SetFPID( FPID( footprintName ) ); + module->SetFPID( LIB_ID( footprintName ) ); #if 0 && defined( DEBUG ) printf( "%s\n", footprintName.c_str() ); @@ -3339,7 +3339,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) // Not sure why this is asserting on debug builds. The debugger shows the // strings are the same. If it's not really needed maybe it can be removed. -// wxASSERT( footprintName == m->GetFPID().GetFootprintName() ); +// wxASSERT( footprintName == m->GetFPID().GetLibItemName() ); /* @@ -3386,7 +3386,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader ) { nameOK = true; - m->SetFPID( FPID( newName ) ); + m->SetFPID( LIB_ID( newName ) ); std::pair r = m_modules.insert( newName, m ); wxASSERT_MSG( r.second, wxT( "error doing cache insert using guaranteed unique name" ) ); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 4ebc6db2ec..869dfcdfce 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -339,7 +339,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule ) if( !aModule ) return; - fn.SetName( aModule->GetFPID().GetFootprintName() ); + fn.SetName( aModule->GetFPID().GetLibItemName() ); wxString wildcard = wxGetTranslation( KiCadFootprintLibFileWildcard ); @@ -534,8 +534,8 @@ bool FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary() if( !fpid_txt ) return false; - FPID fpid( fpid_txt ); - wxString fpname = fpid.GetFootprintName(); + LIB_ID fpid( fpid_txt ); + wxString fpname = fpid.GetLibItemName(); // Confirmation wxString msg = wxString::Format( FMT_OK_DELETE, fpname.GetData(), nickname.GetData() ); @@ -589,7 +589,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib ) for( MODULE* curr_fp = GetBoard()->m_Modules; curr_fp; curr_fp = curr_fp->Next() ) { - if( !curr_fp->GetFPID().GetFootprintName().empty() ) // Can happen with old boards. + if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards. tbl->FootprintSave( nickname, curr_fp, false ); } } @@ -614,7 +614,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aStoreInNewLib ) { try { - if( !curr_fp->GetFPID().GetFootprintName().empty() ) // Can happen with old boards. + if( !curr_fp->GetFPID().GetLibItemName().empty() ) // Can happen with old boards. pi->FootprintSave( libPath, curr_fp ); } catch( const IO_ERROR& ioe ) @@ -649,7 +649,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( const wxString& aLibrary, } // Ask what to use as the footprint name in the library - wxString footprintName = aModule->GetFPID().GetFootprintName(); + wxString footprintName = aModule->GetFPID().GetLibItemName(); if( aDisplayDialog ) { @@ -676,14 +676,14 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( const wxString& aLibrary, return false; } - aModule->SetFPID( FPID( footprintName ) ); + aModule->SetFPID( LIB_ID( footprintName ) ); } // Ensure this footprint has a libname if( footprintName.IsEmpty() ) { footprintName = wxT("noname"); - aModule->SetFPID( FPID( footprintName ) ); + aModule->SetFPID( LIB_ID( footprintName ) ); } bool module_exists = false; @@ -779,7 +779,7 @@ MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName ) module->SetLastEditTime(); // Update its name in lib - module->SetFPID( FPID( moduleName ) ); + module->SetFPID( LIB_ID( moduleName ) ); wxPoint default_pos; BOARD_DESIGN_SETTINGS& settings = GetDesignSettings(); diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index d081782239..6dac6db801 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -45,7 +45,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include @@ -182,7 +182,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, if( dlg.m_GetExtraFunction ) { // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e. - // / or FPID format "lib_name:fp_name:rev#" + // / or LIB_ID format "lib_name:fp_name:rev#" moduleName = SelectFootprintFromLibBrowser(); } else @@ -221,10 +221,10 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, } } - FPID fpid; + LIB_ID fpid; wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, - wxString::Format( wxT( "Could not parse FPID string '%s'." ), + wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ), GetChars( moduleName ) ) ); try @@ -254,7 +254,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, else { wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, - wxString::Format( wxT( "Could not parse FPID string '%s'." ), + wxString::Format( wxT( "Could not parse LIB_ID string '%s'." ), GetChars( moduleName ) ) ); try @@ -310,7 +310,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, } -MODULE* PCB_BASE_FRAME::LoadFootprint( const FPID& aFootprintId ) +MODULE* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId ) { MODULE* module = NULL; @@ -328,12 +328,12 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const FPID& aFootprintId ) } -MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId ) +MODULE* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId ) throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception ) { FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs(); - wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) ); + wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) ); MODULE* module = fptbl->FootprintLoadWithOptionalNickname( aFootprintId ); diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index cf87d8a9db..056b4e2886 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include @@ -203,10 +203,10 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent // If a footprint was previously loaded, reload it if( getCurNickname().size() && getCurFootprintName().size() ) { - FPID id; + LIB_ID id; id.SetLibNickname( getCurNickname() ); - id.SetFootprintName( getCurFootprintName() ); + id.SetLibItemName( getCurFootprintName() ); GetBoard()->Add( loadFootprint( id ) ); } @@ -449,9 +449,9 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event ) // Delete the current footprint GetBoard()->m_Modules.DeleteAll(); - FPID id; + LIB_ID id; id.SetLibNickname( getCurNickname() ); - id.SetFootprintName( getCurFootprintName() ); + id.SetLibItemName( getCurFootprintName() ); try { @@ -511,10 +511,10 @@ void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event ) { wxString fp_name = m_footprintList->GetString( ii ); - FPID fpid; + LIB_ID fpid; fpid.SetLibNickname( getCurNickname() ); - fpid.SetFootprintName( fp_name ); + fpid.SetLibItemName( fp_name ); DismissModal( true, fpid.Format() ); } @@ -773,7 +773,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) delete oldmodule; } - setCurFootprintName( module->GetFPID().GetFootprintName() ); + setCurFootprintName( module->GetFPID().GetLibItemName() ); wxString nickname = module->GetFPID().GetLibNickname(); diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 77edb7ea4d..fa7c685171 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -3,8 +3,8 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2015 Wayne Stambaugh - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2016 Wayne Stambaugh + * Copyright (C) 1992-2016 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 @@ -288,7 +288,7 @@ MODULE* CreateMicrowaveInductor( PCB_EDIT_FRAME* aPcbFrame, wxString& aErrorMess MODULE* module = aPcbFrame->CreateNewModule( msg ); // here the module is already in the BOARD, CreateNewModule() does that. - module->SetFPID( FPID( std::string( "mw_inductor" ) ) ); + module->SetFPID( LIB_ID( std::string( "mw_inductor" ) ) ); module->SetAttributes( MOD_VIRTUAL | MOD_CMS ); module->ClearFlags(); module->SetPosition( s_inductor_pattern.m_End ); diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index d72145c483..88f03b9c82 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -6,7 +6,7 @@ * * Copyright (C) 1992-2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2013 Wayne Stambaugh + * Copyright (C) 2013-2016 Wayne Stambaugh * Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -41,7 +41,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include @@ -227,7 +227,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) throw( IO_ERROR, PARSE_ERROR ) { wxString msg; - FPID lastFPID; + LIB_ID lastFPID; COMPONENT* component; MODULE* module = 0; MODULE* fpOnBoard; @@ -244,7 +244,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) #if ALLOW_PARTIAL_FPID // The FPID is ok as long as there is a footprint portion coming // from eeschema. - if( !component->GetFPID().GetFootprintName().size() ) + if( !component->GetFPID().GetLibItemName().size() ) #else if( component->GetFPID().empty() ) #endif @@ -293,9 +293,9 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) module = NULL; #if ALLOW_PARTIAL_FPID - // The FPID is ok as long as there is a footprint portion coming + // The LIB_ID is ok as long as there is a footprint portion coming // the library if it's needed. Nickname can be blank. - if( !component->GetFPID().GetFootprintName().size() ) + if( !component->GetFPID().GetLibItemName().size() ) #else if( !component->GetFPID().IsValid() ) #endif @@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) msg.Printf( _( "Component '%s' footprint '%s' was not found in " "any libraries in the footprint library table.\n" ), GetChars( component->GetReference() ), - GetChars( component->GetFPID().GetFootprintName() ) ); + GetChars( component->GetFPID().GetLibItemName() ) ); aReporter->Report( msg, REPORTER::RPT_ERROR ); } diff --git a/pcbnew/netlist_reader.cpp b/pcbnew/netlist_reader.cpp index 3aab71fb6b..f0e42e9468 100644 --- a/pcbnew/netlist_reader.cpp +++ b/pcbnew/netlist_reader.cpp @@ -5,8 +5,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2011 Jean-Pierre Charras. - * Copyright (C) 2013-2015 Wayne Stambaugh . - * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013-2016 Wayne Stambaugh . + * Copyright (C) 1992-2016 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 @@ -174,7 +174,7 @@ bool CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR ) // assignment list. This is an usual case during the life of a design. if( component ) { - FPID fpid; + LIB_ID fpid; if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 ) { @@ -186,10 +186,10 @@ bool CMP_READER::Load( NETLIST* aNetlist ) throw( IO_ERROR, PARSE_ERROR ) THROW_IO_ERROR( error ); } - // For checking purpose, store the existing FPID (if any) in the alternate fpid copy - // if this existing FPID differs from the FPID read from the .cmp file. - // CvPcb can ask for user to chose the right FPID. - // It happens if the FPID was modified outside CvPcb. + // For checking purpose, store the existing LIB_ID (if any) in the alternate fpid copy + // if this existing LIB_ID differs from the LIB_ID read from the .cmp file. + // CvPcb can ask for user to chose the right LIB_ID. + // It happens if the LIB_ID was modified outside CvPcb. if( fpid != component->GetFPID() && !component->GetFPID().empty() ) component->SetAltFPID( component->GetFPID() ); diff --git a/pcbnew/netlist_reader.h b/pcbnew/netlist_reader.h index dd55610e01..2e14b0f9e6 100644 --- a/pcbnew/netlist_reader.h +++ b/pcbnew/netlist_reader.h @@ -34,7 +34,7 @@ #include #include -#include +#include #include // netlist_lexer is common to Eeschema and Pcbnew diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index 39ebf79154..4a978cea77 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2016 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -522,7 +522,7 @@ void PCB_MODULE::AddToBoard() module->SetTimeStamp( 0 ); module->SetLastEditTime( 0 ); - module->SetFPID( FPID( m_compRef ) ); + module->SetFPID( LIB_ID( m_compRef ) ); module->SetAttributes( MOD_DEFAULT | MOD_CMS ); diff --git a/pcbnew/pcb_netlist.h b/pcbnew/pcb_netlist.h index cdef47bb54..9b694ca4ae 100644 --- a/pcbnew/pcb_netlist.h +++ b/pcbnew/pcb_netlist.h @@ -9,8 +9,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 Jean-Pierre Charras. - * Copyright (C) 2013 Wayne Stambaugh . - * Copyright (C) 2012-2015 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2013-2016 Wayne Stambaugh . + * Copyright (C) 2012-2016 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,7 +33,7 @@ #include #include -#include +#include #include @@ -95,13 +95,13 @@ class COMPONENT /// The name of the component library where #m_name was found. wxString m_library; - /// The #FPID of the footprint assigned to the component. - FPID m_fpid; + /// The #LIB_ID of the footprint assigned to the component. + LIB_ID m_fpid; - /// The alt FPID of the footprint, when there are 2 different assigned footprints, + /// The alt LIB_ID of the footprint, when there are 2 different assigned footprints, /// One from the netlist, the other from the .cmp file. /// this one is a copy of the netlist footprint assignment - FPID m_altFpid; + LIB_ID m_altFpid; /// The #MODULE loaded for #m_fpid. std::unique_ptr< MODULE > m_footprint; @@ -112,7 +112,7 @@ class COMPONENT static COMPONENT_NET m_emptyNet; public: - COMPONENT( const FPID& aFPID, + COMPONENT( const LIB_ID& aFPID, const wxString& aReference, const wxString& aValue, const wxString& aTimeStamp ) @@ -149,20 +149,20 @@ public: const wxString& GetValue() const { return m_value; } - void SetFPID( const FPID& aFPID ) + void SetFPID( const LIB_ID& aFPID ) { m_footprintChanged = !m_fpid.empty() && (m_fpid != aFPID); m_fpid = aFPID; } - void SetAltFPID( const FPID& aFPID ) + void SetAltFPID( const LIB_ID& aFPID ) { m_altFpid = aFPID; } - const FPID& GetFPID() const { return m_fpid; } + const LIB_ID& GetFPID() const { return m_fpid; } - const FPID& GetAltFPID() const { return m_altFpid; } + const LIB_ID& GetAltFPID() const { return m_altFpid; } const wxString& GetTimeStamp() const { return m_timeStamp; } diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 2d5cab53ab..89460ec405 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1743,7 +1743,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments ) wxString name; wxPoint pt; T token; - FPID fpid; + LIB_ID fpid; std::unique_ptr module( new MODULE( m_board ) ); diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 0ce9a724b7..f1e31b51e0 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include diff --git a/pcbnew/python/examples/createFPC40.py b/pcbnew/python/examples/createFPC40.py index 7c6568e730..32bde3ea59 100644 --- a/pcbnew/python/examples/createFPC40.py +++ b/pcbnew/python/examples/createFPC40.py @@ -50,7 +50,7 @@ e.SetShape(S_SEGMENT) module.Add(e) # save the PCB to disk -fpid = FPID("FPC"+str(pads)) #the name in library +fpid = LIB_ID("FPC"+str(pads)) #the name in library module.SetFPID( fpid ) try: diff --git a/pcbnew/python/plugins/HelpfulFootprintWizardPlugin.py b/pcbnew/python/plugins/HelpfulFootprintWizardPlugin.py index a74206780e..d891b7a462 100644 --- a/pcbnew/python/plugins/HelpfulFootprintWizardPlugin.py +++ b/pcbnew/python/plugins/HelpfulFootprintWizardPlugin.py @@ -333,7 +333,7 @@ class HelpfulFootprintWizardPlugin(pcbnew.FootprintWizardPlugin, self.module.SetValue(self.GetValue()) self.module.SetReference("%s**" % self.GetReferencePrefix()) - fpid = pcbnew.FPID(self.module.GetValue()) # the name in library + fpid = pcbnew.LIB_ID(self.module.GetValue()) # the name in library self.module.SetFPID(fpid) self.SetModule3DModel() # add a 3d module if specified diff --git a/pcbnew/swig/pcbnew.i b/pcbnew/swig/pcbnew.i index eae03a0e54..3a6ada43b6 100644 --- a/pcbnew/swig/pcbnew.i +++ b/pcbnew/swig/pcbnew.i @@ -41,9 +41,9 @@ %include %{ -#include +#include %} -%include fpid.h +%include lib_id.h // ignore a couple of items that generate warnings from swig built code diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index a4e59a4be2..86496ba0ef 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -7,7 +7,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2013 Wayne Stambaugh + * Copyright (C) 2013-2016 Wayne Stambaugh * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -74,7 +74,7 @@ private: bool changeSameFootprints( bool aUseValue); bool changeAllFootprints(); bool change_1_Module( MODULE* aModule, - const FPID& aNewFootprintFPID, + const LIB_ID& aNewFootprintFPID, bool eShowError ); BOARD_COMMIT m_commit; @@ -240,7 +240,7 @@ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue ) bool change = false; wxString newmodulename = m_NewFootprintFPID->GetValue(); wxString value; - FPID lib_reference; + LIB_ID lib_reference; bool check_module_value = false; int ShowErr = 3; // Post 3 error messages max. @@ -337,7 +337,7 @@ bool DIALOG_EXCHANGE_MODULE::changeAllFootprints() bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule, - const FPID& aNewFootprintFPID, + const LIB_ID& aNewFootprintFPID, bool aShowError ) { MODULE* newModule; @@ -349,7 +349,7 @@ bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule, wxBusyCursor dummy; // Copy parameters from the old module. - FPID oldFootprintFPID = aModule->GetFPID(); + LIB_ID oldFootprintFPID = aModule->GetFPID(); // Load module. line.Printf( _( "Change footprint '%s' (from '%s') to '%s'" ),