Perform better cleanup after cancelling text placement.

Fixes: lp:1838452
* https://bugs.launchpad.net/kicad/+bug/1838452
This commit is contained in:
Jeff Young 2019-07-31 23:16:34 -06:00
parent 161dc9ce7e
commit d482a8805c
1 changed files with 12 additions and 17 deletions

View File

@ -379,6 +379,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_controls->SetAutoPan( false ); m_controls->SetAutoPan( false );
m_controls->CaptureCursor( false ); m_controls->CaptureCursor( false );
m_controls->ForceCursorPosition( false );
m_controls->ShowCursor( true ); m_controls->ShowCursor( true );
} }
else else
@ -444,24 +445,17 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
} ); } );
if( textPcb->GetText().IsEmpty() ) if( textPcb->GetText().IsEmpty() )
{
m_controls->ForceCursorPosition( false );
delete textPcb; delete textPcb;
}
else else
text = textPcb; text = textPcb;
} }
if( text == NULL ) if( text )
continue; {
m_controls->WarpCursor( text->GetPosition(), true ); m_controls->WarpCursor( text->GetPosition(), true );
m_controls->ForceCursorPosition( false );
m_controls->CaptureCursor( true );
m_controls->SetAutoPan( true );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, text ); m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, text );
} }
}
else else
{ {
text->ClearFlags(); text->ClearFlags();
@ -470,12 +464,13 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
commit.Add( text ); commit.Add( text );
commit.Push( _( "Place a text" ) ); commit.Push( _( "Place a text" ) );
m_controls->CaptureCursor( false ); text = nullptr;
m_controls->SetAutoPan( false );
m_controls->ShowCursor( true );
text = NULL;
} }
m_controls->ForceCursorPosition( false );
m_controls->ShowCursor( true );
m_controls->CaptureCursor( text != nullptr );
m_controls->SetAutoPan( text != nullptr );
} }
else if( text && evt->IsMotion() ) else if( text && evt->IsMotion() )
{ {