Update footprint value when doing a Save As to library.

Fixes: lp:1570120
* https://bugs.launchpad.net/kicad/+bug/1570120
This commit is contained in:
Jeff Young 2018-06-11 14:42:43 +01:00
parent 5c65881fde
commit 8a2639325d
2 changed files with 13 additions and 1 deletions

View File

@ -41,7 +41,7 @@
#include <invoke_pcb_dialog.h>
#include <pcb_layer_widget.h>
#include <board_commit.h>
#include <view/view.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
@ -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;

View File

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