Update Footprint: add checkbox for text content

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17935
This commit is contained in:
Mike Williams 2024-05-20 09:16:04 -04:00
parent 21022b4fa4
commit 8e286d44fc
6 changed files with 1490 additions and 1394 deletions

View File

@ -55,6 +55,7 @@ int g_matchModeForExchangeSelected = ID_MATCH_FP_SELECTED;
bool g_removeExtraTextItems[2] = { false, false }; bool g_removeExtraTextItems[2] = { false, false };
bool g_resetTextItemLayers[2] = { false, true }; bool g_resetTextItemLayers[2] = { false, true };
bool g_resetTextItemEffects[2] = { false, true }; bool g_resetTextItemEffects[2] = { false, true };
bool g_resetTextItemContent[2] = { false, true };
bool g_resetFabricationAttrs[2] = { false, true }; bool g_resetFabricationAttrs[2] = { false, true };
bool g_reset3DModels[2] = { true, true }; bool g_reset3DModels[2] = { true, true };
@ -78,6 +79,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_matchSpecifiedID->SetLabel( _( "Change footprints with library id:" ) ); m_matchSpecifiedID->SetLabel( _( "Change footprints with library id:" ) );
m_resetTextItemLayers->SetLabel( _( "Update text layers and visibilities" ) ); m_resetTextItemLayers->SetLabel( _( "Update text layers and visibilities" ) );
m_resetTextItemEffects->SetLabel( _( "Update text sizes, styles and positions" ) ); m_resetTextItemEffects->SetLabel( _( "Update text sizes, styles and positions" ) );
m_resetTextItemContent->SetLabel( _( "Update text content" ) );
m_resetFabricationAttrs->SetLabel( _( "Update fabrication attributes" ) ); m_resetFabricationAttrs->SetLabel( _( "Update fabrication attributes" ) );
m_reset3DModels->SetLabel( _( "Update 3D models" ) ); m_reset3DModels->SetLabel( _( "Update 3D models" ) );
} }
@ -142,6 +144,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS( PCB_EDIT_FRAME* aParent,
m_removeExtraBox->SetValue( g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] ); m_removeExtraBox->SetValue( g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] );
m_resetTextItemLayers->SetValue( g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] ); m_resetTextItemLayers->SetValue( g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] );
m_resetTextItemEffects->SetValue( g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] ); m_resetTextItemEffects->SetValue( g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] );
m_resetTextItemContent->SetValue( g_resetTextItemContent[ m_updateMode ? 0 : 1 ] );
m_resetFabricationAttrs->SetValue( g_resetFabricationAttrs[ m_updateMode ? 0 : 1 ] ); m_resetFabricationAttrs->SetValue( g_resetFabricationAttrs[ m_updateMode ? 0 : 1 ] );
m_reset3DModels->SetValue( g_reset3DModels[ m_updateMode ? 0 : 1 ] ); m_reset3DModels->SetValue( g_reset3DModels[ m_updateMode ? 0 : 1 ] );
@ -167,6 +170,7 @@ DIALOG_EXCHANGE_FOOTPRINTS::~DIALOG_EXCHANGE_FOOTPRINTS()
g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] = m_removeExtraBox->GetValue(); g_removeExtraTextItems[ m_updateMode ? 0 : 1 ] = m_removeExtraBox->GetValue();
g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] = m_resetTextItemLayers->GetValue(); g_resetTextItemLayers[ m_updateMode ? 0 : 1 ] = m_resetTextItemLayers->GetValue();
g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] = m_resetTextItemEffects->GetValue(); g_resetTextItemEffects[ m_updateMode ? 0 : 1 ] = m_resetTextItemEffects->GetValue();
g_resetTextItemContent[ m_updateMode ? 0 : 1 ] = m_resetTextItemContent->GetValue();
g_resetFabricationAttrs[ m_updateMode ? 0 : 1 ] = m_resetFabricationAttrs->GetValue(); g_resetFabricationAttrs[ m_updateMode ? 0 : 1 ] = m_resetFabricationAttrs->GetValue();
g_reset3DModels[ m_updateMode ? 0 : 1 ] = m_reset3DModels->GetValue(); g_reset3DModels[ m_updateMode ? 0 : 1 ] = m_reset3DModels->GetValue();
} }
@ -379,6 +383,7 @@ void DIALOG_EXCHANGE_FOOTPRINTS::processFootprint( FOOTPRINT* aFootprint, const
m_removeExtraBox->GetValue(), m_removeExtraBox->GetValue(),
m_resetTextItemLayers->GetValue(), m_resetTextItemLayers->GetValue(),
m_resetTextItemEffects->GetValue(), m_resetTextItemEffects->GetValue(),
m_resetTextItemContent->GetValue(),
m_resetFabricationAttrs->GetValue(), m_resetFabricationAttrs->GetValue(),
m_reset3DModels->GetValue(), m_reset3DModels->GetValue(),
&updated ); &updated );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -105,6 +105,9 @@ DIALOG_EXCHANGE_FOOTPRINTS_BASE::DIALOG_EXCHANGE_FOOTPRINTS_BASE( wxWindow* pare
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, styles and positions"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 ); m_updateOptionsSizer->Add( m_resetTextItemEffects, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetTextItemContent = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset text content"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetTextItemContent, 0, wxBOTTOM|wxRIGHT, 5 );
m_resetFabricationAttrs = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset fabrication attributes"), wxDefaultPosition, wxDefaultSize, 0 ); m_resetFabricationAttrs = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset fabrication attributes"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetFabricationAttrs, 0, wxBOTTOM|wxRIGHT, 5 ); m_updateOptionsSizer->Add( m_resetFabricationAttrs, 0, wxBOTTOM|wxRIGHT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -64,6 +64,7 @@ class DIALOG_EXCHANGE_FOOTPRINTS_BASE : public DIALOG_SHIM
wxCheckBox* m_removeExtraBox; wxCheckBox* m_removeExtraBox;
wxCheckBox* m_resetTextItemLayers; wxCheckBox* m_resetTextItemLayers;
wxCheckBox* m_resetTextItemEffects; wxCheckBox* m_resetTextItemEffects;
wxCheckBox* m_resetTextItemContent;
wxCheckBox* m_resetFabricationAttrs; wxCheckBox* m_resetFabricationAttrs;
wxCheckBox* m_reset3DModels; wxCheckBox* m_reset3DModels;
WX_HTML_REPORT_PANEL* m_MessageWindow; WX_HTML_REPORT_PANEL* m_MessageWindow;

View File

@ -2244,8 +2244,8 @@ static PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint
void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
BOARD_COMMIT& aCommit, bool deleteExtraTexts, BOARD_COMMIT& aCommit, bool deleteExtraTexts,
bool resetTextLayers, bool resetTextEffects, bool resetTextLayers, bool resetTextEffects,
bool resetFabricationAttrs, bool reset3DModels, bool resetTextContent, bool resetFabricationAttrs,
bool* aUpdated ) bool reset3DModels, bool* aUpdated )
{ {
PCB_GROUP* parentGroup = aExisting->GetParentGroup(); PCB_GROUP* parentGroup = aExisting->GetParentGroup();
bool dummyBool = false; bool dummyBool = false;
@ -2334,8 +2334,8 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
if( destItem ) if( destItem )
{ {
processTextItem( *srcItem, *destItem, false, resetTextLayers, resetTextEffects, processTextItem( *srcItem, *destItem, resetTextContent, resetTextLayers,
aUpdated ); resetTextEffects, aUpdated );
} }
else if( !deleteExtraTexts ) else if( !deleteExtraTexts )
{ {
@ -2373,7 +2373,8 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
} }
else else
{ {
processTextItem( *field, *newField, false, resetTextLayers, resetTextEffects, aUpdated ); processTextItem( *field, *newField, resetTextContent, resetTextLayers, resetTextEffects,
aUpdated );
} }
} }

View File

@ -573,7 +573,8 @@ public:
void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit, void ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew, BOARD_COMMIT& aCommit,
bool deleteExtraTexts = true, bool resetTextLayers = true, bool deleteExtraTexts = true, bool resetTextLayers = true,
bool resetTextEffects = true, bool resetFabricationAttrs = true, bool resetTextEffects = true, bool resetFabricationAttrs = true,
bool reset3DModels = true, bool* aUpdated = nullptr ); bool resetTextContent = true, bool reset3DModels = true,
bool* aUpdated = nullptr );
/** /**
* Install the corresponding dialog editor for the given item. * Install the corresponding dialog editor for the given item.