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