From 48b3b4697a49460ea64e6ddd84765f7705774056 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 27 Mar 2024 15:08:52 -0400 Subject: [PATCH] PCB: update footprint field when changing footprints Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17598 --- pcbnew/dialogs/dialog_exchange_footprints.cpp | 3 +++ pcbnew/footprint.h | 6 +++++- pcbnew/pcb_edit_frame.cpp | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 02900aa429..0bb6e93709 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/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; diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index c1c5107e2d..46e187bf32 100644 --- a/pcbnew/footprint.h +++ b/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 ); } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index ec408e5b3e..204b4cc367 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -2374,6 +2374,9 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, // Updating other parameters const_cast( 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 );