Separate reset text pos from other attr
Position is frequently usefully placed and we might not want to nuke it just to get the updated text Fixes https://gitlab.com/kicad/code/kicad/-/issues/18387
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -1212,7 +1212,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Update/reset text sizes, styles and positions</property>
|
||||
<property name="label">Update/reset text sizes and styles</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@@ -1243,6 +1243,71 @@
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Update/reset text positions</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_resetTextItemPositions</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT</property>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<PCB_FIELD*> 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 )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user