PCB: update footprint field when changing footprints

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17598
This commit is contained in:
Mike Williams 2024-03-27 15:08:52 -04:00
parent 1acb1afa98
commit 48b3b4697a
3 changed files with 11 additions and 1 deletions

View File

@ -382,6 +382,9 @@ void DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
m_reset3DModels->GetValue(),
&updated );
// Update footprint field with the new FPID
newFootprint->Footprint().SetText( aNewFPID.Format() );
if( aFootprint == m_currentFootprint )
m_currentFootprint = newFootprint;

View File

@ -228,7 +228,11 @@ public:
}
const LIB_ID& GetFPID() const { return m_fpid; }
void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
void SetFPID( const LIB_ID& aFPID )
{
m_fpid = aFPID;
Footprint().SetText( aFPID.Format() );
}
wxString GetFPIDAsString() const { return m_fpid.Format(); }
void SetFPIDAsString( const wxString& aFPID ) { m_fpid.Parse( aFPID ); }

View File

@ -2374,6 +2374,9 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
// Updating other parameters
const_cast<KIID&>( aNew->m_Uuid ) = aExisting->m_Uuid;
aNew->SetPath( aExisting->GetPath() );
aNew->SetSheetfile( aExisting->GetSheetfile() );
aNew->SetSheetname( aExisting->GetSheetname() );
aNew->SetFilters( aExisting->GetFilters() );
aCommit.Remove( aExisting );
aCommit.Add( aNew );