From 3b280e488663bbc5b002b9898d98b394cd02e69f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 9 Aug 2020 12:28:59 +0100 Subject: [PATCH] Keep properties across an Exchange_Module call. This is also used when saving a footprint from the Footprint Editor back to the board. Fixes https://gitlab.com/kicad/code/kicad/issues/5114 Fixes https://gitlab.com/kicad/code/kicad/issues/5114 --- pcbnew/dialogs/dialog_exchange_footprints.cpp | 1 + pcbnew/footprint_edit_frame.cpp | 5 ++++- pcbnew/footprint_libraries_utils.cpp | 6 ++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index 5d7ea5f249..7f7346df21 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -523,6 +523,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& // Updating other parameters const_cast( aDest->m_Uuid ) = aSrc->m_Uuid; + aDest->SetProperties( aSrc->GetProperties() ); aDest->SetPath( aSrc->GetPath() ); aDest->CalculateBoundingBox(); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index e4519b895c..fe707074c7 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -517,7 +517,10 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent ) wxString msg = _( "Save changes to \"%s\" before closing?" ); if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ), - [&]() -> bool { return SaveFootprint( GetBoard()->GetFirstModule() ); } ) ) + [&]() -> bool + { + return SaveFootprint( GetBoard()->GetFirstModule() ); + } ) ) { aEvent.Veto(); return; diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 83cc8f0566..48bfe209a1 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -826,10 +826,8 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) if( source_module ) // this is an update command { - // In the main board, - // the new module replace the old module (pos, orient, ref, value - // and connexions are kept) - // and the source_module (old module) is deleted + // In the main board the new module replaces the old module (pos, orient, ref, value, + // connections and properties are kept) and the source_module (old module) is deleted pcbframe->Exchange_Module( source_module, newmodule, commit ); const_cast( newmodule->m_Uuid ) = module_in_edit->GetLink(); commit.Push( wxT( "Update module" ) );