Footprint editor items always get added to footprint.

Also fixes an unrelated crash when assuming the current
editor is the board editor.
This commit is contained in:
Jeff Young 2024-01-21 22:49:29 +00:00
parent 6fca467e2a
commit d6b39c672e
2 changed files with 24 additions and 16 deletions

View File

@ -262,7 +262,12 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
if( !( changeFlags & CHT_DONE ) )
{
if( FOOTPRINT* parentFP = boardItem->GetParentFootprint() )
if( !m_isBoardEditor )
{
FOOTPRINT* parentFP = board->GetFirstFootprint();
parentFP->Add( boardItem );
}
else if( FOOTPRINT* parentFP = boardItem->GetParentFootprint() )
{
parentFP->Add( boardItem );
}

View File

@ -1651,26 +1651,29 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
msgItems.emplace_back( _( "Selected Items" ),
wxString::Format( wxT( "%d" ), selection.GetSize() ) );
std::set<wxString> netNames;
std::set<wxString> netClasses;
for( EDA_ITEM* item : selection )
if( m_isBoardEditor )
{
if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
std::set<wxString> netNames;
std::set<wxString> netClasses;
for( EDA_ITEM* item : selection )
{
netNames.insert( UnescapeString( bci->GetNetname() ) );
netClasses.insert( UnescapeString( bci->GetEffectiveNetClass()->GetName() ) );
if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
{
netNames.insert( UnescapeString( bci->GetNetname() ) );
netClasses.insert( UnescapeString( bci->GetEffectiveNetClass()->GetName() ) );
if( netNames.size() > 1 && netClasses.size() > 1 )
break;
if( netNames.size() > 1 && netClasses.size() > 1 )
break;
}
}
if( netNames.size() == 1 )
msgItems.emplace_back( _( "Net" ), *netNames.begin() );
if( netClasses.size() == 1 )
msgItems.emplace_back( _( "Resolved Netclass" ), *netClasses.begin() );
}
if( netNames.size() == 1 )
msgItems.emplace_back( _( "Net" ), *netNames.begin() );
if( netClasses.size() == 1 )
msgItems.emplace_back( _( "Resolved Netclass" ), *netClasses.begin() );
}
else
{