Go back to arrow cursor on a cancel (or finish).
Fixes https://gitlab.com/kicad/code/kicad/issues/6421
This commit is contained in:
parent
c2ba68cdfa
commit
9e9946628a
|
@ -63,19 +63,22 @@ int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
setCursor();
|
setCursor();
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
else if( evt->IsDrag( BUT_LEFT ) || evt->IsDrag( BUT_RIGHT ) )
|
else if( evt->IsDrag( BUT_LEFT ) || evt->IsDrag( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
if( selectRegion() )
|
if( selectRegion() )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Exit zoom tool
|
// Exit zoom tool
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,8 +95,10 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( item )
|
if( item )
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
|
||||||
|
else if( isText )
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT );
|
||||||
else
|
else
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( isText ? KICURSOR::TEXT : KICURSOR::PENCIL );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set initial cursor
|
// Set initial cursor
|
||||||
|
@ -109,7 +111,9 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
delete item;
|
delete item;
|
||||||
|
@ -142,7 +146,6 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
LIB_PART* part = m_frame->GetCurPart();
|
LIB_PART* part = m_frame->GetCurPart();
|
||||||
|
@ -201,7 +204,6 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
getViewControls()->SetCursorPosition( cursorPos, false );
|
getViewControls()->SetCursorPosition( cursorPos, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... and second click places:
|
// ... and second click places:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -235,22 +237,23 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||||
{
|
{
|
||||||
static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
|
static_cast<LIB_ITEM*>( item )->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
m_view->AddToPreview( item->Clone() );
|
m_view->AddToPreview( item->Clone() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is an item to be placed
|
// Enable autopanning and cursor capture only when there is an item to be placed
|
||||||
getViewControls()->SetAutoPan( item != nullptr );
|
getViewControls()->SetAutoPan( item != nullptr );
|
||||||
getViewControls()->CaptureCursor( item != nullptr );
|
getViewControls()->CaptureCursor( item != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +297,9 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
delete item;
|
delete item;
|
||||||
|
@ -311,7 +316,6 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsActivate() )
|
else if( evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( item )
|
if( item )
|
||||||
|
@ -332,7 +336,6 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) && !item )
|
else if( evt->IsClick( BUT_LEFT ) && !item )
|
||||||
{
|
{
|
||||||
if( !part )
|
if( !part )
|
||||||
|
@ -364,7 +367,6 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
m_selectionTool->AddItemToSel( item );
|
m_selectionTool->AddItemToSel( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( item && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT )
|
else if( item && ( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT )
|
||||||
|| evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
|
|| evt->IsAction( &EE_ACTIONS::finishDrawing ) ) )
|
||||||
{
|
{
|
||||||
|
@ -384,19 +386,16 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->RunAction( ACTIONS::activatePointEditor );
|
m_toolMgr->RunAction( ACTIONS::activatePointEditor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||||
{
|
{
|
||||||
item->CalcEdit( wxPoint( cursorPos.x, -cursorPos.y) );
|
item->CalcEdit( wxPoint( cursorPos.x, -cursorPos.y) );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
m_view->AddToPreview( item->Clone() );
|
m_view->AddToPreview( item->Clone() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsDblClick( BUT_LEFT ) && !item )
|
else if( evt->IsDblClick( BUT_LEFT ) && !item )
|
||||||
{
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::properties, true );
|
m_toolMgr->RunAction( EE_ACTIONS::properties, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
// Warp after context menu only if dragging...
|
// Warp after context menu only if dragging...
|
||||||
|
@ -405,15 +404,17 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is a shape being drawn
|
// Enable autopanning and cursor capture only when there is a shape being drawn
|
||||||
getViewControls()->SetAutoPan( item != nullptr );
|
getViewControls()->SetAutoPan( item != nullptr );
|
||||||
getViewControls()->CaptureCursor( item != nullptr );
|
getViewControls()->CaptureCursor( item != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,6 +479,7 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,14 +84,18 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
std::vector<PICKED_SYMBOL>* historyList = nullptr;
|
std::vector<PICKED_SYMBOL>* historyList = nullptr;
|
||||||
|
|
||||||
if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
|
if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
|
||||||
|
{
|
||||||
historyList = &m_symbolHistoryList;
|
historyList = &m_symbolHistoryList;
|
||||||
|
}
|
||||||
else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
|
else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
|
||||||
{
|
{
|
||||||
historyList = &m_powerHistoryList;
|
historyList = &m_powerHistoryList;
|
||||||
filter.FilterPowerParts( true );
|
filter.FilterPowerParts( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
wxFAIL_MSG( "PlaceCompontent(): unexpected request" );
|
wxFAIL_MSG( "PlaceCompontent(): unexpected request" );
|
||||||
|
}
|
||||||
|
|
||||||
getViewControls()->ShowCursor( true );
|
getViewControls()->ShowCursor( true );
|
||||||
|
|
||||||
|
@ -115,7 +119,9 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->RunAction( ACTIONS::refreshPreview );
|
m_toolMgr->RunAction( ACTIONS::refreshPreview );
|
||||||
}
|
}
|
||||||
else if( aEvent.HasPosition() )
|
else if( aEvent.HasPosition() )
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::cursorClick );
|
m_toolMgr->RunAction( EE_ACTIONS::cursorClick );
|
||||||
|
}
|
||||||
|
|
||||||
auto setCursor =
|
auto setCursor =
|
||||||
[&]()
|
[&]()
|
||||||
|
@ -132,7 +138,9 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
setCursor();
|
setCursor();
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
delete component;
|
delete component;
|
||||||
|
@ -142,7 +150,9 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
if( component )
|
if( component )
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
|
@ -184,8 +194,8 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
if( !part )
|
if( !part )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
component = new SCH_COMPONENT(
|
component = new SCH_COMPONENT( *part, &m_frame->GetCurrentSheet(), sel,
|
||||||
*part, &m_frame->GetCurrentSheet(), sel, (wxPoint) cursorPos );
|
(wxPoint) cursorPos );
|
||||||
component->SetParent( m_frame->GetCurrentSheet().LastScreen() );
|
component->SetParent( m_frame->GetCurrentSheet().LastScreen() );
|
||||||
component->SetFlags( IS_NEW | IS_MOVED );
|
component->SetFlags( IS_NEW | IS_MOVED );
|
||||||
|
|
||||||
|
@ -221,9 +231,13 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units
|
if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units
|
||||||
&& component->GetUnit() < component->GetUnitCount() )
|
&& component->GetUnit() < component->GetUnitCount() )
|
||||||
|
{
|
||||||
new_unit++;
|
new_unit++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
new_unit = 1;
|
new_unit = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// We are either stepping to the next unit or next component
|
// We are either stepping to the next unit or next component
|
||||||
if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
|
if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
|
||||||
|
@ -286,6 +300,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||||
getViewControls()->CaptureCursor( component != nullptr );
|
getViewControls()->CaptureCursor( component != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +350,9 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||||
setCursor();
|
setCursor();
|
||||||
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
delete image;
|
delete image;
|
||||||
|
@ -345,7 +362,9 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
if( image )
|
if( image )
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
|
@ -452,6 +471,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||||
getViewControls()->CaptureCursor( image != nullptr );
|
getViewControls()->CaptureCursor( image != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,6 +681,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||||
delete previewItem;
|
delete previewItem;
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +846,9 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
delete item;
|
delete item;
|
||||||
|
@ -835,7 +858,9 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
if( item )
|
if( item )
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
|
@ -973,8 +998,10 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
m_view->AddToPreview( item->Clone() );
|
m_view->AddToPreview( item->Clone() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
item = nullptr;
|
item = nullptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
else if( item && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||||
{
|
{
|
||||||
static_cast<SCH_ITEM*>( item )->SetPosition( (wxPoint) cursorPos );
|
static_cast<SCH_ITEM*>( item )->SetPosition( (wxPoint) cursorPos );
|
||||||
|
@ -982,13 +1009,16 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||||
m_view->AddToPreview( item->Clone() );
|
m_view->AddToPreview( item->Clone() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is a footprint to be placed
|
// Enable autopanning and cursor capture only when there is a footprint to be placed
|
||||||
getViewControls()->SetAutoPan( item != nullptr );
|
getViewControls()->SetAutoPan( item != nullptr );
|
||||||
getViewControls()->CaptureCursor( item != nullptr );
|
getViewControls()->CaptureCursor( item != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,7 +1054,9 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
delete sheet;
|
delete sheet;
|
||||||
|
@ -1034,7 +1066,9 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
if( sheet )
|
if( sheet )
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
|
@ -1061,7 +1095,6 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) && !sheet )
|
else if( evt->IsClick( BUT_LEFT ) && !sheet )
|
||||||
{
|
{
|
||||||
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
|
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
|
||||||
|
@ -1082,7 +1115,6 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
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->IsAction( &EE_ACTIONS::finishSheet ) ) )
|
|| evt->IsAction( &EE_ACTIONS::finishSheet ) ) )
|
||||||
{
|
{
|
||||||
|
@ -1106,14 +1138,12 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
sheet = nullptr;
|
sheet = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
else if( sheet && ( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() ) )
|
||||||
{
|
{
|
||||||
sizeSheet( sheet, cursorPos );
|
sizeSheet( sheet, cursorPos );
|
||||||
m_view->ClearPreview();
|
m_view->ClearPreview();
|
||||||
m_view->AddToPreview( sheet->Clone() );
|
m_view->AddToPreview( sheet->Clone() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
// Warp after context menu only if dragging...
|
// Warp after context menu only if dragging...
|
||||||
|
@ -1123,13 +1153,16 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is a sheet to be placed
|
// Enable autopanning and cursor capture only when there is a sheet to be placed
|
||||||
getViewControls()->SetAutoPan( sheet != nullptr );
|
getViewControls()->SetAutoPan( sheet != nullptr );
|
||||||
getViewControls()->CaptureCursor( sheet != nullptr );
|
getViewControls()->CaptureCursor( sheet != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -469,7 +469,6 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
|
|
||||||
controls->ShowCursor( true );
|
controls->ShowCursor( true );
|
||||||
|
|
||||||
|
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
// Add the new label to the selection so the rotate command operates on it
|
// Add the new label to the selection so the rotate command operates on it
|
||||||
|
@ -508,10 +507,9 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
|
|
||||||
bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only;
|
bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
auto cleanup =
|
||||||
// Handle cancel:
|
[&] ()
|
||||||
//
|
{
|
||||||
auto cleanup = [&] () {
|
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||||
|
|
||||||
for( auto wire : m_wires )
|
for( auto wire : m_wires )
|
||||||
|
@ -537,6 +535,9 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
m_view->ShowPreview( false );
|
m_view->ShowPreview( false );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------
|
||||||
|
// Handle cancel:
|
||||||
|
//
|
||||||
if( evt->IsCancelInteractive() )
|
if( evt->IsCancelInteractive() )
|
||||||
{
|
{
|
||||||
if( segment || m_busUnfold.in_progress )
|
if( segment || m_busUnfold.in_progress )
|
||||||
|
@ -730,13 +731,16 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is a segment to be placed
|
// Enable autopanning and cursor capture only when there is a segment to be placed
|
||||||
controls->SetAutoPan( segment != nullptr );
|
controls->SetAutoPan( segment != nullptr );
|
||||||
controls->CaptureCursor( segment != nullptr );
|
controls->CaptureCursor( segment != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
controls->ForceCursorPosition( false );
|
controls->ForceCursorPosition( false );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,9 +191,9 @@ int GERBVIEW_INSPECTION_TOOL::ShowSource( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
auto& view = *getView();
|
KIGFX::VIEW& view = *getView();
|
||||||
auto& controls = *getViewControls();
|
KIGFX::VIEW_CONTROLS& controls = *getViewControls();
|
||||||
auto previous_settings = controls.GetSettings();
|
KIGFX::VC_SETTINGS previous_settings = controls.GetSettings();
|
||||||
|
|
||||||
std::string tool = aEvent.GetCommandStr().get();
|
std::string tool = aEvent.GetCommandStr().get();
|
||||||
m_frame->PushTool( tool );
|
m_frame->PushTool( tool );
|
||||||
|
@ -312,7 +312,9 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
view.SetVisible( &ruler, false );
|
view.SetVisible( &ruler, false );
|
||||||
view.Remove( &ruler );
|
view.Remove( &ruler );
|
||||||
|
|
||||||
controls.ApplySettings( previous_settings );
|
controls.ApplySettings( previous_settings );
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,13 +195,16 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||||
getView()->Update( item );
|
getView()->Update( item );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is an item to be placed
|
// Enable autopanning and cursor capture only when there is an item to be placed
|
||||||
getViewControls()->SetAutoPan( item != nullptr );
|
getViewControls()->SetAutoPan( item != nullptr );
|
||||||
getViewControls()->CaptureCursor( item != nullptr );
|
getViewControls()->CaptureCursor( item != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +264,6 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
if( evt->IsActivate() && !evt->IsPointEditor() && !evt->IsMoveTool() )
|
if( evt->IsActivate() && !evt->IsPointEditor() && !evt->IsMoveTool() )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
if( !item ) // start drawing
|
if( !item ) // start drawing
|
||||||
|
@ -285,7 +287,6 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
m_frame->OnModify();
|
m_frame->OnModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
|
else if( evt->IsAction( &ACTIONS::refreshPreview ) || evt->IsMotion() )
|
||||||
{
|
{
|
||||||
if( item )
|
if( item )
|
||||||
|
@ -295,7 +296,6 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
getView()->Update( item );
|
getView()->Update( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
// Warp after context menu only if dragging...
|
// Warp after context menu only if dragging...
|
||||||
|
@ -304,15 +304,17 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is a shape being drawn
|
// Enable autopanning and cursor capture only when there is a shape being drawn
|
||||||
getViewControls()->SetAutoPan( item != nullptr );
|
getViewControls()->SetAutoPan( item != nullptr );
|
||||||
getViewControls()->CaptureCursor( item != nullptr );
|
getViewControls()->CaptureCursor( item != nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,9 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
setCursor();
|
setCursor();
|
||||||
VECTOR2I cursorPos = controls.GetCursorPosition();
|
VECTOR2I cursorPos = controls.GetCursorPosition();
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
originSet = false;
|
originSet = false;
|
||||||
controls.CaptureCursor( false );
|
controls.CaptureCursor( false );
|
||||||
controls.SetAutoPan( false );
|
controls.SetAutoPan( false );
|
||||||
|
@ -167,7 +169,6 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsActivate() )
|
else if( evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( originSet )
|
if( originSet )
|
||||||
|
@ -184,7 +185,6 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A click or drag starts
|
// A click or drag starts
|
||||||
else if( !originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsDrag( BUT_LEFT ) ) )
|
else if( !originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsDrag( BUT_LEFT ) ) )
|
||||||
{
|
{
|
||||||
|
@ -195,7 +195,6 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
controls.CaptureCursor( true );
|
controls.CaptureCursor( true );
|
||||||
controls.SetAutoPan( true );
|
controls.SetAutoPan( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// another click after origin set is the end
|
// another click after origin set is the end
|
||||||
// left up is also the end, as you'll only get that after a drag
|
// left up is also the end, as you'll only get that after a drag
|
||||||
else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
|
else if( originSet && ( evt->IsClick( BUT_LEFT ) || evt->IsMouseUp( BUT_LEFT ) ) )
|
||||||
|
@ -212,7 +211,6 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
view.SetVisible( &previewRect, false );
|
view.SetVisible( &previewRect, false );
|
||||||
view.Update( &previewRect, KIGFX::GEOMETRY );
|
view.Update( &previewRect, KIGFX::GEOMETRY );
|
||||||
}
|
}
|
||||||
|
|
||||||
// any move or drag once the origin was set updates
|
// any move or drag once the origin was set updates
|
||||||
// the end point
|
// the end point
|
||||||
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
|
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
|
||||||
|
@ -223,19 +221,21 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||||
view.SetVisible( &previewRect, true );
|
view.SetVisible( &previewRect, true );
|
||||||
view.Update( &previewRect, KIGFX::GEOMETRY );
|
view.Update( &previewRect, KIGFX::GEOMETRY );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
m_menu.ShowContextMenu( selection() );
|
m_menu.ShowContextMenu( selection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
view.Remove( &previewRect );
|
||||||
|
|
||||||
|
frame.GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
controls.CaptureCursor( false );
|
controls.CaptureCursor( false );
|
||||||
controls.SetAutoPan( false );
|
controls.SetAutoPan( false );
|
||||||
view.Remove( &previewRect );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,7 @@ void LENGTH_TUNER_TOOL::performTuning()
|
||||||
m_router->StopRouting();
|
m_router->StopRouting();
|
||||||
controls()->SetAutoPan( false );
|
controls()->SetAutoPan( false );
|
||||||
controls()->ForceCursorPosition( false );
|
controls()->ForceCursorPosition( false );
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
highlightNet( false );
|
highlightNet( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +324,7 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||||
// Store routing settings till the next invocation
|
// Store routing settings till the next invocation
|
||||||
m_savedSizes = m_router->Sizes();
|
m_savedSizes = m_router->Sizes();
|
||||||
|
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
frame()->PopTool( tool );
|
frame()->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -962,6 +962,7 @@ bool ROUTER_TOOL::finishInteractive()
|
||||||
{
|
{
|
||||||
m_router->StopRouting();
|
m_router->StopRouting();
|
||||||
|
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
controls()->SetAutoPan( false );
|
controls()->SetAutoPan( false );
|
||||||
controls()->ForceCursorPosition( false );
|
controls()->ForceCursorPosition( false );
|
||||||
frame()->UndoRedoBlock( false );
|
frame()->UndoRedoBlock( false );
|
||||||
|
|
|
@ -450,7 +450,8 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
||||||
setCursor();
|
setCursor();
|
||||||
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
VECTOR2I cursorPos = m_controls->GetCursorPosition();
|
||||||
|
|
||||||
auto cleanup = [&]()
|
auto cleanup =
|
||||||
|
[&]()
|
||||||
{
|
{
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
m_controls->ForceCursorPosition( false );
|
m_controls->ForceCursorPosition( false );
|
||||||
|
@ -619,7 +620,8 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame()->SetMsgPanel( board() );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
m_frame->SetMsgPanel( board() );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +698,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
||||||
cursorPos = grid.BestSnapAnchor( cursorPos, nullptr );
|
cursorPos = grid.BestSnapAnchor( cursorPos, nullptr );
|
||||||
m_controls->ForceCursorPosition( true, cursorPos );
|
m_controls->ForceCursorPosition( true, cursorPos );
|
||||||
|
|
||||||
auto cleanup = [&]()
|
auto cleanup =
|
||||||
|
[&]()
|
||||||
{
|
{
|
||||||
m_controls->SetAutoPan( false );
|
m_controls->SetAutoPan( false );
|
||||||
m_controls->CaptureCursor( false );
|
m_controls->CaptureCursor( false );
|
||||||
|
@ -714,7 +717,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
||||||
m_controls->SetAutoPan( false );
|
m_controls->SetAutoPan( false );
|
||||||
|
|
||||||
if( step != SET_ORIGIN ) // start from the beginning
|
if( step != SET_ORIGIN ) // start from the beginning
|
||||||
|
{
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
|
@ -980,9 +985,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
||||||
m_controls->SetAutoPan( false );
|
m_controls->SetAutoPan( false );
|
||||||
m_controls->ForceCursorPosition( false );
|
m_controls->ForceCursorPosition( false );
|
||||||
m_controls->CaptureCursor( false );
|
m_controls->CaptureCursor( false );
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
m_view->Remove( &preview );
|
m_view->Remove( &preview );
|
||||||
frame()->SetMsgPanel( board() );
|
m_frame->SetMsgPanel( board() );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,6 +1162,8 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
preview.Clear();
|
preview.Clear();
|
||||||
m_view->Remove( &preview );
|
m_view->Remove( &preview );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
m_frame->PopTool( tool );
|
m_frame->PopTool( tool );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1231,6 +1239,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,7 +1325,8 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
||||||
if( evt->Modifier( MD_CTRL ) )
|
if( evt->Modifier( MD_CTRL ) )
|
||||||
limit45 = !limit45;
|
limit45 = !limit45;
|
||||||
|
|
||||||
auto cleanup = [&]()
|
auto cleanup =
|
||||||
|
[&]()
|
||||||
{
|
{
|
||||||
preview.Clear();
|
preview.Clear();
|
||||||
m_view->Update( &preview );
|
m_view->Update( &preview );
|
||||||
|
@ -1520,7 +1530,9 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
||||||
|
|
||||||
m_view->Remove( &twoPointAsst );
|
m_view->Remove( &twoPointAsst );
|
||||||
m_view->Remove( &preview );
|
m_view->Remove( &preview );
|
||||||
frame()->SetMsgPanel( board() );
|
m_frame->SetMsgPanel( board() );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
m_controls->SetAutoPan( false );
|
m_controls->SetAutoPan( false );
|
||||||
m_controls->CaptureCursor( false );
|
m_controls->CaptureCursor( false );
|
||||||
m_controls->ForceCursorPosition( false );
|
m_controls->ForceCursorPosition( false );
|
||||||
|
@ -1603,7 +1615,9 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
|
||||||
VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic );
|
VECTOR2I cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), graphic );
|
||||||
m_controls->ForceCursorPosition( true, cursorPos );
|
m_controls->ForceCursorPosition( true, cursorPos );
|
||||||
|
|
||||||
auto cleanup = [&] () {
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
|
{
|
||||||
preview.Clear();
|
preview.Clear();
|
||||||
delete *aGraphic;
|
delete *aGraphic;
|
||||||
*aGraphic = nullptr;
|
*aGraphic = nullptr;
|
||||||
|
@ -1760,7 +1774,9 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
|
||||||
preview.Remove( graphic );
|
preview.Remove( graphic );
|
||||||
m_view->Remove( &arcAsst );
|
m_view->Remove( &arcAsst );
|
||||||
m_view->Remove( &preview );
|
m_view->Remove( &preview );
|
||||||
frame()->SetMsgPanel( board() );
|
m_frame->SetMsgPanel( board() );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
m_controls->SetAutoPan( false );
|
m_controls->SetAutoPan( false );
|
||||||
m_controls->CaptureCursor( false );
|
m_controls->CaptureCursor( false );
|
||||||
m_controls->ForceCursorPosition( false );
|
m_controls->ForceCursorPosition( false );
|
||||||
|
@ -1891,7 +1907,8 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
||||||
else
|
else
|
||||||
polyGeomMgr.SetLeaderMode( POLYGON_GEOM_MANAGER::LEADER_MODE::DIRECT );
|
polyGeomMgr.SetLeaderMode( POLYGON_GEOM_MANAGER::LEADER_MODE::DIRECT );
|
||||||
|
|
||||||
auto cleanup = [&] ()
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
{
|
{
|
||||||
polyGeomMgr.Reset();
|
polyGeomMgr.Reset();
|
||||||
started = false;
|
started = false;
|
||||||
|
@ -2030,6 +2047,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
m_controls->ForceCursorPosition( false );
|
m_controls->ForceCursorPosition( false );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,6 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
frame()->PopTool( tool );
|
frame()->PopTool( tool );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsActivate() )
|
else if( evt->IsActivate() )
|
||||||
{
|
{
|
||||||
commit.Push( _( "Renumber pads" ) );
|
commit.Push( _( "Renumber pads" ) );
|
||||||
|
@ -323,7 +322,6 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
frame()->PopTool( tool );
|
frame()->PopTool( tool );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsDrag( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
selectedPads.clear();
|
selectedPads.clear();
|
||||||
|
@ -414,7 +412,6 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( ( evt->IsKeyPressed() && evt->KeyCode() == WXK_RETURN ) ||
|
else if( ( evt->IsKeyPressed() && evt->KeyCode() == WXK_RETURN ) ||
|
||||||
evt->IsDblClick( BUT_LEFT ) )
|
evt->IsDblClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
|
@ -422,14 +419,14 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
frame()->PopTool( tool );
|
frame()->PopTool( tool );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
m_menu.ShowContextMenu( selection() );
|
m_menu.ShowContextMenu( selection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the next loop by updating the old cursor mouse position
|
// Prepare the next loop by updating the old cursor mouse position
|
||||||
// to this last mouse cursor position
|
// to this last mouse cursor position
|
||||||
|
@ -444,6 +441,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
statusPopup.Hide();
|
statusPopup.Hide();
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -802,7 +802,8 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
||||||
if( reselect && fp )
|
if( reselect && fp )
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp );
|
||||||
|
|
||||||
auto cleanup = [&] ()
|
auto cleanup =
|
||||||
|
[&] ()
|
||||||
{
|
{
|
||||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||||
commit.Revert();
|
commit.Revert();
|
||||||
|
@ -832,7 +833,6 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsActivate() )
|
else if( evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( fp )
|
if( fp )
|
||||||
|
@ -849,7 +849,6 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
if( !fp )
|
if( !fp )
|
||||||
|
@ -890,33 +889,32 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
||||||
fp = NULL; // to indicate that there is no footprint that we currently modify
|
fp = NULL; // to indicate that there is no footprint that we currently modify
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
m_menu.ShowContextMenu( selection() );
|
m_menu.ShowContextMenu( selection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
|
else if( fp && ( evt->IsMotion() || evt->IsAction( &ACTIONS::refreshPreview ) ) )
|
||||||
{
|
{
|
||||||
fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
|
fp->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
|
||||||
selection().SetReferencePoint( cursorPos );
|
selection().SetReferencePoint( cursorPos );
|
||||||
getView()->Update( & selection() );
|
getView()->Update( & selection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
|
else if( fp && evt->IsAction( &PCB_ACTIONS::properties ) )
|
||||||
{
|
{
|
||||||
// Calling 'Properties' action clears the selection, so we need to restore it
|
// Calling 'Properties' action clears the selection, so we need to restore it
|
||||||
reselect = true;
|
reselect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
|
}
|
||||||
|
|
||||||
// Enable autopanning and cursor capture only when there is a footprint to be placed
|
// Enable autopanning and cursor capture only when there is a footprint to be placed
|
||||||
controls->SetAutoPan( !!fp );
|
controls->SetAutoPan( !!fp );
|
||||||
controls->CaptureCursor( !!fp );
|
controls->CaptureCursor( !!fp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,7 +1029,6 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
||||||
frame()->PopTool( tool );
|
frame()->PopTool( tool );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsActivate() )
|
else if( evt->IsActivate() )
|
||||||
{
|
{
|
||||||
if( evt->IsMoveTool() )
|
if( evt->IsMoveTool() )
|
||||||
|
@ -1045,13 +1042,11 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
|
else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
|
||||||
{
|
{
|
||||||
target->SetWidth( target->GetWidth() + WIDTH_STEP );
|
target->SetWidth( target->GetWidth() + WIDTH_STEP );
|
||||||
view->Update( &preview );
|
view->Update( &preview );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsAction( &PCB_ACTIONS::decWidth ) )
|
else if( evt->IsAction( &PCB_ACTIONS::decWidth ) )
|
||||||
{
|
{
|
||||||
int width = target->GetWidth();
|
int width = target->GetWidth();
|
||||||
|
@ -1062,7 +1057,6 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
||||||
view->Update( &preview );
|
view->Update( &preview );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_LEFT ) )
|
else if( evt->IsClick( BUT_LEFT ) )
|
||||||
{
|
{
|
||||||
assert( target->GetSize() > 0 );
|
assert( target->GetSize() > 0 );
|
||||||
|
@ -1078,25 +1072,26 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
||||||
target = new PCB_TARGET( *target );
|
target = new PCB_TARGET( *target );
|
||||||
preview.Add( target );
|
preview.Add( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsClick( BUT_RIGHT ) )
|
else if( evt->IsClick( BUT_RIGHT ) )
|
||||||
{
|
{
|
||||||
m_menu.ShowContextMenu( selection() );
|
m_menu.ShowContextMenu( selection() );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( evt->IsMotion() )
|
else if( evt->IsMotion() )
|
||||||
{
|
{
|
||||||
target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
|
target->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
|
||||||
view->Update( &preview );
|
view->Update( &preview );
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
evt->SetPassEvent();
|
evt->SetPassEvent();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
preview.Clear();
|
preview.Clear();
|
||||||
delete target;
|
delete target;
|
||||||
view->Remove( &preview );
|
view->Remove( &preview );
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,6 +247,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
|
||||||
}
|
}
|
||||||
|
|
||||||
view()->Remove( &preview );
|
view()->Remove( &preview );
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,8 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
view.SetVisible( &ruler, false );
|
view.SetVisible( &ruler, false );
|
||||||
view.Remove( &ruler );
|
view.Remove( &ruler );
|
||||||
|
|
||||||
|
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue