diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index 1d0e6b12a0..d31d9a8765 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -110,6 +110,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_symbol_remap_base.cpp
dialogs/dialog_update_from_pcb.cpp
dialogs/dialog_update_from_pcb_base.cpp
+ dialogs/dialog_update_symbol_fields.cpp
+ dialogs/dialog_update_symbol_fields_base.cpp
dialogs/panel_eeschema_color_settings.cpp
dialogs/panel_eeschema_template_fieldnames.cpp
dialogs/panel_eeschema_template_fieldnames_base.cpp
diff --git a/eeschema/dialogs/dialog_change_symbols.h b/eeschema/dialogs/dialog_change_symbols.h
index 6693d211fe..bddb5bc4b2 100644
--- a/eeschema/dialogs/dialog_change_symbols.h
+++ b/eeschema/dialogs/dialog_change_symbols.h
@@ -1,6 +1,3 @@
-#ifndef _DIALOG_CHANGE_SYMBOLS_H_
-#define _DIALOG_CHANGE_SYMBOLS_H_
-
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
@@ -23,6 +20,9 @@
* with this program. If not, see .
*/
+#ifndef _DIALOG_CHANGE_SYMBOLS_H_
+#define _DIALOG_CHANGE_SYMBOLS_H_
+
#include
class LIB_ID;
diff --git a/eeschema/dialogs/dialog_update_symbol_fields.cpp b/eeschema/dialogs/dialog_update_symbol_fields.cpp
new file mode 100644
index 0000000000..ed2120ed24
--- /dev/null
+++ b/eeschema/dialogs/dialog_update_symbol_fields.cpp
@@ -0,0 +1,214 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2020 CERN
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+
+bool g_removeExtraLibFields = false;
+bool g_resetEmptyLibFields = false;
+bool g_resetLibFieldVisibilities = true;
+bool g_resetLibFieldEffects = true;
+bool g_resetLibFieldPositions = true;
+
+
+DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent,
+ LIB_PART* aSymbol ) :
+ DIALOG_UPDATE_SYMBOL_FIELDS_BASE( aParent ),
+ m_editFrame( aParent ),
+ m_symbol( aSymbol)
+{
+ wxASSERT( aParent );
+ wxASSERT( aSymbol );
+
+ m_parentSymbolReadOnly->SetValue( m_symbol->GetParent().lock()->GetName() );
+
+ for( int i = 0; i < MANDATORY_FIELDS; ++i )
+ {
+ m_fieldsBox->Append( TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
+ m_fieldsBox->Check( i, true );
+ }
+
+ updateFieldsList();
+
+ m_removeExtraBox->SetValue( g_removeExtraLibFields );
+ m_resetEmptyFields->SetValue( g_resetEmptyLibFields );
+ m_resetFieldVisibilities->SetValue( g_resetLibFieldVisibilities );
+ m_resetFieldEffects->SetValue( g_resetLibFieldEffects );
+ m_resetFieldPositions->SetValue( g_resetLibFieldPositions );
+
+ m_sdbSizerOK->SetDefault();
+
+ // Now all widgets have the size fixed, call FinishDialogSettings
+ finishDialogSettings();
+}
+
+
+DIALOG_UPDATE_SYMBOL_FIELDS::~DIALOG_UPDATE_SYMBOL_FIELDS()
+{
+ g_removeExtraLibFields = m_removeExtraBox->GetValue();
+ g_resetEmptyLibFields = m_resetEmptyFields->GetValue();
+ g_resetLibFieldVisibilities = m_resetFieldVisibilities->GetValue();
+ g_resetLibFieldEffects = m_resetFieldEffects->GetValue();
+ g_resetLibFieldPositions = m_resetFieldPositions->GetValue();
+}
+
+
+void DIALOG_UPDATE_SYMBOL_FIELDS::updateFieldsList()
+{
+ // Load non-mandatory fields from the parent part
+ std::vector libFields;
+ std::set fieldNames;
+ std::unique_ptr flattenedParent = m_symbol->GetParent().lock()->Flatten();
+
+ flattenedParent->GetFields( libFields );
+
+ for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
+ fieldNames.insert( libFields[i]->GetName() );
+
+ libFields.clear(); // flattenedPart is about to go out of scope...
+
+ // Load non-mandatory fields from the editor symbol
+ m_symbol->GetFields( libFields );
+
+ for( unsigned i = MANDATORY_FIELDS; i < libFields.size(); ++i )
+ fieldNames.insert( libFields[i]->GetName() );
+
+ libFields.clear();
+
+ // Update the listbox widget
+ for( unsigned i = m_fieldsBox->GetCount() - 1; i >= MANDATORY_FIELDS; --i )
+ m_fieldsBox->Delete( i );
+
+ for( const wxString& fieldName : fieldNames )
+ m_fieldsBox->Append( fieldName );
+
+ for( unsigned i = MANDATORY_FIELDS; i < m_fieldsBox->GetCount(); ++i )
+ m_fieldsBox->Check( i, true );
+}
+
+
+void DIALOG_UPDATE_SYMBOL_FIELDS::checkAll( bool aCheck )
+{
+ for( unsigned i = 0; i < m_fieldsBox->GetCount(); ++i )
+ m_fieldsBox->Check( i, aCheck );
+}
+
+
+void DIALOG_UPDATE_SYMBOL_FIELDS::onOkButtonClicked( wxCommandEvent& aEvent )
+{
+ wxBusyCursor dummy;
+
+ m_editFrame->SaveCopyInUndoList( m_symbol, UNDO_REDO::LIBEDIT );
+
+ // Create the set of fields to be updated
+ m_updateFields.clear();
+
+ for( unsigned i = 0; i < m_fieldsBox->GetCount(); ++i )
+ {
+ if( m_fieldsBox->IsChecked( i ) )
+ m_updateFields.insert( m_fieldsBox->GetString( i ) );
+ }
+
+ std::unique_ptr flattenedParent = m_symbol->GetParent().lock()->Flatten();
+
+ bool removeExtras = m_removeExtraBox->GetValue();
+ bool resetEmpty = m_resetEmptyFields->GetValue();
+ bool resetVis = m_resetFieldVisibilities->GetValue();
+ bool resetEffects = m_resetFieldEffects->GetValue();
+ bool resetPositions = m_resetFieldPositions->GetValue();
+
+ std::vector fields;
+ std::vector result;
+ m_symbol->GetFields( fields );
+
+ for( LIB_FIELD& field : fields )
+ {
+ bool copy = true;
+ LIB_FIELD* parentField = nullptr;
+
+ if( alg::contains( m_updateFields, field.GetName() ) )
+ {
+ parentField = flattenedParent->FindField( field.GetName() );
+
+ if( parentField )
+ {
+ if( !parentField->GetText().IsEmpty() || resetEmpty )
+ field.SetText( parentField->GetText() );
+
+ if( resetVis )
+ field.SetVisible( parentField->IsVisible() );
+
+ if( resetEffects )
+ {
+ // Careful: the visible bit is also in Effects
+ bool visible = field.IsVisible();
+ field.SetEffects( *parentField );
+ field.SetVisible( visible );
+ }
+
+ if( resetPositions )
+ field.SetTextPos( parentField->GetTextPos() );
+ }
+ else if( removeExtras )
+ {
+ copy = false;
+ }
+ }
+
+ if( copy )
+ result.emplace_back( std::move( field ) );
+ }
+
+ std::vector parentFields;
+ int idx = result.size();
+
+ flattenedParent->GetFields( parentFields );
+
+ for( LIB_FIELD* parentField : parentFields )
+ {
+ if( !alg::contains( m_updateFields, parentField->GetName() ) )
+ continue;
+
+ if( !m_symbol->FindField( parentField->GetName() ) )
+ {
+ result.emplace_back( m_symbol, idx++ );
+ LIB_FIELD* newField = &result.back();
+
+ newField->SetName( parentField->GetCanonicalName() );
+ newField->SetEffects( *parentField );
+ newField->SetText( parentField->GetText() );
+ newField->SetTextPos( parentField->GetTextPos() );
+ }
+ }
+
+ m_symbol->SetFields( result );
+
+ m_editFrame->RebuildView();
+ m_editFrame->OnModify();
+ EndModal( wxID_OK );
+}
+
+
diff --git a/eeschema/dialogs/dialog_update_symbol_fields.h b/eeschema/dialogs/dialog_update_symbol_fields.h
new file mode 100644
index 0000000000..b21f3151a5
--- /dev/null
+++ b/eeschema/dialogs/dialog_update_symbol_fields.h
@@ -0,0 +1,65 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2020 CERN
+ * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#ifndef DIALOG_UPDATE_SYMBOL_FIELDS_H
+#define DIALOG_UPDATE_SYMBOL_FIELDS_H
+
+#include
+
+class LIB_ID;
+class LIB_PART;
+class SYMBOL_EDIT_FRAME;
+
+/**
+ * Dialog to update or change schematic library symbols.
+ */
+class DIALOG_UPDATE_SYMBOL_FIELDS : public DIALOG_UPDATE_SYMBOL_FIELDS_BASE
+{
+public:
+ DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aParent, LIB_PART* aPart );
+ ~DIALOG_UPDATE_SYMBOL_FIELDS() override;
+
+protected:
+ void onOkButtonClicked( wxCommandEvent& aEvent ) override;
+
+ void onSelectAll( wxCommandEvent& event ) override
+ {
+ checkAll( true );
+ }
+
+ void onSelectNone( wxCommandEvent& event ) override
+ {
+ checkAll( false );
+ }
+
+ ///< Select or deselect all fields in the listbox widget
+ void checkAll( bool aCheck );
+
+private:
+ void updateFieldsList();
+
+ SYMBOL_EDIT_FRAME* m_editFrame;
+ LIB_PART* m_symbol;
+
+ ///< Set of field names that should have values updated
+ std::set m_updateFields;
+};
+
+#endif // DIALOG_UPDATE_SYMBOL_FIELDS_H
diff --git a/eeschema/dialogs/dialog_update_symbol_fields_base.cpp b/eeschema/dialogs/dialog_update_symbol_fields_base.cpp
new file mode 100644
index 0000000000..a80d729072
--- /dev/null
+++ b/eeschema/dialogs/dialog_update_symbol_fields_base.cpp
@@ -0,0 +1,116 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO *NOT* EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#include "dialog_update_symbol_fields_base.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+DIALOG_UPDATE_SYMBOL_FIELDS_BASE::DIALOG_UPDATE_SYMBOL_FIELDS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
+{
+ this->SetSizeHints( wxDefaultSize, wxDefaultSize );
+
+ m_mainSizer = new wxBoxSizer( wxVERTICAL );
+
+ m_newIdSizer = new wxBoxSizer( wxHORIZONTAL );
+
+ wxStaticText* m_parentSymbolLabel;
+ m_parentSymbolLabel = new wxStaticText( this, wxID_ANY, _("Parent symbol:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_parentSymbolLabel->Wrap( -1 );
+ m_newIdSizer->Add( m_parentSymbolLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
+
+ m_parentSymbolReadOnly = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
+ m_parentSymbolReadOnly->Enable( false );
+
+ m_newIdSizer->Add( m_parentSymbolReadOnly, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+
+ m_mainSizer->Add( m_newIdSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
+
+ wxBoxSizer* bSizerUpdate;
+ bSizerUpdate = new wxBoxSizer( wxHORIZONTAL );
+
+ m_updateFieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Update/reset Fields") ), wxVERTICAL );
+
+ wxArrayString m_fieldsBoxChoices;
+ m_fieldsBox = new wxCheckListBox( m_updateFieldsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fieldsBoxChoices, wxLB_NEEDED_SB );
+ m_fieldsBox->SetMinSize( wxSize( -1,120 ) );
+
+ m_updateFieldsSizer->Add( m_fieldsBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+
+ wxBoxSizer* m_selBtnSizer;
+ m_selBtnSizer = new wxBoxSizer( wxHORIZONTAL );
+
+ m_selAllBtn = new wxButton( m_updateFieldsSizer->GetStaticBox(), wxID_ANY, _("Select All"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_selBtnSizer->Add( m_selAllBtn, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+
+ m_selNoneBtn = new wxButton( m_updateFieldsSizer->GetStaticBox(), wxID_ANY, _("Select None"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_selBtnSizer->Add( m_selNoneBtn, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+
+
+ m_updateFieldsSizer->Add( m_selBtnSizer, 0, wxEXPAND, 5 );
+
+
+ bSizerUpdate->Add( m_updateFieldsSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
+
+ m_updateOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Update Options") ), wxVERTICAL );
+
+ m_removeExtraBox = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Remove fields if not in parent symbol"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_removeExtraBox->SetToolTip( _("Removes fields that do not occur in the original library symbols") );
+
+ m_updateOptionsSizer->Add( m_removeExtraBox, 0, wxBOTTOM|wxRIGHT, 4 );
+
+ m_resetEmptyFields = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Reset fields if empty in parent symbol"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_updateOptionsSizer->Add( m_resetEmptyFields, 0, wxBOTTOM|wxRIGHT, 4 );
+
+
+ m_updateOptionsSizer->Add( 0, 15, 0, wxEXPAND, 5 );
+
+ m_resetFieldVisibilities = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field visibilities"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_updateOptionsSizer->Add( m_resetFieldVisibilities, 0, wxBOTTOM|wxRIGHT, 4 );
+
+ m_resetFieldEffects = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field sizes and styles"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_updateOptionsSizer->Add( m_resetFieldEffects, 0, wxBOTTOM|wxRIGHT, 4 );
+
+ m_resetFieldPositions = new wxCheckBox( m_updateOptionsSizer->GetStaticBox(), wxID_ANY, _("Update/reset field positions"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_updateOptionsSizer->Add( m_resetFieldPositions, 0, wxBOTTOM|wxRIGHT, 4 );
+
+
+ bSizerUpdate->Add( m_updateOptionsSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 );
+
+
+ m_mainSizer->Add( bSizerUpdate, 0, wxEXPAND, 5 );
+
+ m_sdbSizer = new wxStdDialogButtonSizer();
+ m_sdbSizerOK = new wxButton( this, wxID_OK );
+ m_sdbSizer->AddButton( m_sdbSizerOK );
+ m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
+ m_sdbSizer->AddButton( m_sdbSizerCancel );
+ m_sdbSizer->Realize();
+
+ m_mainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
+
+
+ this->SetSizer( m_mainSizer );
+ this->Layout();
+ m_mainSizer->Fit( this );
+
+ this->Centre( wxBOTH );
+
+ // Connect Events
+ m_selAllBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_UPDATE_SYMBOL_FIELDS_BASE::onSelectAll ), NULL, this );
+ m_selNoneBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_UPDATE_SYMBOL_FIELDS_BASE::onSelectNone ), NULL, this );
+ m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_UPDATE_SYMBOL_FIELDS_BASE::onOkButtonClicked ), NULL, this );
+}
+
+DIALOG_UPDATE_SYMBOL_FIELDS_BASE::~DIALOG_UPDATE_SYMBOL_FIELDS_BASE()
+{
+ // Disconnect Events
+ m_selAllBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_UPDATE_SYMBOL_FIELDS_BASE::onSelectAll ), NULL, this );
+ m_selNoneBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_UPDATE_SYMBOL_FIELDS_BASE::onSelectNone ), NULL, this );
+ m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_UPDATE_SYMBOL_FIELDS_BASE::onOkButtonClicked ), NULL, this );
+
+}
diff --git a/eeschema/dialogs/dialog_update_symbol_fields_base.fbp b/eeschema/dialogs/dialog_update_symbol_fields_base.fbp
new file mode 100644
index 0000000000..9ea7c236eb
--- /dev/null
+++ b/eeschema/dialogs/dialog_update_symbol_fields_base.fbp
@@ -0,0 +1,808 @@
+
+
+
+
+
diff --git a/eeschema/dialogs/dialog_update_symbol_fields_base.h b/eeschema/dialogs/dialog_update_symbol_fields_base.h
new file mode 100644
index 0000000000..007e095527
--- /dev/null
+++ b/eeschema/dialogs/dialog_update_symbol_fields_base.h
@@ -0,0 +1,71 @@
+///////////////////////////////////////////////////////////////////////////
+// C++ code generated with wxFormBuilder (version Oct 26 2018)
+// http://www.wxformbuilder.org/
+//
+// PLEASE DO *NOT* EDIT THIS FILE!
+///////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#include
+#include
+#include
+#include "dialog_shim.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+///////////////////////////////////////////////////////////////////////////
+
+
+///////////////////////////////////////////////////////////////////////////////
+/// Class DIALOG_UPDATE_SYMBOL_FIELDS_BASE
+///////////////////////////////////////////////////////////////////////////////
+class DIALOG_UPDATE_SYMBOL_FIELDS_BASE : public DIALOG_SHIM
+{
+ private:
+
+ protected:
+ wxBoxSizer* m_mainSizer;
+ wxBoxSizer* m_newIdSizer;
+ wxTextCtrl* m_parentSymbolReadOnly;
+ wxStaticBoxSizer* m_updateFieldsSizer;
+ wxCheckListBox* m_fieldsBox;
+ wxButton* m_selAllBtn;
+ wxButton* m_selNoneBtn;
+ wxStaticBoxSizer* m_updateOptionsSizer;
+ wxCheckBox* m_removeExtraBox;
+ wxCheckBox* m_resetEmptyFields;
+ wxCheckBox* m_resetFieldVisibilities;
+ wxCheckBox* m_resetFieldEffects;
+ wxCheckBox* m_resetFieldPositions;
+ wxStdDialogButtonSizer* m_sdbSizer;
+ wxButton* m_sdbSizerOK;
+ wxButton* m_sdbSizerCancel;
+
+ // Virtual event handlers, overide them in your derived class
+ virtual void onSelectAll( wxCommandEvent& event ) { event.Skip(); }
+ virtual void onSelectNone( wxCommandEvent& event ) { event.Skip(); }
+ virtual void onOkButtonClicked( wxCommandEvent& event ) { event.Skip(); }
+
+
+ public:
+
+ DIALOG_UPDATE_SYMBOL_FIELDS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Update Symbol Fields"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ ~DIALOG_UPDATE_SYMBOL_FIELDS_BASE();
+
+};
+
diff --git a/eeschema/symbol_editor/menubar_symbol_editor.cpp b/eeschema/symbol_editor/menubar_symbol_editor.cpp
index 30cbcd614b..c1b7e076e6 100644
--- a/eeschema/symbol_editor/menubar_symbol_editor.cpp
+++ b/eeschema/symbol_editor/menubar_symbol_editor.cpp
@@ -97,6 +97,7 @@ void SYMBOL_EDIT_FRAME::ReCreateMenuBar()
editMenu->AppendSeparator();
editMenu->Add( EE_ACTIONS::symbolProperties );
editMenu->Add( EE_ACTIONS::pinTable );
+ editMenu->Add( EE_ACTIONS::updateSymbolFields );
//-- View menu -----------------------------------------------
diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp
index bf041b7ef4..60b6e4b662 100644
--- a/eeschema/tools/ee_actions.cpp
+++ b/eeschema/tools/ee_actions.cpp
@@ -168,6 +168,11 @@ TOOL_ACTION EE_ACTIONS::exportSymbol( "eeschema.SymbolLibraryControl.exportSymbo
_( "Export..." ), _( "Export a symbol to a new library file" ),
export_part_xpm );
+TOOL_ACTION EE_ACTIONS::updateSymbolFields( "eeschema.SymbolLibraryControl.updateSymbolFields",
+ AS_GLOBAL, 0, "",
+ _( "Update Symbol Fields..." ), _( "Update symbol to match changes made in parent symbol" ),
+ refresh_xpm );
+
TOOL_ACTION EE_ACTIONS::addSymbolToSchematic( "eeschema.SymbolLibraryControl.addSymbolToSchematic",
AS_GLOBAL, 0, "",
_( "Add Symbol to Schematic" ), _( "Add Symbol to Schematic" ),
diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h
index 806af1851d..af27e63aa3 100644
--- a/eeschema/tools/ee_actions.h
+++ b/eeschema/tools/ee_actions.h
@@ -176,6 +176,7 @@ public:
static TOOL_ACTION pasteSymbol;
static TOOL_ACTION importSymbol;
static TOOL_ACTION exportSymbol;
+ static TOOL_ACTION updateSymbolFields;
// Hierarchy navigation
static TOOL_ACTION enterSheet;
diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp
index cfe0a22ec1..9a9ac45c20 100644
--- a/eeschema/tools/symbol_editor_edit_tool.cpp
+++ b/eeschema/tools/symbol_editor_edit_tool.cpp
@@ -37,6 +37,7 @@
#include
#include
#include
+#include
#include
#include
#include "symbol_editor_edit_tool.h"
@@ -630,6 +631,29 @@ int SYMBOL_EDITOR_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
}
+int SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields( const TOOL_EVENT& aEvent )
+{
+ LIB_PART* part = m_frame->GetCurPart();
+
+ if( !part )
+ return 0;
+
+ if( !part->IsAlias() )
+ {
+ m_frame->ShowInfoBarError( _( "Symbol is not derived from another symbol." ) );
+ }
+ else
+ {
+ DIALOG_UPDATE_SYMBOL_FIELDS dlg( m_frame, part );
+
+ if( dlg.ShowModal() == wxID_CANCEL )
+ return -1;
+ }
+
+ return 0;
+}
+
+
int SYMBOL_EDITOR_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
{
m_frame->GetSymbolFromUndoList();
@@ -824,4 +848,5 @@ void SYMBOL_EDITOR_EDIT_TOOL::setTransitions()
Go( &SYMBOL_EDITOR_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::Properties, EE_ACTIONS::symbolProperties.MakeEvent() );
Go( &SYMBOL_EDITOR_EDIT_TOOL::PinTable, EE_ACTIONS::pinTable.MakeEvent() );
+ Go( &SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields, EE_ACTIONS::updateSymbolFields.MakeEvent() );
}
diff --git a/eeschema/tools/symbol_editor_edit_tool.h b/eeschema/tools/symbol_editor_edit_tool.h
index d735940006..ac2973824a 100644
--- a/eeschema/tools/symbol_editor_edit_tool.h
+++ b/eeschema/tools/symbol_editor_edit_tool.h
@@ -47,6 +47,7 @@ public:
int Properties( const TOOL_EVENT& aEvent );
int PinTable( const TOOL_EVENT& aEvent );
+ int UpdateSymbolFields( const TOOL_EVENT& aEvent );
int Undo( const TOOL_EVENT& aEvent );
int Redo( const TOOL_EVENT& aEvent );