diff --git a/common/tool/picker_tool.cpp b/common/tool/picker_tool.cpp index afa5abe9aa..360365e9b5 100644 --- a/common/tool/picker_tool.cpp +++ b/common/tool/picker_tool.cpp @@ -26,6 +26,7 @@ #include #include #include +#include void PICKER_TOOL_BASE::reset() @@ -77,7 +78,12 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) KIGFX::VIEW_CONTROLS* controls = getViewControls(); int finalize_state = WAIT_CANCEL; - m_frame->PushTool( aEvent ); + wxCHECK_MSG( aEvent.Parameter(), -1, + wxT( "PICKER_TOOL::Main() called without a source event" ) ); + + const TOOL_EVENT sourceEvent = *aEvent.Parameter(); + + m_frame->PushTool( sourceEvent ); Activate(); setControls(); @@ -193,7 +199,7 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) reset(); controls->ForceCursorPosition( false ); - m_frame->PopTool( aEvent ); + m_frame->PopTool( sourceEvent ); return 0; } diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 7035d4ff8f..5258f7a0fa 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -1353,7 +1353,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 2cc2076f42..8d95e628e4 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -649,7 +649,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } @@ -739,7 +739,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } @@ -1167,7 +1167,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent ) return highlightNet( m_toolMgr, aPos ); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/eeschema/tools/symbol_editor_edit_tool.cpp b/eeschema/tools/symbol_editor_edit_tool.cpp index 114a775d32..f15f039d89 100644 --- a/eeschema/tools/symbol_editor_edit_tool.cpp +++ b/eeschema/tools/symbol_editor_edit_tool.cpp @@ -397,7 +397,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp index ba50dca18a..7bda772557 100644 --- a/pagelayout_editor/tools/pl_edit_tool.cpp +++ b/pagelayout_editor/tools/pl_edit_tool.cpp @@ -476,7 +476,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) m_toolMgr->RunAction( PL_ACTIONS::selectionActivate, false ); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/pcbnew/tools/board_editor_control.cpp b/pcbnew/tools/board_editor_control.cpp index d4ba9c2f6b..9173668e80 100644 --- a/pcbnew/tools/board_editor_control.cpp +++ b/pcbnew/tools/board_editor_control.cpp @@ -1589,7 +1589,7 @@ int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent ) return false; // drill origin is a one-shot; don't continue with tool } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index f9765f129c..9e99a712dc 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -1815,7 +1815,7 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent ) } } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 7304281c00..d0d555f988 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -2420,7 +2420,8 @@ bool EDIT_TOOL::pickReferencePoint( const wxString& aTooltip, const wxString& aS m_statusPopup->Popup(); canvas()->SetStatusPopup( m_statusPopup->GetPanel() ); - m_toolMgr->RunAction( ACTIONS::pickerSubTool, true ); + TOOL_EVENT subtoolEvent = PCB_ACTIONS::pickerSubTool.MakeEvent(); + m_toolMgr->RunAction( ACTIONS::pickerSubTool, true, (void*) &subtoolEvent ); while( !done ) { diff --git a/pcbnew/tools/group_tool.cpp b/pcbnew/tools/group_tool.cpp index 52521c2fd8..ca13f7438d 100644 --- a/pcbnew/tools/group_tool.cpp +++ b/pcbnew/tools/group_tool.cpp @@ -131,7 +131,6 @@ int GROUP_TOOL::GroupProperties( const TOOL_EVENT& aEvent ) int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent ) { - std::string tool = "pcbnew.EditGroups.selectNewMember"; PCB_PICKER_TOOL* picker = m_toolMgr->GetTool(); STATUS_TEXT_POPUP statusPopup( frame() ); bool done = false; @@ -201,7 +200,7 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent ) statusPopup.Popup(); canvas()->SetStatusPopup( statusPopup.GetPanel() ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); while( !done ) { diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 945b0a380e..ee8d7f1e68 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -542,7 +542,7 @@ int PCB_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent ) return false; // drill origin is a one-shot; don't continue with tool } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); } return 0; @@ -655,7 +655,7 @@ int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent ) m_frame->GetCanvas()->Refresh(); } ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); return 0; } diff --git a/pcbnew/tools/pcb_picker_tool.cpp b/pcbnew/tools/pcb_picker_tool.cpp index be4d4f8492..fdeb3a3ae0 100644 --- a/pcbnew/tools/pcb_picker_tool.cpp +++ b/pcbnew/tools/pcb_picker_tool.cpp @@ -44,8 +44,16 @@ int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) PCB_GRID_HELPER grid( m_toolMgr, frame->GetMagneticItemsSettings() ); int finalize_state = WAIT_CANCEL; + TOOL_EVENT sourceEvent; + if( aEvent.IsAction( &ACTIONS::pickerTool ) ) - frame->PushTool( aEvent ); + { + wxCHECK_MSG( aEvent.Parameter(), -1, + wxT( "PCB_PICKER_TOOL::Main() called without a source event" ) ); + + sourceEvent = *aEvent.Parameter(); + frame->PushTool( sourceEvent ); + } Activate(); setControls(); @@ -174,7 +182,7 @@ int PCB_PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) controls->ShowCursor( false ); if( aEvent.IsAction( &ACTIONS::pickerTool ) ) - frame->PopTool( aEvent ); + frame->PopTool( sourceEvent ); return 0; } diff --git a/pcbnew/tools/position_relative_tool.cpp b/pcbnew/tools/position_relative_tool.cpp index f61008fdd0..48ccb7990d 100644 --- a/pcbnew/tools/position_relative_tool.cpp +++ b/pcbnew/tools/position_relative_tool.cpp @@ -164,7 +164,6 @@ int POSITION_RELATIVE_TOOL::RelativeItemSelectionMove( const VECTOR2I& aPosAncho int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent ) { - std::string tool = "pcbnew.PositionRelative.selectReferenceItem"; PCB_PICKER_TOOL* picker = m_toolMgr->GetTool(); STATUS_TEXT_POPUP statusPopup( frame() ); bool done = false; @@ -220,7 +219,7 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent statusPopup.Popup(); canvas()->SetStatusPopup( statusPopup.GetPanel() ); - m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool ); + m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); while( !done ) {