SCH_EDITOR_CONTROL(paste): fix wrong cut behaviour

There was a missing behaviour when explicit removed annotation via specialpaste was requested. Add there a variable to compare the paste options.
This commit is contained in:
Andrej Valek 2025-04-15 16:38:48 +00:00 committed by Seth Hillbrand
parent 6d2b728fb1
commit 9364bcdc9e

View File

@ -1726,13 +1726,19 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
int annotateStartNum = m_frame->Schematic().Settings().m_AnnotateStartNum;
PASTE_MODE pasteMode = annotate.automatic ? PASTE_MODE::RESPECT_OPTIONS : PASTE_MODE::REMOVE_ANNOTATIONS;
bool forceRemoveAnnotations = false;
if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )
{
DIALOG_PASTE_SPECIAL dlg( m_frame, &pasteMode );
PASTE_MODE pasteModeSpecial = pasteMode;
DIALOG_PASTE_SPECIAL dlg( m_frame, &pasteModeSpecial );
if( dlg.ShowModal() == wxID_CANCEL )
return 0;
// We have to distinguish if removing was explicit
forceRemoveAnnotations = ( pasteModeSpecial == PASTE_MODE::REMOVE_ANNOTATIONS );
pasteMode = pasteModeSpecial;
}
bool forceKeepAnnotations = pasteMode != PASTE_MODE::REMOVE_ANNOTATIONS;
@ -1879,7 +1885,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
{
if( !existingRefsSet.contains( instance.m_Reference ) )
{
forceKeepAnnotations = ( pasteMode != PASTE_MODE::REMOVE_ANNOTATIONS );
forceKeepAnnotations = !forceRemoveAnnotations;
break;
}
}
@ -1914,16 +1920,16 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
const_cast<KIID&>( pin->m_Uuid ) = KIID();
pin->SetConnectivityDirty();
}
}
for( SCH_SHEET_PATH& sheetPath : sheetPathsForScreen )
{
// Ignore symbols from a non-existant library.
if( libSymbol )
for( SCH_SHEET_PATH& sheetPath : sheetPathsForScreen )
{
SCH_REFERENCE schReference( symbol, sheetPath );
schReference.SetSheetNumber( sheetPath.GetVirtualPageNumber() );
pastedSymbols[sheetPath].AddItem( schReference );
// Ignore symbols from a non-existant library.
if( libSymbol )
{
SCH_REFERENCE schReference( symbol, sheetPath );
schReference.SetSheetNumber( sheetPath.GetVirtualPageNumber() );
pastedSymbols[sheetPath].AddItem( schReference );
}
}
}
}