Handle <delete> in move and drawing tools.

Fixes https://gitlab.com/kicad/code/kicad/issues/7924
This commit is contained in:
Jeff Young 2021-03-15 14:23:17 +00:00
parent afab60ae06
commit 573dd36515
3 changed files with 28 additions and 3 deletions

View File

@ -311,6 +311,11 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
m_view->ClearPreview();
m_view->AddToPreview( component->Clone() );
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
{
if( component )
cleanup();
}
else
{
evt->SetPassEvent();
@ -498,6 +503,11 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
m_view->AddToPreview( image->Clone() );
m_view->RecacheAllItems(); // Bitmaps are cached in Opengl
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
{
if( image )
cleanup();
}
else
{
evt->SetPassEvent();
@ -1127,6 +1137,11 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
m_view->ClearPreview();
m_view->AddToPreview( item->Clone() );
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
{
if( item )
cleanup();
}
else
{
evt->SetPassEvent();

View File

@ -134,7 +134,7 @@ private:
Enable( ID_POPUP_SCH_UNFOLD_BUS, false );
}
for( const auto& member : connection->Members() )
for( const std::shared_ptr<SCH_CONNECTION>& member : connection->Members() )
{
int id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
wxString name = member->FullLocalName();
@ -145,7 +145,7 @@ private:
submenu->SetTool( m_tool );
AppendSubMenu( submenu, SCH_CONNECTION::PrintBusForUI( name ), name );
for( const auto& sub_member : member->Members() )
for( const std::shared_ptr<SCH_CONNECTION>& sub_member : member->Members() )
{
id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
name = sub_member->FullLocalName();
@ -562,7 +562,9 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
if( evt->IsCancelInteractive() )
{
if( segment || m_busUnfold.in_progress )
{
cleanup();
}
else
{
m_frame->PopTool( aTool );
@ -751,6 +753,11 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
segment = doUnfoldBus( net, contextMenuPos );
}
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
{
if( segment || m_busUnfold.in_progress )
cleanup();
}
else
{
evt->SetPassEvent();

View File

@ -378,7 +378,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
}
else if( evt->IsAction( &ACTIONS::doDelete ) )
{
// Exit on a remove operation; there is no further processing for removed items.
evt->SetPassEvent();
// Exit on a delete; there will no longer be anything to drag.
break;
}
else if( evt->IsAction( &ACTIONS::duplicate ) )
@ -428,7 +429,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
break; // Finish
}
else
{
evt->SetPassEvent();
}
controls->SetAutoPan( m_moveInProgress );