diff --git a/eeschema/dialogs/dialog_update_fields.cpp b/eeschema/dialogs/dialog_update_fields.cpp index b794cc5793..4419993e6d 100644 --- a/eeschema/dialogs/dialog_update_fields.cpp +++ b/eeschema/dialogs/dialog_update_fields.cpp @@ -168,7 +168,13 @@ void DIALOG_UPDATE_FIELDS::updateFields( SCH_COMPONENT* aComponent ) field = &newFields.back(); } - field->SetText( libField->GetText() ); + // If the library field is empty an update would clear an existing entry. + // Check if this is the desired behavior. + auto newText = libField->GetText(); + if( !newText.empty() || !m_omitEmpty->IsChecked() ) + { + field->SetText( newText ); + } } // Apply changes & clean-up diff --git a/eeschema/dialogs/dialog_update_fields_base.cpp b/eeschema/dialogs/dialog_update_fields_base.cpp index 825ad626f1..91fcfe123c 100644 --- a/eeschema/dialogs/dialog_update_fields_base.cpp +++ b/eeschema/dialogs/dialog_update_fields_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Feb 6 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -41,6 +41,11 @@ DIALOG_UPDATE_FIELDS_BASE::DIALOG_UPDATE_FIELDS_BASE( wxWindow* parent, wxWindow m_mainSizer->Add( m_removeExtraBox, 0, wxALL, 5 ); + m_omitEmpty = new wxCheckBox( this, wxID_ANY, _("Omit empty fields"), wxDefaultPosition, wxDefaultSize, 0 ); + m_omitEmpty->SetToolTip( _("Do not clear existing entries if library field is empty") ); + + m_mainSizer->Add( m_omitEmpty, 0, wxALL, 5 ); + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_mainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); diff --git a/eeschema/dialogs/dialog_update_fields_base.fbp b/eeschema/dialogs/dialog_update_fields_base.fbp index 70e6e54511..3652e465b1 100644 --- a/eeschema/dialogs/dialog_update_fields_base.fbp +++ b/eeschema/dialogs/dialog_update_fields_base.fbp @@ -14,6 +14,7 @@ dialog_update_fields_base 1000 none + 1 dialog_update_fields_base @@ -540,6 +541,94 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Omit empty fields + + 0 + + + 0 + + 1 + m_omitEmpty + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + Do not clear existing entries if library field is empty + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND | wxALL diff --git a/eeschema/dialogs/dialog_update_fields_base.h b/eeschema/dialogs/dialog_update_fields_base.h index 5a301a0707..76b9bd85f9 100644 --- a/eeschema/dialogs/dialog_update_fields_base.h +++ b/eeschema/dialogs/dialog_update_fields_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 22 2017) +// C++ code generated with wxFormBuilder (version Feb 6 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -41,6 +41,7 @@ class DIALOG_UPDATE_FIELDS_BASE : public DIALOG_SHIM wxButton* m_selAllBtn; wxButton* m_selNoneBtn; wxCheckBox* m_removeExtraBox; + wxCheckBox* m_omitEmpty; wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK;