When updating footprints indicate which were changed.

Fixes https://gitlab.com/kicad/code/kicad/issues/4203
This commit is contained in:
Jeff Young 2021-09-03 22:40:45 +01:00
parent 4789440fe1
commit fcb013e5d7
3 changed files with 30 additions and 32 deletions

View File

@ -307,11 +307,10 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
m_MessageWindow->Clear();
m_MessageWindow->Flush( false );
if( processMatchingFootprints() )
{
m_parent->Compile_Ratsnest( true );
m_parent->GetCanvas()->Refresh();
}
processMatchingFootprints();
m_parent->Compile_Ratsnest( true );
m_parent->GetCanvas()->Refresh();
m_MessageWindow->Flush( false );
@ -319,21 +318,20 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked( wxCommandEvent& event )
}
bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
void DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
{
bool change = false;
LIB_ID newFPID;
wxString value;
if( m_parent->GetBoard()->Footprints().empty() )
return false;
return;
if( !m_updateMode )
{
newFPID.Parse( m_newID->GetValue() );
if( !newFPID.IsValid() )
return false;
return;
}
/*
@ -349,22 +347,14 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processMatchingFootprints()
continue;
if( m_updateMode )
{
if( processFootprint( footprint, footprint->GetFPID() ) )
change = true;
}
processFootprint( footprint, footprint->GetFPID() );
else
{
if( processFootprint( footprint, newFPID ) )
change = true;
}
processFootprint( footprint, newFPID );
}
return change;
}
bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID )
void DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID )
{
LIB_ID oldFPID = aFootprint->GetFPID();
wxString msg;
@ -372,14 +362,13 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
// Load new footprint.
if( m_updateMode )
{
msg.Printf( _( "Update footprint %s from '%s' to '%s'" ),
msg.Printf( _( "Updated footprint %s (%s)" ) + wxS( ": " ),
aFootprint->GetReference(),
oldFPID.Format().c_str(),
aNewFPID.Format().c_str() );
oldFPID.Format().c_str() );
}
else
{
msg.Printf( _( "Change footprint %s from '%s' to '%s'" ),
msg.Printf( _( "Changed footprint %s from '%s' to '%s'" ) + wxS( ": " ),
aFootprint->GetReference(),
oldFPID.Format().c_str(),
aNewFPID.Format().c_str() );
@ -389,11 +378,21 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
if( !newFootprint )
{
msg << ": " << _( "*** footprint not found ***" );
msg += _( "*** library footprint not found ***" );
m_MessageWindow->Report( msg, RPT_SEVERITY_ERROR );
return false;
return;
}
if( m_updateMode && !aFootprint->FootprintNeedsUpdate( newFootprint ) )
{
msg += _( ": (no changes)" );
m_MessageWindow->Report( msg, RPT_SEVERITY_INFO );
return;
}
msg += _( ": OK" );
m_MessageWindow->Report( msg, RPT_SEVERITY_ACTION );
m_parent->ExchangeFootprint( aFootprint, newFootprint, m_commit,
m_removeExtraBox->GetValue(),
m_resetTextItemLayers->GetValue(),
@ -404,10 +403,7 @@ bool DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
if( aFootprint == m_currentFootprint )
m_currentFootprint = newFootprint;
msg += ": OK";
m_MessageWindow->Report( msg, RPT_SEVERITY_ACTION );
return true;
return;
}

View File

@ -53,8 +53,8 @@ private:
wxRadioButton* getRadioButtonForMode();
bool isMatch( FOOTPRINT* );
bool processMatchingFootprints();
bool processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID );
void processMatchingFootprints();
void processFootprint( FOOTPRINT* aFootprint, const LIB_ID& aNewFPID );
BOARD_COMMIT m_commit;
PCB_EDIT_FRAME* m_parent;

View File

@ -537,6 +537,8 @@ public:
bool resetTextEffects = true, bool resetFabricationAttrs = true,
bool reset3DModels = true );
bool FootprintMatchesLibrary();
/**
* Install the corresponding dialog editor for the given item.
*