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
This commit is contained in:
Jeff Young 2020-08-09 12:28:59 +01:00
parent 4317881012
commit 3b280e4886
3 changed files with 7 additions and 5 deletions

View File

@ -523,6 +523,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT&
// Updating other parameters
const_cast<KIID&>( aDest->m_Uuid ) = aSrc->m_Uuid;
aDest->SetProperties( aSrc->GetProperties() );
aDest->SetPath( aSrc->GetPath() );
aDest->CalculateBoundingBox();

View File

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

View File

@ -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<KIID&>( newmodule->m_Uuid ) = module_in_edit->GetLink();
commit.Push( wxT( "Update module" ) );