pcbnew: Ensure cursor remains set during tool activity

Mouse capture end is called by some actions such as save board.  This
resets the cursor image but doesn't change the current tool.  Resetting
the cursor image during action prevents this.

(cherry picked from commit 35e87128f5)

Fixes: lp:1831888
* https://bugs.launchpad.net/kicad/+bug/1831888
This commit is contained in:
Seth Hillbrand 2019-06-08 10:23:38 -07:00
parent 23f9d4642d
commit 81c5ba257b
3 changed files with 24 additions and 0 deletions

View File

@ -243,6 +243,9 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
while( drawSegment( S_SEGMENT, line, startingPoint ) )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
if( line )
{
if( m_editModules )
@ -282,6 +285,9 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
while( drawSegment( S_CIRCLE, circle ) )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
if( circle )
{
if( m_editModules )
@ -316,6 +322,9 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
while( drawArc( arc ) )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
if( arc )
{
if( m_editModules )
@ -359,6 +368,8 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
VECTOR2I cursorPos = m_controls->GetCursorPosition();
if( reselect && text )
@ -552,6 +563,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
m_controls->SetSnapping( !evt->Modifier( MD_ALT ) );
@ -918,6 +931,9 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
while( OPT_TOOL_EVENT evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
if( evt->IsClick( BUT_LEFT ) )
{
MODULE* module = (MODULE*) m_frame->GetModel();
@ -1395,6 +1411,8 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode )
while( OPT_TOOL_EVENT evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
LSET layers( m_frame->GetActiveLayer() );
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );

View File

@ -1203,6 +1203,8 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
while( auto evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
frame()->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
controls.SetSnapping( !evt->Modifier( MD_ALT ) );

View File

@ -720,6 +720,8 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
if( reselect && module )
@ -895,6 +897,8 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
// This can be reset by some actions (e.g. Save Board), so ensure it stays set.
m_frame->GetGalCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
cursorPos = controls->GetCursorPosition( !evt->Modifier( MD_ALT ) );
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )