Eeschema: fix broken symbol library links.
Force the symbol library links whenever the symbol library table has been
modified. This will use the cache as a fallback when a library has been
removed that contains links in the schematic rather than display.
Fix the SCH_COMPONENT symbol resolver when falling back to the cache. The
resolver was using the LIB_ID ':' notation which was failing. Replacing
':' with '_' fixed this issue. This was also an issue when generating the
symbol message panel information.
Convert wxLogDebug to wxLogTrace in symbol resolver code path. Add new
trace type KICAD_SYM_RESOLVE.
Fixes lp:1821606
https://bugs.launchpad.net/kicad/+bug/1821606
(cherry picked from commit 7d803437e2
)
This commit is contained in:
parent
d94b8b9c0e
commit
616061a6ca
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* 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 )
|
||||
|
|
|
@ -35,8 +35,11 @@
|
|||
#include <wildcards_and_files_ext.h>
|
||||
#include <env_paths.h>
|
||||
#include <lib_edit_frame.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <viewlib_frame.h>
|
||||
#include <kiway.h>
|
||||
#include <sch_screen.h>
|
||||
|
||||
#include <widgets/grid_readonly_text_helpers.h>
|
||||
#include <widgets/grid_text_button_helpers.h>
|
||||
|
||||
|
@ -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 )
|
||||
|
|
|
@ -333,7 +333,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() )
|
||||
{
|
||||
|
@ -341,11 +348,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;
|
||||
}
|
||||
|
||||
|
@ -1429,9 +1442,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;
|
||||
|
@ -1452,8 +1471,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 ) );
|
||||
|
|
|
@ -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
|
||||
|
@ -238,6 +238,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.
|
||||
*/
|
||||
|
@ -586,6 +587,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 );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* 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;
|
||||
|
||||
///@}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue