Browse Source

Make sure we don't end up with stale picker handlers (lots of Sentry tickets).

pull/18/head
Jeff Young 3 months ago
parent
commit
69b23df4c3
  1. 1
      eeschema/tools/sch_edit_tool.cpp
  2. 3
      eeschema/tools/sch_editor_control.cpp
  3. 2
      eeschema/tools/symbol_editor_edit_tool.cpp
  4. 8
      include/tool/picker_tool.h
  5. 12
      pcbnew/dialogs/dialog_position_relative.cpp
  6. 8
      pcbnew/tools/board_editor_control.cpp
  7. 2
      pcbnew/tools/board_inspection_tool.cpp
  8. 2
      pcbnew/tools/edit_tool.cpp
  9. 5
      pcbnew/tools/pcb_control.cpp
  10. 4
      pcbnew/tools/pcb_group_tool.cpp
  11. 8
      pcbnew/tools/pcb_picker_tool.cpp

1
eeschema/tools/sch_edit_tool.cpp

@ -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

3
eeschema/tools/sch_editor_control.cpp

@ -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 )

2
eeschema/tools/symbol_editor_edit_tool.cpp

@ -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

8
include/tool/picker_tool.h

@ -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.
*

12
pcbnew/dialogs/dialog_position_relative.cpp

@ -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();
}

8
pcbnew/tools/board_editor_control.cpp

@ -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() );

2
pcbnew/tools/board_inspection_tool.cpp

@ -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

2
pcbnew/tools/edit_tool.cpp

@ -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 =
[&]()

5
pcbnew/tools/pcb_control.cpp

@ -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

4
pcbnew/tools/pcb_group_tool.cpp

@ -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
{

8
pcbnew/tools/pcb_picker_tool.cpp

@ -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…
Cancel
Save