Eeschema: Fix some issues (all connections showed as not connected, DRC and NETLIST errors if all sheets in a hierarchy were not open) due to the fact the pointer of a schematic component to its part lib was calculated too late (or never calculated).
This commit is contained in:
parent
188954f2d4
commit
1222924607
|
@ -277,6 +277,13 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
|
||||
LoadProjectFile();
|
||||
|
||||
// load the libraries here, not in SCH_SCREEN::Draw() which is a context
|
||||
// that will not tolerate DisplayError() dialog since we're already in an
|
||||
// event handler in there.
|
||||
// And when a schematic file is loaded, we need these libs to initialize
|
||||
// some parameters (links to PART LIB, dangling ends ...)
|
||||
Prj().SchLibs();
|
||||
|
||||
if( is_new )
|
||||
{
|
||||
// mark new, unsaved file as modified.
|
||||
|
@ -302,15 +309,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
Zoom_Automatique( false );
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
/* this is done in ReDraw()
|
||||
UpdateTitle();
|
||||
*/
|
||||
|
||||
// load the libraries here, not in SCH_SCREEN::Draw() which is a context
|
||||
// that will not tolerate DisplayError() dialog since we're already in an
|
||||
// event handler in there.
|
||||
Prj().SchLibs();
|
||||
|
||||
m_canvas->Refresh( true );
|
||||
|
||||
return true;
|
||||
|
@ -363,6 +361,7 @@ bool SCH_EDIT_FRAME::AppendOneEEProject()
|
|||
|
||||
// load the project
|
||||
bool success = LoadOneEEFile( screen, fullFileName, true );
|
||||
|
||||
if( success )
|
||||
{
|
||||
// load sub-sheets
|
||||
|
|
|
@ -260,6 +260,7 @@ again." );
|
|||
aScreen->Show( 0, std::cout );
|
||||
#endif
|
||||
|
||||
aScreen->BuildSchCmpLinksToLibCmp(); // Build links between each components and its part lib LIB_PART
|
||||
aScreen->TestDanglingEnds();
|
||||
|
||||
msgDiag.Printf( _( "Done Loading <%s>" ), GetChars( aScreen->GetFileName() ) );
|
||||
|
|
|
@ -546,13 +546,11 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
|
||||
void SCH_SCREEN::BuildSchCmpLinksToLibCmp()
|
||||
{
|
||||
/* note: SCH_SCREEN::Draw is useful only for schematic.
|
||||
* library editor and library viewer do not use m_drawList, and therefore
|
||||
* their SCH_SCREEN::Draw() draws nothing
|
||||
*/
|
||||
// Initialize or reinitialize the pointer to the LIB_PART for each component
|
||||
// found in m_drawList, but only if needed (change in lib or schematic)
|
||||
// therefore the calculation time is usually very low.
|
||||
|
||||
if( m_drawList.GetCount() )
|
||||
{
|
||||
|
@ -571,6 +569,18 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
|||
m_modification_sync = mod_hash; // note the last mod_hash
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
|
||||
{
|
||||
/* note: SCH_SCREEN::Draw is useful only for schematic.
|
||||
* library editor and library viewer do not use m_drawList, and therefore
|
||||
* their SCH_SCREEN::Draw() draws nothing
|
||||
*/
|
||||
|
||||
BuildSchCmpLinksToLibCmp();
|
||||
|
||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||
{
|
||||
|
@ -592,6 +602,8 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode
|
|||
*/
|
||||
void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||
{
|
||||
BuildSchCmpLinksToLibCmp();
|
||||
|
||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||
{
|
||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
||||
|
@ -1395,6 +1407,13 @@ void SCH_SCREENS::BuildScreenList( EDA_ITEM* aItem )
|
|||
if( aItem && aItem->Type() == SCH_SCREEN_T )
|
||||
{
|
||||
SCH_SCREEN* screen = (SCH_SCREEN*) aItem;
|
||||
|
||||
// Ensure each component has its pointer to its part lib LIB_PART
|
||||
// up to date (the cost is low if this is the case)
|
||||
// We do this update here, because most of time this function is called
|
||||
// to create a netlist, or an ERC, which need this update
|
||||
screen->BuildSchCmpLinksToLibCmp();
|
||||
|
||||
AddScreenToList( screen );
|
||||
EDA_ITEM* strct = screen->GetDrawItems();
|
||||
|
||||
|
|
|
@ -193,6 +193,16 @@ public:
|
|||
|
||||
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ) { };
|
||||
|
||||
/**
|
||||
* Initialize or reinitialize the pointer
|
||||
* to the LIB_PART for each component found in m_drawList
|
||||
* must be called:
|
||||
* in Draw function
|
||||
* when loading a schematic file
|
||||
* before creating a netlist (in case a library is modified)
|
||||
*/
|
||||
void BuildSchCmpLinksToLibCmp();
|
||||
|
||||
/**
|
||||
* Function Draw
|
||||
* draws all the items in the screen to \a aCanvas.
|
||||
|
|
Loading…
Reference in New Issue