diff --git a/pcbnew/dialogs/dialog_exchange_footprints.cpp b/pcbnew/dialogs/dialog_exchange_footprints.cpp
index 779788de10..9f9d83dd59 100644
--- a/pcbnew/dialogs/dialog_exchange_footprints.cpp
+++ b/pcbnew/dialogs/dialog_exchange_footprints.cpp
@@ -71,7 +71,8 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_matchSpecifiedValue->SetLabel( _( "Change footprints matching value:" ) );
m_matchSpecifiedID->SetLabel( _( "Change footprints with library id:" ) );
m_resetTextItemLayers->SetLabel( _( "Update text layers and visibilities" ) );
- m_resetTextItemEffects->SetLabel( _( "Update text sizes, styles and positions" ) );
+ m_resetTextItemEffects->SetLabel( _( "Update text sizes and styles" ) );
+ m_resetTextItemPositions->SetLabel( _( "Update text positions" ) );
m_resetTextItemContent->SetLabel( _( "Update text content" ) );
m_resetFabricationAttrs->SetLabel( _( "Update fabrication attributes" ) );
m_resetClearanceOverrides->SetLabel( _( "Update clearance overrides" ) );
@@ -104,6 +105,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_removeExtraBox->SetValue( m_updateMode ? false : false );
m_resetTextItemLayers->SetValue( m_updateMode ? false : true );
m_resetTextItemEffects->SetValue( m_updateMode ? false : true );
+ m_resetTextItemPositions->SetValue( m_updateMode ? false : true );
m_resetTextItemContent->SetValue( m_updateMode ? false : true );
m_resetFabricationAttrs->SetValue( m_updateMode ? false : true );
m_resetClearanceOverrides->SetValue( m_updateMode ? true : true );
@@ -284,12 +286,13 @@ void DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked( wxCommandEvent& aEvent )
void DIALOG_EXCHANGE_FOOTPRINTS::checkAll( bool aCheck )
{
m_removeExtraBox->SetValue( aCheck );
- m_resetTextItemLayers->SetValue( aCheck );
- m_resetTextItemEffects->SetValue( aCheck );
- m_resetTextItemContent->SetValue( aCheck );
- m_resetFabricationAttrs->SetValue( aCheck );
- m_resetClearanceOverrides->SetValue( aCheck );
- m_reset3DModels->SetValue( aCheck );
+ m_resetTextItemLayers->SetValue( aCheck );
+ m_resetTextItemEffects->SetValue( aCheck );
+ m_resetTextItemPositions->SetValue( aCheck );
+ m_resetTextItemContent->SetValue( aCheck );
+ m_resetFabricationAttrs->SetValue( aCheck );
+ m_resetClearanceOverrides->SetValue( aCheck );
+ m_reset3DModels->SetValue( aCheck );
}
@@ -380,6 +383,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
m_removeExtraBox->GetValue(),
m_resetTextItemLayers->GetValue(),
m_resetTextItemEffects->GetValue(),
+ m_resetTextItemPositions->GetValue(),
m_resetTextItemContent->GetValue(),
m_resetFabricationAttrs->GetValue(),
m_resetClearanceOverrides->GetValue(),
diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp
index 42de8338be..79466ddb46 100644
--- a/pcbnew/dialogs/dialog_exchange_footprints_base.cpp
+++ b/pcbnew/dialogs/dialog_exchange_footprints_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
+// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -112,9 +112,12 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare
m_resetTextItemLayers = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset text layers and visibilities"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_resetTextItemLayers, 0, wxBOTTOM|wxRIGHT, 5 );
- m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset text sizes, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_resetTextItemEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset text sizes and styles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 );
+ m_resetTextItemPositions = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset text positions"), wxDefaultPosition, wxDefaultSize, 0 );
+ bSizer5->Add( m_resetTextItemPositions, 0, wxBOTTOM|wxRIGHT, 5 );
+
m_resetTextItemContent = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset text content"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_resetTextItemContent, 0, wxBOTTOM|wxRIGHT, 5 );
diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp
index cb8f4b8ce2..cc3af055b0 100644
--- a/pcbnew/dialogs/dialog_exchange_footprints_base.fbp
+++ b/pcbnew/dialogs/dialog_exchange_footprints_base.fbp
@@ -1212,7 +1212,7 @@
0
0
wxID_ANY
- Update/reset text sizes, styles and positions
+ Update/reset text sizes and styles
0
@@ -1243,6 +1243,71 @@
+
5
wxBOTTOM|wxRIGHT
diff --git a/pcbnew/dialogs/dialog_exchange_footprints_base.h b/pcbnew/dialogs/dialog_exchange_footprints_base.h
index aa4af8bdc4..f685f8e4b8 100644
--- a/pcbnew/dialogs/dialog_exchange_footprints_base.h
+++ b/pcbnew/dialogs/dialog_exchange_footprints_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
+// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -63,6 +63,7 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM
wxCheckBox* m_removeExtraBox;
wxCheckBox* m_resetTextItemLayers;
wxCheckBox* m_resetTextItemEffects;
+ wxCheckBox* m_resetTextItemPositions;
wxCheckBox* m_resetTextItemContent;
wxButton* m_checkAll;
wxCheckBox* m_resetFabricationAttrs;
diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp
index 213d187c76..72c0a6ca16 100644
--- a/pcbnew/pcb_edit_frame.cpp
+++ b/pcbnew/pcb_edit_frame.cpp
@@ -2210,7 +2210,7 @@ int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( FOOTPRINT* aFootprint, bool aU
*/
static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
bool aResetText, bool aResetTextLayers, bool aResetTextEffects,
- bool* aUpdated )
+ bool aResetTextPositions, bool* aUpdated )
{
if( aResetText )
*aUpdated |= aSrc.GetText() != aDest.GetText();
@@ -2228,6 +2228,8 @@ static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
aDest.SetVisible( aSrc.IsVisible() );
}
+ VECTOR2I origPos = aDest.GetFPRelativePosition();
+
if( aResetTextEffects )
{
*aUpdated |= aSrc.GetHorizJustify() != aDest.GetHorizJustify();
@@ -2235,12 +2237,19 @@ static void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
*aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
*aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
*aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
- *aUpdated |= aSrc.GetFPRelativePosition() != aDest.GetFPRelativePosition();
}
else
{
- // Careful: SetAttributes() will clobber the position
aDest.SetAttributes( aSrc );
+ }
+
+ if( aResetTextPositions )
+ {
+ *aUpdated |= aSrc.GetFPRelativePosition() != origPos;
+ aDest.SetFPRelativePosition( origPos );
+ }
+ else
+ {
aDest.SetFPRelativePosition( aSrc.GetFPRelativePosition() );
}
@@ -2302,6 +2311,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
bool deleteExtraTexts,
bool resetTextLayers,
bool resetTextEffects,
+ bool resetTextPositions,
bool resetTextContent,
bool resetFabricationAttrs,
bool resetClearanceOverrides,
@@ -2398,7 +2408,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
{
handledTextItems.insert( newTextItem );
processTextItem( *oldTextItem, *newTextItem, resetTextContent, resetTextLayers,
- resetTextEffects, aUpdated );
+ resetTextEffects, resetTextPositions, aUpdated );
}
else if( deleteExtraTexts )
{
@@ -2434,14 +2444,14 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
// Copy reference. The initial text is always used, never resetted
processTextItem( aExisting->Reference(), aNew->Reference(), false, resetTextLayers,
- resetTextEffects, aUpdated );
+ resetTextEffects, resetTextPositions, aUpdated );
// Copy value
processTextItem( aExisting->Value(), aNew->Value(),
// reset value text only when it is a proxy for the footprint ID
// (cf replacing value "MountingHole-2.5mm" with "MountingHole-4.0mm")
aExisting->GetValue() == aExisting->GetFPID().GetLibItemName().wx_str(),
- resetTextLayers, resetTextEffects, aUpdated );
+ resetTextLayers, resetTextEffects, resetTextPositions, aUpdated );
std::set handledFields;
@@ -2458,7 +2468,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
{
handledFields.insert( newField );
processTextItem( *oldField, *newField, resetTextContent, resetTextLayers,
- resetTextEffects, aUpdated );
+ resetTextEffects, resetTextPositions, aUpdated );
}
else if( deleteExtraTexts )
{
diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index 427040ae11..4463015add 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -525,8 +525,9 @@ public:
bool deleteExtraTexts = true,
bool resetTextLayers = true,
bool resetTextEffects = true,
- bool resetFabricationAttrs = true,
+ bool resetTextPositions = true,
bool resetTextContent = true,
+ bool resetFabricationAttrs = true,
bool resetClearanceOverrides = true,
bool reset3DModels = true,
bool* aUpdated = nullptr );