Resync lib_tree after editing aliases.

This also fixes an unrelated bug where the current part highlighting
would get lost after a rename.

Fixes: lp:1817639
* https://bugs.launchpad.net/kicad/+bug/1817639
This commit is contained in:
Jeff Young 2019-02-27 15:34:51 +00:00
parent c77031842e
commit f494a24404
3 changed files with 14 additions and 3 deletions

View File

@ -356,9 +356,6 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
m_libEntry->GetFootprints().Clear();
m_libEntry->GetFootprints() = m_FootprintFilterListBox->GetStrings();
m_Parent->RebuildView();
m_Parent->OnModify();
return true;
}

View File

@ -1032,6 +1032,7 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )
{
bool partLocked = GetCurPart()->UnitsLocked();
wxString oldName = GetCurPart()->GetName();
wxArrayString oldAliases = GetCurPart()->GetAliasNames( false );
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor() );
@ -1062,8 +1063,13 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )
if( oldName != GetCurPart()->GetName() )
m_libMgr->UpdatePartAfterRename( GetCurPart(), oldName, GetCurLib() );
else
{
m_libMgr->UpdatePart( GetCurPart(), GetCurLib() );
if( oldAliases != GetCurPart()->GetAliasNames( false ) )
SyncLibraries( false );
}
UpdatePartSelectList();
updateTitle();
DisplayCmpDoc();
@ -1638,6 +1644,13 @@ void LIB_EDIT_FRAME::SyncLibraries( bool aShowProgress )
if( found )
m_treePane->GetLibTree()->SelectLibId( selected );
}
// If no selection, see if there's a current part to centre
if( !selected.IsValid() && GetCurPart() )
{
LIB_ID current( GetCurLib(), GetCurPart()->GetName() );
m_treePane->GetLibTree()->CenterLibId( current );
}
}
}

View File

@ -446,6 +446,7 @@ bool LIB_MANAGER::UpdatePartAfterRename( LIB_PART* aPart, const wxString& oldAli
wxCHECK( partBuf, false );
partBuf->SetOriginal( original.release() ); // part buffer takes ownership of pointer
SetCurrentPart( aPart->GetName() );
m_frame.SyncLibraries( false );
return true;