From e8079bf655d393b2d80f6042812b7ab389efc180 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 16 Jul 2020 01:08:31 +0100 Subject: [PATCH] Make sure UI gets adjusted for Symbol property changes. For instance, if the number of units is changed from 1 to not-1 or vice versa then we need to rebuild the units selector. Fixes https://gitlab.com/kicad/code/kicad/issues/4622 --- eeschema/dialogs/dialog_edit_component_in_lib.cpp | 5 +---- eeschema/libedit/libedit.cpp | 8 +++++--- eeschema/tools/lib_edit_tool.cpp | 11 ++--------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index a1de975fcf..85326c7e8f 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -341,10 +341,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow() m_libEntry->SetFootprintFilters( m_FootprintFilterListBox->GetStrings() ); - if( oldName != newName ) - m_Parent->UpdateAfterSymbolProperties( &oldName ); - else - m_Parent->RebuildView(); + m_Parent->UpdateAfterSymbolProperties( &oldName ); // It's possible that the symbol being edited has no pins, in which case there may be no // alternate body style objects causing #LIB_PART::HasCoversion() to always return false. diff --git a/eeschema/libedit/libedit.cpp b/eeschema/libedit/libedit.cpp index 6cf487dfca..aee1505f05 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/libedit/libedit.cpp @@ -526,11 +526,13 @@ void LIB_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName ) m_my_part->SetName( *aOldName ); } else + { m_libMgr->UpdatePartAfterRename( m_my_part, *aOldName, lib ); - } + } - // Reselect the renamed part - m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, m_my_part->GetName() ) ); + // Reselect the renamed part + m_treePane->GetLibTree()->SelectLibId( LIB_ID( lib, m_my_part->GetName() ) ); + } RebuildSymbolUnitsList(); SetShowDeMorgan( GetCurPart()->Flatten()->HasConversion() ); diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index 61e158f3c2..7abb0896d5 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -503,16 +503,9 @@ void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField ) dlg.UpdateField( aField ); if( renamed ) - { parent->SetName( newFieldValue ); - m_frame->UpdateAfterSymbolProperties( &oldFieldValue ); - } - else - { - updateView( aField ); - m_frame->GetCanvas()->Refresh(); - m_frame->OnModify( ); - } + + m_frame->UpdateAfterSymbolProperties( &oldFieldValue ); }