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
This commit is contained in:
Seth Hillbrand 2022-01-05 16:50:24 -08:00
parent 55087a9e82
commit b8a7a66a0a
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

@ -339,6 +339,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;
@ -361,6 +364,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 ) ) )
{