When pasting a sheet link to existing copy if it already appears in the hierarchy.

Fixes: lp:1830633
* https://bugs.launchpad.net/kicad/+bug/1830633
This commit is contained in:
Jeff Young 2019-06-12 14:23:53 +01:00
parent 54b22b1851
commit 4043a15482
1 changed files with 7 additions and 2 deletions

View File

@ -1005,8 +1005,13 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
}
else if( item->Type() == SCH_SHEET_T )
{
SCH_SHEET* sheet = (SCH_SHEET*) item;
m_frame->LoadSheetFromFile( sheet, g_CurrentSheet, sheet->GetFileName() );
SCH_SHEET* sheet = (SCH_SHEET*) item;
SCH_SCREEN* existingScreen = nullptr;
if( g_RootSheet->SearchHierarchy( sheet->GetFileName(), &existingScreen ) )
sheet->SetScreen( existingScreen );
else
m_frame->LoadSheetFromFile( sheet, g_CurrentSheet, sheet->GetFileName() );
}
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED );