Browse Source

PCB: update footprint field when changing footprints

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17598
newinvert
Mike Williams 2 years ago
parent
commit
48b3b4697a
  1. 3
      pcbnew/dialogs/dialog_exchange_footprints.cpp
  2. 6
      pcbnew/footprint.h
  3. 3
      pcbnew/pcb_edit_frame.cpp

3
pcbnew/dialogs/dialog_exchange_footprints.cpp

@ -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;

6
pcbnew/footprint.h

@ -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 ); }

3
pcbnew/pcb_edit_frame.cpp

@ -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 );

Loading…
Cancel
Save