diff --git a/common/edaappl.cpp b/common/edaappl.cpp index cb3c15042c..7a218868df 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -1173,7 +1173,6 @@ bool EDA_APP::SetFootprintLibTablePath() if( m_commonSettings->Read( kicadFpLibPath, &path ) && wxFileName::DirExists( path ) ) { wxSetEnv( wxT( "KISYSMOD" ), path ); - wxLogDebug( wxT( "Setting $KISYSMOD=\"%s\"." ), GetChars( path ) ); return true; } @@ -1199,7 +1198,6 @@ bool EDA_APP::SetFootprintLibTablePath() if( modFileCount != 0 ) { - wxLogDebug( wxT( "Setting $KISYSMOD=\"%s\"." ), GetChars( bestPath ) ); wxSetEnv( wxT( "KISYSMOD" ), bestPath ); return true; } diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 5a4ce2970a..e6fbdad856 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -190,7 +190,7 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString & aFootprintName ) #if defined( USE_FP_LIB_TABLE ) FPID fpid; - wxCHECK_MSG( fpid.Parse( TO_UTF8( aFootprintName ) ) < 0, NULL, + wxCHECK_MSG( fpid.Parse( aFootprintName ) < 0, NULL, wxString::Format( wxT( "<%s> is not a valid FPID." ), GetChars( aFootprintName ) ) ); diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 2ab1ad8290..d4f8500b50 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -103,7 +103,6 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR // After (name), remaining (lib) elements are order independent, and in // some cases optional. - bool sawType = false; bool sawOpts = false; bool sawDesc = false; @@ -460,11 +459,6 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL } else { - wxLogDebug( wxT( "Found component %s footprint %s in legacy library <%s>." ), - GetChars( component->GetReference() ), - GetChars( GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ), - GetChars( libPath ) ); - wxString libNickname; FP_LIB_TABLE* cur = this; @@ -481,9 +475,6 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL && uri.Find( wxChar( '/' ) ) >= 0 ) uri.Replace( wxT( "/"), wxT( "\\" ) ); - wxLogDebug( wxT( "Comparing legacy path <%s> to lib table path <%s>." ), - GetChars( libPath ), GetChars( uri ) ); - if( uri == libPath ) { libNickname = cur->rows[i].GetNickName(); @@ -537,8 +528,6 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS bool tableExists = true; wxFileName fn = GetGlobalTableFileName(); - wxLogDebug( wxT( "Loading global footprint table file: %s" ), GetChars( fn.GetFullPath() ) ); - if( !fn.FileExists() ) { tableExists = false; @@ -548,8 +537,6 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS wxString fileName( wxT( "fp_global_table" ) ); fileName = wxGetApp().FindLibraryPath( fileName ); - wxLogDebug( wxT( "Copying global footprint table from <%s>." ), GetChars( fileName ) ); - // The fallback is to create an empty global footprint table for the user to populate. if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) ) { diff --git a/common/fpid.cpp b/common/fpid.cpp index a07bf4707a..92e1ee2786 100644 --- a/common/fpid.cpp +++ b/common/fpid.cpp @@ -171,6 +171,12 @@ int FPID::Parse( const std::string& aId ) } +int FPID::Parse( const wxString& aId ) +{ + return Parse( std::string( TO_UTF8( aId ) ) ); +} + + FPID::FPID( const std::string& aId ) throw( PARSE_ERROR ) { int offset = Parse( aId ); diff --git a/common/netlist.keywords b/common/netlist.keywords index 9f2932e190..2132e6b974 100644 --- a/common/netlist.keywords +++ b/common/netlist.keywords @@ -12,7 +12,6 @@ fields footprint footprints fp -fp_lib lib libpart libparts diff --git a/common/page_layout/class_worksheet_layout.cpp b/common/page_layout/class_worksheet_layout.cpp index 6f2cad1662..67cd12277d 100644 --- a/common/page_layout/class_worksheet_layout.cpp +++ b/common/page_layout/class_worksheet_layout.cpp @@ -1,5 +1,5 @@ /** - * @file class_worksheet_layuout.cpp + * @file class_worksheet_layout.cpp * @brief description of graphic items and texts to build a title block */ diff --git a/common/page_layout/page_layout_default_description.cpp b/common/page_layout/page_layout_default_description.cpp index 8e5d2ae283..c72cd1c14a 100644 --- a/common/page_layout/page_layout_default_description.cpp +++ b/common/page_layout/page_layout_default_description.cpp @@ -1,5 +1,5 @@ /** - * @file page_layout_default_description.cpp + * @file common/page_layout/page_layout_default_description.cpp */ /* diff --git a/common/page_layout/page_layout_reader.cpp b/common/page_layout/page_layout_reader.cpp index d87fa8fccf..fe101b410e 100644 --- a/common/page_layout/page_layout_reader.cpp +++ b/common/page_layout/page_layout_reader.cpp @@ -1,5 +1,5 @@ /** - * @file page_layout_reader.cpp + * @file common/page_layout/page_layout_reader.cpp * @brief read an S expression of description of graphic items and texts * to build a title block and page layout */ diff --git a/common/page_layout/title_block_shapes.cpp b/common/page_layout/title_block_shapes.cpp index cfa814d414..f2a967cbab 100644 --- a/common/page_layout/title_block_shapes.cpp +++ b/common/page_layout/title_block_shapes.cpp @@ -1,5 +1,5 @@ /** - * @file title_block_shape.cpp + * @file title_block_shapes.cpp * @brief description of graphic items and texts to build a title block */ diff --git a/common/page_layout/title_block_shapes_gost.cpp b/common/page_layout/title_block_shapes_gost.cpp index aafa906210..3bd1d47afd 100644 --- a/common/page_layout/title_block_shapes_gost.cpp +++ b/common/page_layout/title_block_shapes_gost.cpp @@ -1,5 +1,5 @@ /** - * @file title_block_shape_gost.h + * @file title_block_shapes_gost.cpp * @brief description of graphic items and texts to build a title block * using GOST standard */ diff --git a/common/page_layout_default_description.cpp b/common/page_layout_default_description.cpp index faced42fea..972c90eae7 100644 --- a/common/page_layout_default_description.cpp +++ b/common/page_layout_default_description.cpp @@ -1,5 +1,5 @@ /** - * @file page_layout_default_description.cpp + * @file common/page_layout_default_description.cpp */ /* diff --git a/common/page_layout_reader.cpp b/common/page_layout_reader.cpp index 7cbd93f71b..3bdf4882eb 100644 --- a/common/page_layout_reader.cpp +++ b/common/page_layout_reader.cpp @@ -1,5 +1,5 @@ /** - * @file page_layout_reader.cpp + * @file common/page_layout_reader.cpp * @brief read an S expression of description of graphic items and texts * to build a title block and page layout */ diff --git a/common/pcb.keywords b/common/pcb.keywords index 2e19147bdb..0126f5602e 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -72,7 +72,6 @@ font fp_arc fp_circle fp_curve -fp_lib fp_line fp_poly fp_text diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 9f28f4b220..4d4a1e6f74 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -483,7 +483,7 @@ MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName ) #if defined( USE_FP_LIB_TABLE ) FPID fpid; - if( fpid.Parse( TO_UTF8( aFootprintName ) ) >= 0 ) + if( fpid.Parse( aFootprintName ) >= 0 ) { DisplayInfoMessage( this, wxString::Format( wxT( "Footprint ID <%s> is not valid." ), GetChars( aFootprintName ) ) ); diff --git a/cvpcb/class_components_listbox.cpp b/cvpcb/class_components_listbox.cpp index 11a4a7c03f..a99517370b 100644 --- a/cvpcb/class_components_listbox.cpp +++ b/cvpcb/class_components_listbox.cpp @@ -22,7 +22,7 @@ */ /** - * @file class_components_listbox.h + * @file class_components_listbox.cpp */ #include diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 4eb58bf9b5..1096833b90 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -77,7 +77,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) #if defined( USE_FP_LIB_TABLE ) FPID fpid; - wxCHECK_RET( fpid.Parse( TO_UTF8( aFootprintName ) ) < 0, + wxCHECK_RET( fpid.Parse( aFootprintName ) < 0, wxString::Format( wxT( "<%s> is not a valid FPID." ), GetChars( aFootprintName ) ) ); diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 98796040fc..1ac53c7576 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -360,7 +360,7 @@ public: /** * Function FindRowByURI - * returns a #ROW if aURE is found in this table or in any chained + * returns a #FP_LIB_TABLE::ROW if aURE is found in this table or in any chained * fallBack table fragments, else NULL. */ const ROW* FindRowByURI( const wxString& aURI ); diff --git a/include/fpid.h b/include/fpid.h index bd0be419a6..6417cfbc6f 100644 --- a/include/fpid.h +++ b/include/fpid.h @@ -82,6 +82,8 @@ public: */ int Parse( const std::string& aId ); + int Parse( const wxString& aId ); + /** * Function GetLibNickname * returns the logical library name portion of a FPID. diff --git a/include/worksheet_shape_builder.h b/include/worksheet_shape_builder.h index 103ec0d7f2..04f08c914c 100644 --- a/include/worksheet_shape_builder.h +++ b/include/worksheet_shape_builder.h @@ -599,6 +599,8 @@ public: /** * Populates the list from a S expr description stored in a string * @param aPageLayout = the S expr string + * @param Append Do not delete old layout if true and append \a aPageLayout + * the existing one. */ void SetPageLayout( const char* aPageLayout, bool Append = false ); diff --git a/include/wxstruct.h b/include/wxstruct.h index 4c3144ea28..9e1bfb73b9 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -509,7 +509,6 @@ public: * Function SetCrossHairPosition * sets the screen cross hair position to \a aPosition in logical (drawing) units. * @param aPosition The new cross hair position. - * @param aGridOrigin Origin point of the snap grid. * @param aSnapToGrid Sets the cross hair position to the nearest grid position to * \a aPosition. * @@ -520,7 +519,6 @@ public: * Function GetCursorPosition * returns the current cursor position in logical (drawing) units. * @param aOnGrid Returns the nearest grid position at the current cursor position. - * @param aGridOrigin Origin point of the snap grid. * @param aGridSize Custom grid size instead of the current grid size. Only valid * if \a aOnGrid is true. * @return The current cursor position. diff --git a/pagelayout_editor/events_functions.cpp b/pagelayout_editor/events_functions.cpp index d6b81f617f..70b88d2949 100644 --- a/pagelayout_editor/events_functions.cpp +++ b/pagelayout_editor/events_functions.cpp @@ -1,5 +1,5 @@ /** - * @file pagelayout_editor/events_called_functions.cpp + * @file pagelayout_editor/events_functions.cpp * @brief page layout editor command event functions. */ /* diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp index cc6ef4de7d..a43c3738f9 100644 --- a/pagelayout_editor/files.cpp +++ b/pagelayout_editor/files.cpp @@ -1,5 +1,5 @@ /** - * @file pl_editor/files.cpp + * @file pagelayout_editor/files.cpp */ /* diff --git a/pagelayout_editor/invoke_pl_editor_dialog.h b/pagelayout_editor/invoke_pl_editor_dialog.h index a0aee5cf4d..ecd4b96cbe 100644 --- a/pagelayout_editor/invoke_pl_editor_dialog.h +++ b/pagelayout_editor/invoke_pl_editor_dialog.h @@ -1,5 +1,5 @@ /** - * @file invoke_pl_editor.h + * @file invoke_pl_editor_dialog.h */ /* diff --git a/pcbnew/kicad_netlist_reader.cpp b/pcbnew/kicad_netlist_reader.cpp index fb40685ee8..aea7a3e5ad 100644 --- a/pcbnew/kicad_netlist_reader.cpp +++ b/pcbnew/kicad_netlist_reader.cpp @@ -283,10 +283,11 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR ) * 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; + wxString footprint; + wxString tmp; wxString ref; wxString value; - wxString footprintName; - wxString footprintLib; wxString library; wxString name; wxString pathtimestamp, timestamp; @@ -313,13 +314,7 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR ) case T_footprint: NeedSYMBOLorNUMBER(); - footprintName = FROM_UTF8( CurText() ); - NeedRIGHT(); - break; - - case T_fp_lib: - NeedSYMBOLorNUMBER(); - footprintLib = FROM_UTF8( CurText() ); + footprint = FromUTF8(); NeedRIGHT(); break; @@ -370,10 +365,15 @@ void KICAD_NETLIST_PARSER::parseComponent() throw( IO_ERROR, PARSE_ERROR ) } } - FPID fpid; + if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 ) + { + wxString error; + error.Printf( _( "invalid PFID in\nfile: <%s>\nline: %d\noffset: %d" ), + GetChars( CurSource() ), CurLineNumber(), CurOffset() ); + + THROW_IO_ERROR( error ); + } - fpid.SetFootprintName( footprintName ); - fpid.SetLibNickname( footprintName ); pathtimestamp += timestamp; COMPONENT* component = new COMPONENT( fpid, ref, value, pathtimestamp ); component->SetName( name ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 4e26452b3b..04d28d692c 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -869,7 +869,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const } m_out->Print( aNestLevel, "(module %s", - m_out->Quotes( aModule->GetFPID().GetFootprintName() ).c_str() ); + m_out->Quotes( aModule->GetFPID().Format() ).c_str() ); if( aModule->IsLocked() ) m_out->Print( 0, " locked" ); @@ -877,10 +877,6 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const if( aModule->IsPlaced() ) m_out->Print( 0, " placed" ); - if( !aModule->GetFPID().IsLegacy() ) - m_out->Print( 0, " (fp_lib %s)", - m_out->Quotes( aModule->GetFPID().GetLibNickname() ).c_str() ); - formatLayer( aModule ); if( !( m_ctl & CTL_OMIT_TSTAMPS ) ) diff --git a/pcbnew/legacy_netlist_reader.cpp b/pcbnew/legacy_netlist_reader.cpp index e215a67720..f4973d6fa3 100644 --- a/pcbnew/legacy_netlist_reader.cpp +++ b/pcbnew/legacy_netlist_reader.cpp @@ -168,7 +168,9 @@ COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERRO FPID fpid; - fpid.SetFootprintName( footprintName ); + if( !footprintName.IsEmpty() ) + fpid.SetFootprintName( footprintName ); + COMPONENT* component = new COMPONENT( fpid, reference, value, timeStamp ); component->SetName( name ); m_netlist->AddComponent( component ); diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index fbdfdd5a29..d4a6134d7c 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -224,7 +224,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, #else FPID fpid; - wxCHECK_MSG( fpid.Parse( TO_UTF8( moduleName ) ) < 0, NULL, + wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxString::Format( wxT( "Could not parse FPID string <%s>." ), GetChars( moduleName ) ) ); @@ -260,7 +260,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary, #else FPID fpid; - wxCHECK_MSG( fpid.Parse( TO_UTF8( moduleName ) ) < 0, NULL, + wxCHECK_MSG( fpid.Parse( moduleName ) < 0, NULL, wxString::Format( wxT( "Could not parse FPID string <%s>." ), GetChars( moduleName ) ) ); diff --git a/pcbnew/netlist_reader.cpp b/pcbnew/netlist_reader.cpp index a970d53940..0f02cec54d 100644 --- a/pcbnew/netlist_reader.cpp +++ b/pcbnew/netlist_reader.cpp @@ -197,7 +197,19 @@ 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 ) { - component->SetFPID( FPID( footprint ) ); + FPID fpid; + + if( !footprint.IsEmpty() && fpid.Parse( footprint ) >= 0 ) + { + wxString error; + error.Printf( _( "invalid PFID in\nfile: <%s>\nline: %d" ), + GetChars( m_lineReader->GetSource() ), + m_lineReader->LineNumber() ); + + THROW_IO_ERROR( error ); + } + + component->SetFPID( fpid ); } else { diff --git a/pcbnew/pcb_netlist.h b/pcbnew/pcb_netlist.h index 90605d29a3..ff9544e10f 100644 --- a/pcbnew/pcb_netlist.h +++ b/pcbnew/pcb_netlist.h @@ -109,11 +109,10 @@ class COMPONENT /// The #FPID of the footprint assigned to the component. FPID m_fpid; - /// The #MODULE loaded for #m_footprintName found in #m_footprintLib. + /// The #MODULE loaded for #m_fpid. std::auto_ptr< MODULE > m_footprint; - /// Set to true if #m_footprintName or #m_footprintLib was changed when the footprint - /// link file was read. + /// Set to true if #m_fpid was changed when the footprint link file was read. bool m_footprintChanged; static COMPONENT_NET m_emptyNet; diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 58208e320b..5712ab3992 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1549,7 +1549,14 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR module->SetInitialComments( aInitialComments ); NeedSYMBOLorNUMBER(); - fpid.SetFootprintName( FromUTF8() ); + + if( fpid.Parse( FromUTF8() ) >= 0 ) + { + wxString error; + error.Printf( _( "invalid PFID in\nfile: <%s>\nline: %d\noffset: %d" ), + GetChars( CurSource() ), CurLineNumber(), CurOffset() ); + THROW_IO_ERROR( error ); + } for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { @@ -1566,12 +1573,6 @@ MODULE* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments ) throw( IO_ERR module->SetIsPlaced( true ); break; - case T_fp_lib: - NeedSYMBOLorNUMBER(); - fpid.SetLibNickname( FromUTF8() ); - NeedRIGHT(); - break; - case T_layer: module->SetLayer( parseBoardItemLayer() ); NeedRIGHT(); diff --git a/pcbnew/target_edit.cpp b/pcbnew/target_edit.cpp index 348f56b102..ed31e1dfc8 100644 --- a/pcbnew/target_edit.cpp +++ b/pcbnew/target_edit.cpp @@ -24,7 +24,7 @@ */ /** - * @file dialog_target_properties.cpp + * @file target_edit.cpp * @brief Functions to edit targets (class #PCB_TARGET). */