diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp index bf10795c4c..7a1f58c419 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.cpp +++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp @@ -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; } diff --git a/pcbnew/dialogs/dialog_exchange_footprints.h b/pcbnew/dialogs/dialog_exchange_footprints.h index a28972b413..21e933d481 100644 --- a/pcbnew/dialogs/dialog_exchange_footprints.h +++ b/pcbnew/dialogs/dialog_exchange_footprints.h @@ -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; diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index c9b4ee29e3..9772755ba1 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -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. *