From 8a2639325d0ddb9fb78eb6f5fadddca72db4aeb0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 11 Jun 2018 14:42:43 +0100 Subject: [PATCH] Update footprint value when doing a Save As to library. Fixes: lp:1570120 * https://bugs.launchpad.net/kicad/+bug/1570120 --- pcbnew/footprint_editor_utils.cpp | 10 +++++++++- pcbnew/footprint_libraries_utils.cpp | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index b8f71b3df5..7f56617894 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -41,7 +41,7 @@ #include #include #include - +#include #include #include #include @@ -382,6 +382,14 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( GetBoard()->m_Modules ) { SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules ); + + m_toolManager->GetView()->Update( GetBoard()->m_Modules ); + + if( IsGalCanvasActive() && GetGalCanvas() ) + GetGalCanvas()->ForceRefresh(); + else + GetCanvas()->Refresh(); + GetScreen()->ClrModify(); } break; diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 79a687f606..156503f0aa 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -701,6 +701,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( wxString activeLibrary, MODUL wxString libraryName = aModule->GetFPID().GetLibNickname(); wxString footprintName = aModule->GetFPID().GetLibItemName(); + bool updateValue = ( aModule->GetValue() == footprintName ); if( libraryName.IsEmpty() ) libraryName = activeLibrary; @@ -776,6 +777,9 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( wxString activeLibrary, MODUL aModule->SetFPID( LIB_ID( libraryName, footprintName ) ); + if( updateValue ) + aModule->SetValue( footprintName ); + // Legacy libraries are readable, but modifying legacy format is not allowed // So prompt the user if he try to add/replace a footprint in a legacy lib wxString libfullname = Prj().PcbFootprintLibs()->FindRow( libraryName )->GetFullURI();