Keep symbol synced with edit tool

Undo/Redo can change the symbol referenced by the symbol drawing tool.
This updates the current symbol before important steps to keep the
system synced

Fixes https://gitlab.com/kicad/code/kicad/issues/10125

(cherry picked from commit b8a7a66a0a)
This commit is contained in:
Seth Hillbrand 2022-01-05 16:50:24 -08:00
parent 5a8b0921eb
commit 88a8ad2ca1
2 changed files with 11 additions and 0 deletions

View File

@ -385,6 +385,8 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxStr
RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurSymbol()->HasConversion() );
ClearUndoRedoList();
// Display the document information based on the entry selected just in
// case the entry is an alias.
UpdateMsgPanel();

View File

@ -343,6 +343,9 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_LEFT ) && !item )
{
// Update in case the symbol was changed while the tool was running
symbol = m_frame->GetCurSymbol();
if( !symbol )
continue;
@ -365,6 +368,12 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
else if( item && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
{
if( symbol != m_frame->GetCurSymbol() )
{
symbol = m_frame->GetCurSymbol();
item->SetParent( symbol );
}
if( evt->IsDblClick( BUT_LEFT ) || evt->IsAction( &EE_ACTIONS::finishDrawing )
|| !item->ContinueEdit( wxPoint( cursorPos.x, -cursorPos.y ) ) )
{