diff --git a/common/trace_helpers.cpp b/common/trace_helpers.cpp index b9d084013d..c7b4c662c3 100644 --- a/common/trace_helpers.cpp +++ b/common/trace_helpers.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Wayne Stambaugh - * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2018-2019 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 @@ -44,6 +44,7 @@ const wxChar* const tracePathsAndFiles = wxT( "KICAD_PATHS_AND_FILES" ); const wxChar* const traceLocale = wxT( "KICAD_LOCALE" ); const wxChar* const traceScreen = wxT( "KICAD_SCREEN" ); const wxChar* const traceZoomScroll = wxT( "KICAD_ZOOM_SCROLL" ); +const wxChar* const traceSymbolResolver = wxT( "KICAD_SYM_RESOLVE" ); wxString dump( const wxArrayString& aArray ) diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index a7f6a97736..657c69e65b 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -35,8 +35,11 @@ #include #include #include +#include #include #include +#include + #include #include @@ -740,6 +743,15 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent ) } } + SCH_SCREENS schematic; + + schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets. + + SCH_EDIT_FRAME* schEditor = (SCH_EDIT_FRAME*) aKiway->Player( FRAME_SCH, false ); + + if( schEditor ) + schEditor->SyncView(); + auto editor = (LIB_EDIT_FRAME*) aKiway->Player( FRAME_SCH_LIB_EDITOR, false ); if( editor ) diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 08fdbf73fb..0fe81ff117 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -331,7 +331,14 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib ) // Fall back to cache library. This is temporary until the new schematic file // format is implemented. if( !alias && aCacheLib ) - alias = aCacheLib->FindAlias( m_lib_id.Format().wx_str() ); + { + wxString libId = m_lib_id.Format().wx_str(); + libId.Replace( ":", "_" ); + alias = aCacheLib->FindAlias( libId ); + wxLogTrace( traceSymbolResolver, + "Library symbol %s not found falling back to cache library.", + m_lib_id.Format().wx_str() ); + } if( alias && alias->GetPart() ) { @@ -339,11 +346,17 @@ bool SCH_COMPONENT::Resolve( SYMBOL_LIB_TABLE& aLibTable, PART_LIB* aCacheLib ) return true; } } - catch( const IO_ERROR& ) + catch( const IO_ERROR& ioe ) { - wxLogDebug( "Cannot resolve library symbol %s", m_lib_id.Format().wx_str() ); + wxLogTrace( traceSymbolResolver, "I/O error %s resolving library symbol %s", ioe.What(), + m_lib_id.Format().wx_str() ); } + wxLogTrace( traceSymbolResolver, "Cannot resolve library symbol %s", + m_lib_id.Format().wx_str() ); + + m_part.reset(); + return false; } @@ -453,6 +466,11 @@ void SCH_COMPONENT::UpdatePins( SCH_SHEET_PATH* aSheet ) ++i; } } + else + { + m_pins.clear(); + m_pinMap.clear(); + } } @@ -1317,9 +1335,15 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList LIB_ALIAS* alias = nullptr; if( part->GetLib() && part->GetLib()->IsCache() ) - alias = part->GetAlias( GetLibId().Format() ); + { + wxString libId = GetLibId().Format(); + libId.Replace( ":", "_" ); + alias = part->GetAlias( libId ); + } else + { alias = part->GetAlias( GetLibId().GetLibItemName() ); + } if( !alias ) return; @@ -1338,8 +1362,9 @@ void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList if( alias->GetName() != part->GetName() ) aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), part->GetName(), BROWN ) ); - if( alias->GetLib() && alias->GetLib()->IsCache() ) - aList.push_back( MSG_PANEL_ITEM( _( "Library" ), alias->GetLibNickname(), RED ) ); + if( part->GetLib() && part->GetLib()->IsCache() ) + aList.push_back( MSG_PANEL_ITEM( _( "Library" ), + part->GetLib()->GetLogicalName(), RED ) ); else if( !m_lib_id.GetLibNickname().empty() ) aList.push_back( MSG_PANEL_ITEM( _( "Library" ), m_lib_id.GetLibNickname(), BROWN ) ); diff --git a/eeschema/sch_screen.h b/eeschema/sch_screen.h index dd999e8586..edf8ae9f75 100644 --- a/eeschema/sch_screen.h +++ b/eeschema/sch_screen.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 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 @@ -245,6 +245,7 @@ public: * - when loading a schematic file * - before creating a netlist (in case a library is modified) * - whenever a symbol library is modified + * - whenever the symbol library table is modified. * * @param aForce true forces a refresh even if the library modification has hasn't changed. */ @@ -622,6 +623,7 @@ public: * - when loading a schematic file * - before creating a netlist (in case a library is modified) * - whenever any of the libraries are modified. + * - whenever the symbol library table is modified. */ void UpdateSymbolLinks( bool aForce = false ); diff --git a/include/trace_helpers.h b/include/trace_helpers.h index 06c50f0866..d310bf5eed 100644 --- a/include/trace_helpers.h +++ b/include/trace_helpers.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Wayne Stambaugh - * Copyright (C) 2018 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2018-2019 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 @@ -146,6 +146,13 @@ extern const wxChar* const traceScreen; */ extern const wxChar* const traceZoomScroll; +/** + * Flag to enable debug output of symbol library resolver results + * + * Use "KICAD_SYM_RESOLVE" to enable. + */ +extern const wxChar* const traceSymbolResolver; + ///@} /**