Allows new items SCH_NO_CONNECT_T and SCH_BUS_WIRE_ENTRY_T to be repeated.

Fixes #15668
https://gitlab.com/kicad/code/kicad/-/issues/15668
This commit is contained in:
jean-pierre charras 2023-09-17 09:37:34 +02:00
parent 467c672bcd
commit 79590c6372
1 changed files with 6 additions and 0 deletions

View File

@ -731,6 +731,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
bool loggedInfoBarError = false;
wxString description;
SCH_SCREEN* screen = m_frame->GetScreen();
bool allowRepeat = false; // Set to true to allow new item repetition
if( m_inSingleClickPlace )
return 0;
@ -757,6 +758,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
previewItem = new SCH_NO_CONNECT( cursorPos );
previewItem->SetParent( screen );
description = _( "Add No Connect Flag" );
allowRepeat = true;
break;
case SCH_JUNCTION_T:
@ -769,6 +771,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
previewItem = new SCH_BUS_WIRE_ENTRY( cursorPos );
previewItem->SetParent( screen );
description = _( "Add Wire to Bus Entry" );
allowRepeat = true;
break;
default:
@ -859,6 +862,9 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
newItem->SetFlags( IS_NEW );
m_frame->AddToScreen( newItem, screen );
if( allowRepeat )
m_frame->SaveCopyForRepeatItem( newItem );
SCH_COMMIT commit( m_toolMgr );
commit.Added( newItem, screen );