Fix crash bugs in picker tools.
This commit is contained in:
parent
aa4d7682ca
commit
b858fa38c4
|
@ -436,7 +436,7 @@ void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aF
|
||||||
#ifdef KICAD_SPICE
|
#ifdef KICAD_SPICE
|
||||||
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||||
|
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
@ -444,7 +444,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
picker->SetCursor( SIMULATION_CURSORS::GetCursor( SIMULATION_CURSORS::CURSOR::PROBE ) );
|
picker->SetCursor( SIMULATION_CURSORS::GetCursor( SIMULATION_CURSORS::CURSOR::PROBE ) );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[&]( const VECTOR2D& aPosition )
|
[this] ( const VECTOR2D& aPosition )
|
||||||
{
|
{
|
||||||
KICAD_T wiresAndComponents[] = { SCH_LINE_T, SCH_COMPONENT_T, SCH_SHEET_PIN_T, EOT };
|
KICAD_T wiresAndComponents[] = { SCH_LINE_T, SCH_COMPONENT_T, SCH_SHEET_PIN_T, EOT };
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
return true;
|
return true;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
std::string tool = aEvent.GetCommandStr().get();
|
std::string tool = aEvent.GetCommandStr().get();
|
||||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -482,7 +482,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||||
|
|
||||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||||
Activate();
|
Activate();
|
||||||
|
@ -490,7 +490,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
||||||
picker->SetCursor( SIMULATION_CURSORS::GetCursor( SIMULATION_CURSORS::CURSOR::TUNE ) );
|
picker->SetCursor( SIMULATION_CURSORS::GetCursor( SIMULATION_CURSORS::CURSOR::TUNE ) );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[&]( const VECTOR2D& aPosition )
|
[this] ( const VECTOR2D& aPosition )
|
||||||
{
|
{
|
||||||
KICAD_T fieldsAndComponents[] = { SCH_COMPONENT_T, SCH_FIELD_T, EOT };
|
KICAD_T fieldsAndComponents[] = { SCH_COMPONENT_T, SCH_FIELD_T, EOT };
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
||||||
picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
|
picker->SetCursor( wxStockCursor( wxCURSOR_BULLSEYE ) );
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[this]( const VECTOR2D& aPos )
|
[this] ( const VECTOR2D& aPos )
|
||||||
{
|
{
|
||||||
return highlightNet( m_toolMgr, aPos );
|
return highlightNet( m_toolMgr, aPos );
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -1345,7 +1345,7 @@ int PCB_EDITOR_CONTROL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
picker->SetClickHandler(
|
picker->SetClickHandler(
|
||||||
[&] ( const VECTOR2D& pt ) -> bool
|
[this, board, opt]( const VECTOR2D& pt ) -> bool
|
||||||
{
|
{
|
||||||
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
|
||||||
|
|
||||||
|
@ -1393,7 +1393,7 @@ int PCB_EDITOR_CONTROL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||||
} );
|
} );
|
||||||
|
|
||||||
picker->SetFinalizeHandler(
|
picker->SetFinalizeHandler(
|
||||||
[ board, opt ]( int aCondition )
|
[board, opt] ( int aCondition )
|
||||||
{
|
{
|
||||||
if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
|
if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
|
||||||
{
|
{
|
||||||
|
|
|
@ -552,7 +552,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||||
} );
|
} );
|
||||||
|
|
||||||
picker->SetFinalizeHandler(
|
picker->SetFinalizeHandler(
|
||||||
[&]( const int& aFinalState )
|
[this] ( const int& aFinalState )
|
||||||
{
|
{
|
||||||
if( m_pickerItem )
|
if( m_pickerItem )
|
||||||
m_toolMgr->GetTool<SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
|
m_toolMgr->GetTool<SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
|
||||||
|
|
Loading…
Reference in New Issue