mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 18:31:40 +00:00
TOOL_EVENT: make command string non-optional
We're getting segfaults in places where this isn't checked. Also, add some asserts so we can catch bad tool push/pop. Removes all uses of GetCommandStr() and makes it private.
This commit is contained in:
parent
b7ba24b2d9
commit
9304607624
common/tool
eeschema/tools
sch_drawing_tools.cppsch_edit_tool.cppsch_editor_control.cppsch_line_wire_bus_tool.cppsch_line_wire_bus_tool.hsch_move_tool.cppsymbol_editor_drawing_tools.cppsymbol_editor_edit_tool.cppsymbol_editor_move_tool.cpp
gerbview/tools
include/tool
pagelayout_editor/tools
pcbnew
microwave
router
tools
@ -77,8 +77,7 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
KIGFX::VIEW_CONTROLS* controls = getViewControls();
|
||||
int finalize_state = WAIT_CANCEL;
|
||||
|
||||
std::string tool = *aEvent.Parameter<std::string*>();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
Activate();
|
||||
|
||||
setControls();
|
||||
@ -194,7 +193,7 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
|
||||
reset();
|
||||
controls->ForceCursorPosition( false );
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -180,8 +180,7 @@ const std::string TOOL_EVENT::Format() const
|
||||
ev += tmp;
|
||||
}
|
||||
|
||||
if( m_commandStr )
|
||||
ev += "cmd-str: " + ( *m_commandStr );
|
||||
ev += "cmd-str: " + m_commandStr;
|
||||
|
||||
return ev;
|
||||
}
|
||||
@ -212,9 +211,9 @@ bool TOOL_EVENT::IsDblClick( int aButtonMask ) const
|
||||
|
||||
bool TOOL_EVENT::IsCancelInteractive() const
|
||||
{
|
||||
return ( ( m_commandStr && *m_commandStr == ACTIONS::cancelInteractive.GetName() )
|
||||
|| ( m_commandId && *m_commandId == ACTIONS::cancelInteractive.GetId() )
|
||||
|| ( m_actions == TA_CANCEL_TOOL ) );
|
||||
return ( ( m_commandStr == ACTIONS::cancelInteractive.GetName() )
|
||||
|| ( m_commandId && *m_commandId == ACTIONS::cancelInteractive.GetId() )
|
||||
|| ( m_actions == TA_CANCEL_TOOL ) );
|
||||
}
|
||||
|
||||
|
||||
@ -229,26 +228,24 @@ bool TOOL_EVENT::IsSelectionEvent() const
|
||||
|
||||
bool TOOL_EVENT::IsPointEditor() const
|
||||
{
|
||||
return ( ( m_commandStr && m_commandStr->find( "PointEditor" ) != GetCommandStr()->npos )
|
||||
|| ( m_commandId && *m_commandId == ACTIONS::activatePointEditor.GetId() ) );
|
||||
return ( ( m_commandStr.find( "PointEditor" ) != getCommandStr().npos )
|
||||
|| ( m_commandId && *m_commandId == ACTIONS::activatePointEditor.GetId() ) );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsMoveTool() const
|
||||
{
|
||||
return ( m_commandStr
|
||||
&& m_commandStr->find( "InteractiveMove" ) != GetCommandStr()->npos );
|
||||
return ( m_commandStr.find( "InteractiveMove" ) != getCommandStr().npos );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsEditorTool() const
|
||||
{
|
||||
return ( m_commandStr
|
||||
&& m_commandStr->find( "InteractiveEdit" ) != GetCommandStr()->npos );
|
||||
return ( m_commandStr.find( "InteractiveEdit" ) != getCommandStr().npos );
|
||||
}
|
||||
|
||||
|
||||
bool TOOL_EVENT::IsSimulator() const
|
||||
{
|
||||
return ( m_commandStr && m_commandStr->find( "Simulation" ) != GetCommandStr()->npos );
|
||||
return ( m_commandStr.find( "Simulation" ) != getCommandStr().npos );
|
||||
}
|
||||
|
@ -829,7 +829,7 @@ bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( aEvent.IsActivate() )
|
||||
{
|
||||
auto tool = m_toolNameIndex.find( *aEvent.GetCommandStr() );
|
||||
auto tool = m_toolNameIndex.find( aEvent.getCommandStr() );
|
||||
|
||||
if( tool != m_toolNameIndex.end() )
|
||||
{
|
||||
@ -1153,9 +1153,8 @@ bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
|
||||
if( GetToolHolder() && !GetToolHolder()->GetDoImmediateActions() )
|
||||
{
|
||||
// An tool-selection-event has no position
|
||||
if( mod_event.GetCommandStr()
|
||||
&& *mod_event.GetCommandStr() != GetToolHolder()->CurrentToolName()
|
||||
&& !mod_event.ForceImmediate() )
|
||||
if( mod_event.getCommandStr() != GetToolHolder()->CurrentToolName()
|
||||
&& !mod_event.ForceImmediate() )
|
||||
{
|
||||
mod_event.SetHasPosition( false );
|
||||
}
|
||||
|
@ -41,8 +41,12 @@ TOOLS_HOLDER::TOOLS_HOLDER() :
|
||||
|
||||
|
||||
// TODO: Implement an RAII mechanism for the stack PushTool/PopTool pairs
|
||||
void TOOLS_HOLDER::PushTool( const std::string& actionName )
|
||||
void TOOLS_HOLDER::PushTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
const std::string& actionName = aEvent.getCommandStr();
|
||||
|
||||
wxASSERT_MSG( !actionName.empty(), "Pushed Empty Tool Name!" );
|
||||
|
||||
m_toolStack.push_back( actionName );
|
||||
|
||||
// Human cognitive stacking is very shallow; deeper tool stacks just get annoying
|
||||
@ -58,8 +62,12 @@ void TOOLS_HOLDER::PushTool( const std::string& actionName )
|
||||
}
|
||||
|
||||
|
||||
void TOOLS_HOLDER::PopTool( const std::string& actionName )
|
||||
void TOOLS_HOLDER::PopTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
const std::string& actionName = aEvent.getCommandStr();
|
||||
|
||||
wxASSERT_MSG( !aEvent.getCommandStr().empty(), "Popped Empty Tool Name!" );
|
||||
|
||||
// Push/pop events can get out of order (such as when they're generated by the Simulator
|
||||
// frame but not processed until the mouse is back in the Schematic frame), so make sure
|
||||
// we're popping the right stack frame.
|
||||
@ -94,6 +102,8 @@ void TOOLS_HOLDER::PopTool( const std::string& actionName )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wxASSERT_MSG( false, "Popped a Tool Not on the Tool Stack!" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,12 +60,7 @@ void ZOOM_TOOL::Reset( RESET_REASON aReason )
|
||||
|
||||
int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool;
|
||||
|
||||
if( aEvent.GetCommandStr() )
|
||||
tool = *aEvent.GetCommandStr();
|
||||
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -102,7 +97,7 @@ int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
|
||||
// Exit zoom tool
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -144,8 +144,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
wxFAIL_MSG( "PlaceSymbol(): unexpected request" );
|
||||
}
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto addSymbol =
|
||||
[&]( SCH_SYMBOL* aSymbol )
|
||||
@ -250,9 +249,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = symbol
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = symbol && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -264,7 +262,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -291,7 +289,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -463,8 +461,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
m_view->AddToPreview( image->Clone() );
|
||||
}
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -514,9 +511,8 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = image
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = image && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -528,13 +524,13 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -561,7 +557,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -629,7 +625,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( immediateMode )
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -751,8 +747,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
aEvent.Position() :
|
||||
controls->GetMousePosition() );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -790,7 +785,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsActivate() )
|
||||
@ -802,7 +797,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -841,7 +836,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( evt->IsDblClick( BUT_LEFT ) || type == SCH_SHEET_PIN_T ) // Finish tool.
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1135,8 +1130,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
auto setCursor =
|
||||
[&]()
|
||||
{
|
||||
@ -1208,9 +1202,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -1222,7 +1215,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1252,7 +1245,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1489,8 +1482,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -1526,9 +1518,8 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -1538,7 +1529,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1565,7 +1556,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1698,8 +1689,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -1735,9 +1725,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = sheet
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = sheet && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -1749,7 +1738,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1780,7 +1769,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1294,7 +1294,6 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
|
||||
int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
@ -1355,7 +1354,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -922,8 +922,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1012,8 +1011,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1384,7 +1382,6 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
||||
if( !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
|
||||
m_frame->RecalculateConnections( NO_CLEANUP );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
@ -1399,7 +1396,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
||||
return highlightNet( m_toolMgr, aPos );
|
||||
} );
|
||||
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -302,8 +302,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
||||
|
||||
DRAW_SEGMENT_EVENT_PARAMS* params = aEvent.Parameter<DRAW_SEGMENT_EVENT_PARAMS*>();
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
@ -316,7 +315,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
||||
startSegments( params->layer, cursorPos, params->sourceSegment );
|
||||
}
|
||||
|
||||
return doDrawSegments( tool, params->layer, params->quitOnDraw );
|
||||
return doDrawSegments( aEvent, params->layer, params->quitOnDraw );
|
||||
}
|
||||
|
||||
|
||||
@ -331,8 +330,7 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
||||
wxString net;
|
||||
SCH_LINE* segment = nullptr;
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
Activate();
|
||||
|
||||
if( netPtr )
|
||||
@ -377,11 +375,11 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
||||
// If we have an unfolded wire to draw, then draw it
|
||||
if( segment )
|
||||
{
|
||||
return doDrawSegments( tool, LAYER_WIRE, false );
|
||||
return doDrawSegments( aEvent, LAYER_WIRE, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -574,7 +572,7 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair<SCH_LINE*, SCH_L
|
||||
}
|
||||
|
||||
|
||||
int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw )
|
||||
int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType, bool aQuitOnDraw )
|
||||
{
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
SCH_LINE* segment = nullptr;
|
||||
@ -647,9 +645,8 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
||||
bool twoSegments = currentMode != LINE_MODE::LINE_MODE_FREE;
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = ( segment || m_busUnfold.in_progress )
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == aTool;
|
||||
bool isSyntheticClick = ( segment || m_busUnfold.in_progress ) && evt->IsActivate()
|
||||
&& evt->HasPosition() && evt->Matches( aTool );
|
||||
|
||||
setCursor();
|
||||
grid.SetMask( GRID_HELPER::ALL );
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
int TrimOverLappingWires( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
int doDrawSegments( const std::string& aTool, int aType, bool aQuitOnDraw );
|
||||
int doDrawSegments( const TOOL_EVENT& aTool, int aType, bool aQuitOnDraw );
|
||||
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos, SCH_LINE* aSegment = nullptr );
|
||||
SCH_LINE* doUnfoldBus( const wxString& aNet, const VECTOR2I& aPos = VECTOR2I( 0, 0 ) );
|
||||
void finishSegments();
|
||||
|
@ -144,20 +144,20 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
controls->ShowCursor( true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
if( selection.Empty() )
|
||||
{
|
||||
// Note that it's important to go through push/pop even when the selection is empty.
|
||||
// This keeps other tools from having to special-case an empty move.
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool restore_state = false;
|
||||
bool chain_commands = false;
|
||||
TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
|
||||
TOOL_EVENT copy = aEvent;
|
||||
TOOL_EVENT* evt = ©
|
||||
VECTOR2I prevPos;
|
||||
int snapLayer = UNDEFINED_LAYER;
|
||||
|
||||
@ -910,7 +910,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
m_dragAdditions.clear();
|
||||
m_lineConnectionCache.clear();
|
||||
m_moveInProgress = false;
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -145,9 +144,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -159,7 +157,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -189,7 +187,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -341,8 +339,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -376,9 +373,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !evt->DisableGridSnapping() );
|
||||
|
||||
// The tool hotkey is interpreted as a click when drawing
|
||||
bool isSyntheticClick = item
|
||||
&& evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->GetCommandStr() == tool;
|
||||
bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
@ -388,7 +384,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -408,7 +404,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -542,8 +538,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
|
||||
int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -564,12 +559,12 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsActivate() )
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
|
||||
|
@ -333,7 +333,6 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
|
||||
int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
@ -401,7 +400,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -110,8 +110,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
Activate();
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
@ -120,7 +119,8 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
|
||||
bool restore_state = false;
|
||||
bool chain_commands = false;
|
||||
TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
|
||||
TOOL_EVENT copy = aEvent;
|
||||
TOOL_EVENT* evt = ©
|
||||
VECTOR2I prevPos;
|
||||
|
||||
if( !selection.Front()->IsNew() )
|
||||
@ -365,7 +365,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
m_moveInProgress = false;
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -207,8 +207,7 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||
EDA_UNITS units = m_frame->GetUserUnits();
|
||||
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, gerbIUScale, units, false, false );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -247,7 +246,7 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -263,7 +262,7 @@ int GERBVIEW_INSPECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
class TOOL_ACTION;
|
||||
class TOOL_MANAGER;
|
||||
class TOOL_BASE;
|
||||
class TOOLS_HOLDER;
|
||||
|
||||
/**
|
||||
* Internal (GUI-independent) event definitions.
|
||||
@ -368,8 +369,8 @@ public:
|
||||
|
||||
if( m_category == TC_COMMAND || m_category == TC_MESSAGE )
|
||||
{
|
||||
if( (bool) m_commandStr && (bool) aEvent.m_commandStr )
|
||||
return *m_commandStr == *aEvent.m_commandStr;
|
||||
if( !m_commandStr.empty() && !aEvent.getCommandStr().empty() )
|
||||
return m_commandStr == aEvent.m_commandStr;
|
||||
|
||||
if( (bool) m_commandId && (bool) aEvent.m_commandId )
|
||||
return *m_commandId == *aEvent.m_commandId;
|
||||
@ -466,11 +467,6 @@ public:
|
||||
return m_commandId;
|
||||
}
|
||||
|
||||
std::optional<std::string> GetCommandStr() const
|
||||
{
|
||||
return m_commandStr;
|
||||
}
|
||||
|
||||
void SetMousePosition( const VECTOR2D& aP )
|
||||
{
|
||||
m_mousePos = aP;
|
||||
@ -478,9 +474,13 @@ public:
|
||||
|
||||
private:
|
||||
friend class TOOL_DISPATCHER;
|
||||
friend class TOOL_MANAGER;
|
||||
friend class TOOLS_HOLDER;
|
||||
|
||||
void init();
|
||||
|
||||
const std::string& getCommandStr() const { return m_commandStr; }
|
||||
|
||||
void setMouseDragOrigin( const VECTOR2D& aP )
|
||||
{
|
||||
m_mouseDragOrigin = aP;
|
||||
@ -551,7 +551,7 @@ private:
|
||||
TOOL_BASE* m_firstResponder;
|
||||
|
||||
std::optional<int> m_commandId;
|
||||
std::optional<std::string> m_commandStr;
|
||||
std::string m_commandStr;
|
||||
};
|
||||
|
||||
typedef std::optional<TOOL_EVENT> OPT_TOOL_EVENT;
|
||||
|
@ -110,8 +110,20 @@ public:
|
||||
* "tools", such as rectangle and circle, or wire and bus. So each user-level tool is
|
||||
* actually a #TOOL_ACTION.
|
||||
*/
|
||||
virtual void PushTool( const std::string& actionName );
|
||||
virtual void PopTool( const std::string& actionName );
|
||||
|
||||
/**
|
||||
* @brief Pushes a tool to the stack.
|
||||
*
|
||||
* @param aEvent The event that is starting the tool to be pushed to the stack.
|
||||
*/
|
||||
virtual void PushTool( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* @brief Pops a tool from the stack.
|
||||
*
|
||||
* @param aEvent The event that started the tool that was pushed to the stack.
|
||||
*/
|
||||
virtual void PopTool( const TOOL_EVENT& aEvent );
|
||||
|
||||
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
|
||||
|
||||
|
@ -78,8 +78,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -122,7 +121,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -138,7 +137,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -226,8 +225,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -333,7 +331,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
getViewControls()->SetAutoPan( false );
|
||||
getViewControls()->CaptureCursor( false );
|
||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
unique_peers.insert( drawItem->GetPeer() );
|
||||
}
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
Activate();
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
@ -127,7 +126,8 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
|
||||
bool restore_state = false;
|
||||
bool chain_commands = false;
|
||||
TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
|
||||
TOOL_EVENT copy = aEvent;
|
||||
TOOL_EVENT* evt = ©
|
||||
VECTOR2I prevPos;
|
||||
|
||||
if( !selection.Front()->IsNew() )
|
||||
@ -301,7 +301,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->PostEvent( EVENTS::SelectedEvent );
|
||||
|
||||
m_moveInProgress = false;
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -389,7 +389,6 @@ int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
||||
|
||||
int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
@ -455,7 +454,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
m_toolMgr->RunAction( PL_ACTIONS::selectionActivate, false );
|
||||
} );
|
||||
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -89,8 +89,7 @@ int MICROWAVE_TOOL::addMicrowaveFootprint( const TOOL_EVENT& aEvent )
|
||||
|
||||
MICROWAVE_PLACER placer( this, aEvent.Parameter<MICROWAVE_FOOTPRINT_SHAPE>() );
|
||||
|
||||
doInteractiveItemPlacement( *aEvent.GetCommandStr(), &placer,
|
||||
_( "Place microwave feature" ),
|
||||
doInteractiveItemPlacement( aEvent, &placer, _( "Place microwave feature" ),
|
||||
IPO_REPEAT | IPO_ROTATE | IPO_FLIP );
|
||||
|
||||
return 0;
|
||||
@ -114,8 +113,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||
KIGFX::VIEW_CONTROLS& controls = *getViewControls();
|
||||
PCB_EDIT_FRAME& frame = *getEditFrame<PCB_EDIT_FRAME>();
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
frame.PushTool( tool );
|
||||
frame.PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -161,7 +159,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||
cleanup();
|
||||
else
|
||||
{
|
||||
frame.PopTool( tool );
|
||||
frame.PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -177,7 +175,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
frame.PopTool( tool );
|
||||
frame.PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -274,8 +274,7 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
// Deselect all items
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
frame()->PushTool( tool );
|
||||
frame()->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -338,7 +337,7 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
m_savedSizes = m_router->Sizes();
|
||||
|
||||
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||
frame()->PopTool( tool );
|
||||
frame()->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1534,8 +1534,7 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = aEvent.GetCommandStr().value();
|
||||
frame->PushTool( tool );
|
||||
frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -1632,7 +1631,7 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
m_iface->SetCommitFlags( 0 );
|
||||
frame->PopTool( tool );
|
||||
frame->PopTool( aEvent );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1654,8 +1653,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
// Deselect all items
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
frame->PushTool( tool );
|
||||
frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -1684,7 +1682,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
frame->PopTool( tool );
|
||||
frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsActivate() )
|
||||
@ -1696,7 +1694,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
frame->PopTool( tool );
|
||||
frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1769,7 +1767,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( m_cancelled )
|
||||
{
|
||||
frame->PopTool( tool );
|
||||
frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -982,8 +982,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
auto setCursor =
|
||||
[&]()
|
||||
@ -1058,7 +1057,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1074,7 +1073,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
else
|
||||
{
|
||||
frame()->PopTool( tool );
|
||||
frame()->PopTool( aEvent );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1570,7 +1569,6 @@ void BOARD_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME*
|
||||
|
||||
int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
|
||||
// Deactivate other tools; particularly important if another PICKER is currently running
|
||||
@ -1584,7 +1582,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, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1539,7 +1539,6 @@ int BOARD_INSPECTION_TOOL::ClearHighlight( const TOOL_EVENT& aEvent )
|
||||
|
||||
int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
||||
BOARD* board = getModel<BOARD>();
|
||||
|
||||
@ -1610,7 +1609,7 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
} );
|
||||
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
||||
m_toolMgr->RunAction( ACTIONS::pickerTool, true );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -554,8 +554,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent,
|
||||
// do not capture or auto-pan until we start placing the table
|
||||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::TEXT );
|
||||
|
||||
std::string tool = *aEvent.GetCommandStr();
|
||||
m_frame->PushTool( tool );
|
||||
m_frame->PushTool( aEvent );
|
||||
|
||||
Activate();
|
||||
// Must be done after Activate() so that it gets set into the correct context
|
||||
@ -586,7 +585,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent,
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
cancelled = true;
|
||||
break;
|
||||
}
|
||||
@ -617,7 +616,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent,
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
cancelled = true;
|
||||
break;
|
||||
}
|
||||
@ -638,7 +637,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent,
|
||||
if( destLayer == PCB_LAYER_ID::UNDEFINED_LAYER )
|
||||
{
|
||||
// The user did not pick any layer.
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
cancelled = true;
|
||||
break;
|
||||
}
|
||||
@ -663,7 +662,7 @@ int DRAWING_TOOL::InteractivePlaceWithPreview( const TOOL_EVENT& aEvent,
|
||||
}
|
||||
|
||||
commit.Push( wxT( "Placing items" ) );
|
||||
m_frame->PopTool( tool );
|
||||
m_frame->PopTool( aEvent );
|
||||
|
||||
break;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user