mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Make sure we don't end up with stale picker handlers (lots of Sentry tickets).
This commit is contained in:
parent
da9544dfd1
commit
69b23df4c3
@ -1780,6 +1780,7 @@ int SCH_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
|
||||
|
||||
picker->SetCursor( KICURSOR::REMOVE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this]( const VECTOR2D& aPosition ) -> bool
|
||||
|
@ -558,6 +558,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||
|
||||
picker->SetCursor( KICURSOR::VOLTAGE_PROBE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this, simFrame]( const VECTOR2D& aPosition )
|
||||
@ -724,6 +725,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
||||
|
||||
picker->SetCursor( KICURSOR::TUNE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this]( const VECTOR2D& aPosition )
|
||||
@ -1251,6 +1253,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
||||
|
||||
picker->SetCursor( KICURSOR::BULLSEYE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this] ( const VECTOR2D& aPos )
|
||||
|
@ -497,6 +497,8 @@ int SYMBOL_EDITOR_EDIT_TOOL::InteractiveDelete( const TOOL_EVENT& aEvent )
|
||||
Activate();
|
||||
|
||||
picker->SetCursor( KICURSOR::REMOVE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this]( const VECTOR2D& aPosition ) -> bool
|
||||
|
@ -65,6 +65,14 @@ public:
|
||||
|
||||
inline void SetSnapping( bool aSnap ) { m_snap = aSnap; }
|
||||
|
||||
void ClearHandlers()
|
||||
{
|
||||
m_clickHandler.reset();
|
||||
m_motionHandler.reset();
|
||||
m_cancelHandler.reset();
|
||||
m_finalizeHandler.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a handler for mouse click event.
|
||||
*
|
||||
|
@ -216,9 +216,9 @@ void DIALOG_POSITION_RELATIVE::OnSelectItemClick( wxCommandEvent& event )
|
||||
|
||||
PCB_PICKER_TOOL* pickerTool = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
wxCHECK( pickerTool, /* void */ );
|
||||
m_toolMgr->RunAction(
|
||||
PCB_ACTIONS::selectItemInteractively,
|
||||
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select reference item..." ) } );
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItemInteractively,
|
||||
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select reference item..." ) } );
|
||||
|
||||
Hide();
|
||||
}
|
||||
@ -230,9 +230,9 @@ void DIALOG_POSITION_RELATIVE::OnSelectPointClick( wxCommandEvent& event )
|
||||
|
||||
PCB_PICKER_TOOL* pickerTool = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
wxCHECK( pickerTool, /* void */ );
|
||||
m_toolMgr->RunAction(
|
||||
PCB_ACTIONS::selectPointInteractively,
|
||||
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select reference point..." ) } );
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectPointInteractively,
|
||||
PCB_PICKER_TOOL::INTERACTIVE_PARAMS{ this, _( "Select reference point..." ) } );
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
@ -1759,6 +1759,9 @@ int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
Activate();
|
||||
|
||||
picker->SetCursor( KICURSOR::PLACE );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this] ( const VECTOR2D& pt ) -> bool
|
||||
{
|
||||
@ -1798,11 +1801,8 @@ void BOARD_EDITOR_CONTROL::setTransitions()
|
||||
Go( &BOARD_EDITOR_CONTROL::ImportSpecctraSession, PCB_ACTIONS::importSpecctraSession.MakeEvent() );
|
||||
Go( &BOARD_EDITOR_CONTROL::ExportSpecctraDSN, PCB_ACTIONS::exportSpecctraDSN.MakeEvent() );
|
||||
|
||||
if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame
|
||||
&& m_frame->GetExportNetlistAction() )
|
||||
{
|
||||
if( ADVANCED_CFG::GetCfg().m_ShowPcbnewExportNetlist && m_frame && m_frame->GetExportNetlistAction() )
|
||||
Go( &BOARD_EDITOR_CONTROL::ExportNetlist, m_frame->GetExportNetlistAction()->MakeEvent() );
|
||||
}
|
||||
|
||||
Go( &BOARD_EDITOR_CONTROL::GenerateDrillFiles, PCB_ACTIONS::generateDrillFiles.MakeEvent() );
|
||||
Go( &BOARD_EDITOR_CONTROL::GenerateGerbers, PCB_ACTIONS::generateGerbers.MakeEvent() );
|
||||
|
@ -1954,6 +1954,8 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||
Activate();
|
||||
|
||||
picker->SetCursor( KICURSOR::BULLSEYE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this, board]( const VECTOR2D& pt ) -> bool
|
||||
|
@ -3196,6 +3196,8 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS
|
||||
|
||||
/// This allow the option of snapping in the tool
|
||||
picker->SetSnapping( true );
|
||||
picker->SetCursor( KICURSOR::PLACE );
|
||||
picker->ClearHandlers();
|
||||
|
||||
const auto setPickerLayerSet =
|
||||
[&]()
|
||||
|
@ -763,6 +763,9 @@ int PCB_CONTROL::GridPlaceOrigin( const TOOL_EVENT& aEvent )
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
Activate();
|
||||
|
||||
picker->SetCursor( KICURSOR::PLACE );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this]( const VECTOR2D& pt ) -> bool
|
||||
{
|
||||
@ -803,6 +806,8 @@ int PCB_CONTROL::InteractiveDelete( const TOOL_EVENT& aEvent )
|
||||
Activate();
|
||||
|
||||
picker->SetCursor( KICURSOR::REMOVE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[this]( const VECTOR2D& aPosition ) -> bool
|
||||
|
@ -49,6 +49,10 @@ int PCB_GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
|
||||
|
||||
statusPopup.SetText( _( "Click on new member..." ) );
|
||||
|
||||
picker->SetCursor( KICURSOR::BULLSEYE );
|
||||
picker->SetSnapping( false );
|
||||
picker->ClearHandlers();
|
||||
|
||||
picker->SetClickHandler(
|
||||
[&]( const VECTOR2D& aPoint ) -> bool
|
||||
{
|
||||
|
@ -263,6 +263,10 @@ int PCB_PICKER_TOOL::SelectPointInteractively( const TOOL_EVENT& aEvent )
|
||||
params.m_Receiver->UpdatePickedPoint( aPoint );
|
||||
};
|
||||
|
||||
SetSnapping( true );
|
||||
SetCursor( KICURSOR::PLACE );
|
||||
ClearHandlers();
|
||||
|
||||
SetClickHandler(
|
||||
[&]( const VECTOR2D& aPoint ) -> bool
|
||||
{
|
||||
@ -324,6 +328,10 @@ int PCB_PICKER_TOOL::SelectItemInteractively( const TOOL_EVENT& aEvent )
|
||||
params.m_Receiver->UpdatePickedItem( aItem );
|
||||
};
|
||||
|
||||
SetCursor( KICURSOR::BULLSEYE );
|
||||
SetSnapping( false );
|
||||
ClearHandlers();
|
||||
|
||||
SetClickHandler(
|
||||
[&]( const VECTOR2D& aPoint ) -> bool
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user