Ignore duplicate/repeat when drawing an existing item.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16885

(cherry picked from commit 3caede3799)
This commit is contained in:
Jeff Young 2024-02-15 12:36:36 +00:00 committed by Roberto Fernandez Bautista
parent 9ff66d0e71
commit f161a1eaac
1 changed files with 62 additions and 1 deletions

View File

@ -466,7 +466,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
}
}
}
else if( evt->IsAction( &ACTIONS::duplicate ) )
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
{
if( symbol )
{
@ -724,6 +725,21 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
{
if( image )
{
// This doesn't really make sense; we'll just end up dragging a stack of
// objects so we ignore the duplicate and just carry on.
wxBell();
continue;
}
// Exit. The duplicate will run in its own loop.
m_frame->PopTool( aEvent );
break;
}
else if( image && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
image->SetPosition( cursorPos );
@ -1686,6 +1702,21 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
item = nullptr;
}
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
{
if( item )
{
// This doesn't really make sense; we'll just end up dragging a stack of
// objects so we ignore the duplicate and just carry on.
wxBell();
continue;
}
// Exit. The duplicate will run in its own loop.
m_frame->PopTool( aEvent );
break;
}
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
item->SetPosition( cursorPos );
@ -1916,6 +1947,21 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
m_toolMgr->PostAction( ACTIONS::activatePointEditor );
}
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
{
if( item )
{
// This doesn't really make sense; we'll just end up dragging a stack of
// objects so we ignore the duplicate and just carry on.
wxBell();
continue;
}
// Exit. The duplicate will run in its own loop.
m_frame->PopTool( aEvent );
break;
}
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
item->CalcEdit( cursorPos );
@ -2151,6 +2197,21 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet = nullptr;
}
else if( evt->IsAction( &ACTIONS::duplicate )
|| evt->IsAction( &EE_ACTIONS::repeatDrawItem ) )
{
if( sheet )
{
// This doesn't really make sense; we'll just end up dragging a stack of
// objects so we ignore the duplicate and just carry on.
wxBell();
continue;
}
// Exit. The duplicate will run in its own loop.
m_frame->PopTool( aEvent );
break;
}
else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
{
sizeSheet( sheet, cursorPos );