Don't allow dbl-click to leak through to other tools.

This only applies if the tool doesn't handle properties (which also
handles double-click events).

Fixes https://gitlab.com/kicad/code/kicad/issues/6735
This commit is contained in:
Jeff Young 2020-12-14 22:03:17 +00:00
parent 07bb2729f8
commit 22a6b36257
6 changed files with 20 additions and 13 deletions

View File

@ -177,7 +177,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
break; break;
} }
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
if( !component ) if( !component )
{ {
@ -397,7 +397,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
break; break;
} }
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
if( !image ) if( !image )
{ {
@ -901,7 +901,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
break; break;
} }
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
// First click creates... // First click creates...
if( !item ) if( !item )
@ -1109,7 +1109,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
break; break;
} }
} }
else if( evt->IsClick( BUT_LEFT ) && !sheet ) else if( !sheet && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) ) )
{ {
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
@ -1130,6 +1130,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
m_view->AddToPreview( sheet->Clone() ); m_view->AddToPreview( sheet->Clone() );
} }
else if( sheet && ( evt->IsClick( BUT_LEFT ) else if( sheet && ( evt->IsClick( BUT_LEFT )
|| evt->IsDblClick( BUT_LEFT )
|| evt->IsAction( &EE_ACTIONS::finishSheet ) ) ) || evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
{ {
m_view->ClearPreview(); m_view->ClearPreview();

View File

@ -440,7 +440,9 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Handle drop // Handle drop
// //
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) else if( evt->IsMouseUp( BUT_LEFT )
|| evt->IsClick( BUT_LEFT )
|| evt->IsDblClick( BUT_LEFT ) )
{ {
break; // Finish break; // Finish
} }

View File

@ -151,7 +151,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
break; break;
} }
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
LIB_PART* part = m_frame->GetCurPart(); LIB_PART* part = m_frame->GetCurPart();
@ -456,7 +456,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
m_frame->PopTool( tool ); m_frame->PopTool( tool );
break; break;
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
LIB_PART* part = m_frame->GetCurPart(); LIB_PART* part = m_frame->GetCurPart();

View File

@ -103,7 +103,9 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
if( evt->IsAction( &EE_ACTIONS::move ) || evt->IsMotion() || evt->IsDrag( BUT_LEFT ) if( evt->IsAction( &EE_ACTIONS::move )
|| evt->IsMotion()
|| evt->IsDrag( BUT_LEFT )
|| evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsAction( &ACTIONS::refreshPreview )
|| evt->IsAction( &EE_ACTIONS::symbolMoveActivate ) ) || evt->IsAction( &EE_ACTIONS::symbolMoveActivate ) )
{ {
@ -254,7 +256,9 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Handle drop // Handle drop
// //
else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) else if( evt->IsMouseUp( BUT_LEFT )
|| evt->IsClick( BUT_LEFT )
|| evt->IsDblClick( BUT_LEFT ) )
{ {
if( selection.GetSize() == 1 && selection.Front()->Type() == LIB_PIN_T ) if( selection.GetSize() == 1 && selection.Front()->Type() == LIB_PIN_T )
{ {

View File

@ -1127,7 +1127,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
{ {
m_menu.ShowContextMenu( selection() ); m_menu.ShowContextMenu( selection() );
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
// Place the imported drawings // Place the imported drawings
for( BOARD_ITEM* item : newItems ) for( BOARD_ITEM* item : newItems )
@ -1189,7 +1189,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
LSET::AllLayersMask() ); LSET::AllLayersMask() );
m_controls->ForceCursorPosition( true, cursorPos ); m_controls->ForceCursorPosition( true, cursorPos );
if( evt->IsClick( BUT_LEFT ) ) if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
FOOTPRINT* footprint = (FOOTPRINT*) m_frame->GetModel(); FOOTPRINT* footprint = (FOOTPRINT*) m_frame->GetModel();
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
@ -2109,7 +2109,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
view->Query( bbox, items ); view->Query( bbox, items );
for( auto it : items ) for( std::pair<KIGFX::VIEW_ITEM*, int> it : items )
{ {
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it.first ); BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it.first );

View File

@ -149,7 +149,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
break; break;
} }
} }
else if( evt->IsClick( BUT_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{ {
if( !newItem ) if( !newItem )
{ {