Add option to preserve custom power flag values in Update Symbols from Library dialog

(cherry picked from commit bf7896a0e1)
This commit is contained in:
James J 2024-03-10 18:32:00 +00:00 committed by Jon Evans
parent b9a6f47929
commit 75ef003747
3 changed files with 12 additions and 1 deletions

View File

@ -47,6 +47,7 @@ bool g_resetFieldVisibilities[2] = { true, false };
bool g_resetFieldEffects[2] = { true, false };
bool g_resetFieldPositions[2] = { true, false };
bool g_resetAttributes[2] = { true, false };
bool g_resetCustomPower[2] = { false, false };
DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBOL* aSymbol,
@ -146,6 +147,7 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
m_resetFieldEffects->SetValue( g_resetFieldEffects[ (int) m_mode ] );
m_resetFieldPositions->SetValue( g_resetFieldPositions[ (int) m_mode ] );
m_resetAttributes->SetValue( g_resetAttributes[ (int) m_mode ] );
m_resetCustomPower->SetValue( g_resetCustomPower[ (int) m_mode ] );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because the update and change versions of this dialog have different controls.
@ -227,6 +229,7 @@ DIALOG_CHANGE_SYMBOLS::~DIALOG_CHANGE_SYMBOLS()
g_resetFieldEffects[ (int) m_mode ] = m_resetFieldEffects->GetValue();
g_resetFieldPositions[ (int) m_mode ] = m_resetFieldPositions->GetValue();
g_resetAttributes[ (int) m_mode ] = m_resetAttributes->GetValue();
g_resetCustomPower[ (int) m_mode ] = m_resetCustomPower->GetValue();
}
@ -671,6 +674,8 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
}
else if( i == VALUE_FIELD )
{
if( ( symbol->IsPower() && m_resetCustomPower->IsChecked() )
|| !symbol->IsPower() )
symbol->SetValueFieldText( UnescapeString( libField->GetText() ) );
}
else if( i == FOOTPRINT_FIELD )

View File

@ -146,6 +146,11 @@ DIALOG_CHANGE_SYMBOLS_BASE::DIALOG_CHANGE_SYMBOLS_BASE( wxWindow* parent, wxWind
m_resetAttributes = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset symbol attributes"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetAttributes, 0, wxBOTTOM|wxRIGHT, 5 );
m_updateOptionsSizer->Add( 0, 10, 1, wxEXPAND, 5 );
m_resetCustomPower = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset custom power symbols"), wxDefaultPosition, wxDefaultSize, 0 );
m_updateOptionsSizer->Add( m_resetCustomPower, 0, wxBOTTOM|wxRIGHT, 5 );
bSizerUpdate->Add( m_updateOptionsSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );

View File

@ -74,6 +74,7 @@ class DIALOG_CHANGE_SYMBOLS_BASE : public DIALOG_SHIM
wxCheckBox* m_resetFieldEffects;
wxCheckBox* m_resetFieldPositions;
wxCheckBox* m_resetAttributes;
wxCheckBox* m_resetCustomPower;
WX_HTML_REPORT_PANEL* m_messagePanel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;