Browse Source

Units are stored in the instance data

At the moment, units are stored in the instance data, so when loading
the file, all symbols will have bbox for the first unit.  After calling
`UpdateUnit()`, we need to recache the rtree bounding boxes to get
correct hit tests

Fixes https://gitlab.com/kicad/code/kicad/issues/11681
7.0
Seth Hillbrand 3 years ago
parent
commit
939313088e
  1. 2
      eeschema/files-io.cpp
  2. 2
      eeschema/sch_painter.cpp
  3. 13
      eeschema/sch_sheet_path.cpp

2
eeschema/files-io.cpp

@ -488,6 +488,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SyncView();
GetScreen()->ClearDrawingState();
TestDanglingEnds();
UpdateHierarchyNavigator();
UpdateTitle();
m_toolManager->GetTool<SCH_NAVIGATE_TOOL>()->ResetHistory();

2
eeschema/sch_painter.cpp

@ -2113,6 +2113,8 @@ void SCH_PAINTER::draw( SCH_SYMBOL* aSymbol, int aLayer )
if( symbolPin->IsDangling() )
tempPin->SetFlags( IS_DANGLING );
else
tempPin->ClearFlags( IS_DANGLING );
}
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert() );

13
eeschema/sch_sheet_path.cpp

@ -314,13 +314,24 @@ wxString SCH_SHEET_PATH::PathHumanReadable( bool aUseShortRootName ) const
void SCH_SHEET_PATH::UpdateAllScreenReferences() const
{
for( SCH_ITEM* item : LastScreen()->Items().OfType( SCH_SYMBOL_T ) )
std::vector<SCH_ITEM*> symbols;
std::copy_if( LastScreen()->Items().begin(),
LastScreen()->Items().end(),
std::back_inserter( symbols ),
[]( SCH_ITEM* aItem )
{
return ( aItem->Type() == SCH_SYMBOL_T );
} );
for( SCH_ITEM* item : symbols )
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
symbol->GetField( REFERENCE_FIELD )->SetText( symbol->GetRef( this ) );
symbol->GetField( VALUE_FIELD )->SetText( symbol->GetValue( this, false ) );
symbol->GetField( FOOTPRINT_FIELD )->SetText( symbol->GetFootprint( this, false ) );
symbol->UpdateUnit( symbol->GetUnitSelection( this ) );
LastScreen()->Update( item );
}
}

Loading…
Cancel
Save