A more robust fix for 36f1d023f0
.
This one also handles when the events get out-of-order due to them starting out in the Simulation window and not getting dispatched until the mouse goes over the Schematic window. Fixes: lp:1835907 * https://bugs.launchpad.net/kicad/+bug/1835907 Fixes: lp:1836544 * https://bugs.launchpad.net/kicad/+bug/1836544
This commit is contained in:
parent
dad8c9821b
commit
58ca5b71a9
|
@ -430,7 +430,7 @@ void EDA_DRAW_FRAME::PushTool( const std::string& actionName )
|
|||
|
||||
// Human cognitive stacking is very shallow; deeper tool stacks just get annoying
|
||||
if( m_toolStack.size() > 3 )
|
||||
m_toolStack.pop_front();
|
||||
m_toolStack.erase( m_toolStack.begin() );
|
||||
|
||||
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
|
||||
|
||||
|
@ -441,14 +441,24 @@ void EDA_DRAW_FRAME::PushTool( const std::string& actionName )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::PopTool()
|
||||
void EDA_DRAW_FRAME::PopTool( const std::string& actionName )
|
||||
{
|
||||
if( m_toolStack.size() > 0 )
|
||||
m_toolStack.pop_back();
|
||||
// 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.
|
||||
|
||||
if( m_toolStack.size() > 0 )
|
||||
for( size_t i = m_toolStack.size() - 1; i >= 0; --i )
|
||||
{
|
||||
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( m_toolStack.back() );
|
||||
if( m_toolStack[ i ] == actionName )
|
||||
{
|
||||
m_toolStack.erase( m_toolStack.begin() + i );
|
||||
|
||||
// If there's something underneath us, and it's now the top of the stack, then
|
||||
// re-activate it
|
||||
if( ( --i ) >= 0 && i == m_toolStack.size() - 1 )
|
||||
{
|
||||
std::string back = m_toolStack[ i ];
|
||||
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( back );
|
||||
|
||||
if( action )
|
||||
{
|
||||
|
@ -462,6 +472,10 @@ void EDA_DRAW_FRAME::PopTool()
|
|||
}
|
||||
else
|
||||
DisplayToolMsg( ACTIONS::selectionTool.GetLabel() );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,11 +49,6 @@ int COMMON_TOOLS::SelectionTool( const TOOL_EVENT& aEvent )
|
|||
// just a cancel of whatever other tools might be running.
|
||||
|
||||
m_toolMgr->ProcessEvent( TOOL_EVENT( TC_COMMAND, TA_CANCEL_TOOL ) );
|
||||
|
||||
// Shouldn't be necessary, but as the Irish would say: "just to be sure to be sure"
|
||||
while( !m_frame->ToolStackIsEmpty() )
|
||||
m_frame->PopTool();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ void ZOOM_TOOL::Reset( RESET_REASON aReason )
|
|||
|
||||
int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
while( TOOL_EVENT* evt = Wait() )
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Exit zoom tool
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,8 @@ int CVPCB_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
auto& controls = *getViewControls();
|
||||
auto previous_settings = controls.GetSettings();
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
|
||||
|
@ -141,7 +142,7 @@ int CVPCB_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
clearRuler();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ int CVPCB_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,6 @@ int EE_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
resetPicker();
|
||||
controls->ForceCursorPosition( false );
|
||||
m_frame->PopTool();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -102,7 +103,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +119,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +240,8 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
LIB_PART* part = m_frame->GetCurPart();
|
||||
|
@ -270,7 +272,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +293,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +385,8 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->ShowCursor( true );
|
||||
getViewControls()->SetSnapping( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -393,12 +396,12 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsActivate() )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsClick( BUT_LEFT ) )
|
||||
|
|
|
@ -282,7 +282,8 @@ int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
|
@ -333,7 +334,8 @@ int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,8 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
controls->ShowCursor( true );
|
||||
|
@ -282,7 +283,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
m_frame->OnModify();
|
||||
|
||||
m_moveInProgress = false;
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,8 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
m_selectionTool->AddItemToSel( component );
|
||||
}
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -131,7 +132,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +148,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +248,8 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
m_view->AddToPreview( image->Clone() );
|
||||
}
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -275,13 +277,13 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
|
||||
if( immediateMode )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -297,7 +299,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -350,7 +352,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( immediateMode )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +428,8 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_view->ClearPreview();
|
||||
m_view->AddToPreview( previewItem->Clone() );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -441,7 +444,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsActivate() )
|
||||
|
@ -453,7 +456,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -505,7 +508,8 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -531,7 +535,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -551,7 +555,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -692,7 +696,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -720,7 +725,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -740,7 +745,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -944,7 +944,8 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
|
@ -1006,7 +1007,8 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -478,14 +478,16 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
m_frame->GetCanvas()->SetCursor( SIMULATION_CURSORS::GetCursor( SIMULATION_CURSORS::CURSOR::PROBE ) );
|
||||
|
||||
picker->SetClickHandler( std::bind( probeSimulation, m_frame, std::placeholders::_1 ) );
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -520,14 +522,16 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
m_frame->GetCanvas()->SetCursor( SIMULATION_CURSORS::GetCursor( SIMULATION_CURSORS::CURSOR::TUNE ) );
|
||||
|
||||
picker->SetClickHandler( std::bind( tuneSimulation, m_frame, std::placeholders::_1 ) );
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
#endif /* KICAD_SPICE */
|
||||
|
@ -686,13 +690,15 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
picker->SetClickHandler( std::bind( highlightNet, m_toolMgr, std::placeholders::_1 ) );
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,8 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
|||
if( aEvent.HasPosition() )
|
||||
getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
if( aEvent.HasPosition() )
|
||||
{
|
||||
|
@ -265,7 +266,7 @@ int SCH_LINE_WIRE_BUS_TOOL::DrawSegments( const TOOL_EVENT& aEvent )
|
|||
segment = startSegments( layer, cursorPos );
|
||||
}
|
||||
|
||||
return doDrawSegments( layer, segment );
|
||||
return doDrawSegments( tool, layer, segment );
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,7 +278,8 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
if( netPtr )
|
||||
|
@ -313,10 +315,10 @@ 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( LAYER_WIRE, segment );
|
||||
return doDrawSegments( tool, LAYER_WIRE, segment );
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +439,7 @@ static void computeBreakPoint( SCH_SCREEN* aScreen, SCH_LINE* aSegment, wxPoint&
|
|||
}
|
||||
|
||||
|
||||
int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
||||
int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, SCH_LINE* aSegment )
|
||||
{
|
||||
bool forceHV = m_frame->GetForceHVLines();
|
||||
SCH_SCREEN* screen = m_frame->GetScreen();
|
||||
|
@ -486,7 +488,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( aTool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +504,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( aTool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
int AddJunctionsIfNeeded( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
int doDrawSegments( int aType, SCH_LINE* aSegment );
|
||||
int doDrawSegments( const std::string& aTool, int aType, SCH_LINE* aSegment );
|
||||
SCH_LINE* startSegments( int aType, const VECTOR2D& aPos );
|
||||
SCH_LINE* doUnfoldBus( const wxString& aNet );
|
||||
void finishSegments();
|
||||
|
|
|
@ -119,7 +119,8 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
else
|
||||
return 0;
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
|
||||
if( m_moveInProgress )
|
||||
{
|
||||
|
@ -448,7 +449,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_dragAdditions.clear();
|
||||
m_moveInProgress = false;
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -574,7 +574,8 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
auto& controls = *getViewControls();
|
||||
auto previous_settings = controls.GetSettings();
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
|
||||
|
@ -607,7 +608,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
clearRuler();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +625,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ protected:
|
|||
/// Tool ID of previously active draw tool bar button.
|
||||
int m_lastDrawToolId; // JEY TODO: remove this; it doesn't work in modern toolset anyway
|
||||
|
||||
std::deque<std::string> m_toolStack; // stack of user-level "tools". Used to temporarily
|
||||
std::vector<std::string> m_toolStack; // stack of user-level "tools". Used to temporarily
|
||||
// invoke an immediate-mode action. Note that these
|
||||
// are "tools" in the UI sense, which are actually
|
||||
// TOOL_ACTIONs internally
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
* 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();
|
||||
virtual void PopTool( const std::string& actionName );
|
||||
|
||||
bool ToolStackIsEmpty() { return m_toolStack.empty(); }
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -108,7 +109,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +125,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +197,8 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
|
||||
getViewControls()->ShowCursor( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Prime the pump
|
||||
|
@ -277,7 +279,7 @@ int PL_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
getViewControls()->CaptureCursor( item != nullptr );
|
||||
}
|
||||
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,8 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
controls->ShowCursor( true );
|
||||
|
@ -247,7 +248,7 @@ int PL_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
m_frame->OnModify();
|
||||
|
||||
m_moveInProgress = false;
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -340,7 +341,8 @@ int PL_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
PL_PICKER_TOOL* picker = m_toolMgr->GetTool<PL_PICKER_TOOL>();
|
||||
|
@ -399,7 +401,8 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ int PL_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
resetPicker();
|
||||
controls->ForceCursorPosition( false );
|
||||
m_frame->PopTool();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,8 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
// Deselect all items
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
frame()->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
frame()->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
m_router->SetMode( aEvent.Parameter<PNS::ROUTER_MODE>() );
|
||||
|
@ -306,7 +307,7 @@ int LENGTH_TUNER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
m_savedSettings = m_router->Settings();
|
||||
m_savedSizes = m_router->Sizes();
|
||||
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -869,7 +869,8 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
// Deselect all items
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
m_router->SetMode( mode );
|
||||
|
@ -894,7 +895,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
frame->PopTool();
|
||||
frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsActivate() )
|
||||
|
@ -906,7 +907,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
frame->PopTool();
|
||||
frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -964,7 +965,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( m_cancelled )
|
||||
{
|
||||
frame->PopTool();
|
||||
frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,10 +145,11 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
|
|||
if( aEvent.HasPosition() )
|
||||
startingPoint = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
while( drawSegment( S_SEGMENT, line, startingPoint ) )
|
||||
while( drawSegment( tool, S_SEGMENT, line, startingPoint ) )
|
||||
{
|
||||
if( line )
|
||||
{
|
||||
|
@ -188,10 +189,11 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
|
|||
if( aEvent.HasPosition() )
|
||||
startingPoint = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
while( drawSegment( S_CIRCLE, circle, startingPoint ) )
|
||||
while( drawSegment( tool, S_CIRCLE, circle, startingPoint ) )
|
||||
{
|
||||
if( circle )
|
||||
{
|
||||
|
@ -226,10 +228,11 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
|
|||
|
||||
arc->SetFlags( IS_NEW );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
while( drawArc( arc, immediateMode ) )
|
||||
while( drawArc( tool, arc, immediateMode ) )
|
||||
{
|
||||
if( arc )
|
||||
{
|
||||
|
@ -266,7 +269,8 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
|
||||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::TEXT );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
bool reselect = false;
|
||||
|
@ -299,7 +303,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +319,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -472,7 +476,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
|
||||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::DIMENSION );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
enum DIMENSION_STEPS
|
||||
|
@ -517,7 +522,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +542,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +754,8 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_view->Update( &preview );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -762,7 +768,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
preview.FreeItems();
|
||||
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsMotion() )
|
||||
|
@ -827,7 +833,8 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
|||
|
||||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::ANCHOR );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
m_controls->ShowCursor( true );
|
||||
|
@ -854,7 +861,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
|||
|
||||
// Usually, we do not need to change twice the anchor position,
|
||||
// so deselect the active tool
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
else if( evt->IsClick( BUT_RIGHT ) )
|
||||
|
@ -863,7 +870,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -872,7 +879,8 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, OPT<VECTOR2D> aStartingPoint )
|
||||
bool DRAWING_TOOL::drawSegment( const std::string& aTool, int aShape, DRAWSEGMENT*& aGraphic,
|
||||
OPT<VECTOR2D> aStartingPoint )
|
||||
{
|
||||
// Only two shapes are currently supported
|
||||
assert( aShape == S_SEGMENT || aShape == S_CIRCLE );
|
||||
|
@ -956,7 +964,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, OPT<VECTOR2D
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( aTool );
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
|
@ -982,7 +990,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, OPT<VECTOR2D
|
|||
if( started )
|
||||
cleanup();
|
||||
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( aTool );
|
||||
cancelled = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1135,7 +1143,7 @@ static void updateArcFromConstructionMgr( const KIGFX::PREVIEW::ARC_GEOM_MANAGER
|
|||
}
|
||||
|
||||
|
||||
bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic, bool aImmediateMode )
|
||||
bool DRAWING_TOOL::drawArc( const std::string& aTool, DRAWSEGMENT*& aGraphic, bool aImmediateMode )
|
||||
{
|
||||
m_lineWidth = getSegmentWidth( getDrawingLayer() );
|
||||
|
||||
|
@ -1188,7 +1196,7 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic, bool aImmediateMode )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( aTool );
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
|
@ -1214,7 +1222,7 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic, bool aImmediateMode )
|
|||
if( firstPoint )
|
||||
cleanup();
|
||||
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( aTool );
|
||||
cancelled = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1387,7 +1395,8 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
|||
// hands the calculated points over to the zone creator tool
|
||||
POLYGON_GEOM_MANAGER polyGeomMgr( zoneTool );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate(); // register for events
|
||||
|
||||
m_controls->ShowCursor( true );
|
||||
|
@ -1427,7 +1436,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1447,7 +1456,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1814,9 +1823,9 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
|||
VIA_PLACER placer( frame() );
|
||||
|
||||
SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::VIA );
|
||||
frame()->PushTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
doInteractiveItemPlacement( &placer, _( "Place via" ), IPO_REPEAT | IPO_SINGLE_CLICK );
|
||||
doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer, _( "Place via" ),
|
||||
IPO_REPEAT | IPO_SINGLE_CLICK );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -164,14 +164,15 @@ private:
|
|||
///> and its settings (width, layer) set to the current default values.
|
||||
///> @return False if the tool was cancelled before the origin was set or origin and end are
|
||||
///> the same point.
|
||||
bool drawSegment( int aShape, DRAWSEGMENT*& aGraphic, OPT<VECTOR2D> aStartingPoint );
|
||||
bool drawSegment( const std::string& aTool, int aShape, DRAWSEGMENT*& aGraphic,
|
||||
OPT<VECTOR2D> aStartingPoint );
|
||||
|
||||
///> Starts drawing an arc.
|
||||
///> @param aGraphic is an object that is going to be used by the tool for drawing. It has to
|
||||
///> be already created. The tool deletes the object if it is not added to a BOARD.
|
||||
///> @return False if the tool was cancelled before the origin was set or origin and end are
|
||||
///> the same point.
|
||||
bool drawArc( DRAWSEGMENT*& aGraphic, bool aImmediateMode );
|
||||
bool drawArc( const std::string& aTool, DRAWSEGMENT*& aGraphic, bool aImmediateMode );
|
||||
|
||||
/**
|
||||
* Draws a polygon, that is added as a zone or a keepout area.
|
||||
|
|
|
@ -269,7 +269,8 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( selection.Empty() )
|
||||
return 0;
|
||||
|
||||
editFrame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
editFrame->PushTool( tool );
|
||||
Activate();
|
||||
controls->ShowCursor( true );
|
||||
controls->SetAutoPan( true );
|
||||
|
@ -506,7 +507,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
m_commit->Push( _( "Drag" ) );
|
||||
}
|
||||
|
||||
editFrame->PopTool();
|
||||
editFrame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1117,7 +1118,8 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
auto& view = *getView();
|
||||
auto& controls = *getViewControls();
|
||||
|
||||
frame()->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
frame()->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
EDA_UNITS_T units = frame()->GetUserUnits();
|
||||
|
@ -1157,7 +1159,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
clearRuler();
|
||||
else
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1174,7 +1176,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -313,9 +313,7 @@ int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
|
|||
|
||||
PAD_PLACER placer;
|
||||
|
||||
frame()->PushTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
doInteractiveItemPlacement( &placer, _( "Place pad" ),
|
||||
doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer, _( "Place pad" ),
|
||||
IPO_REPEAT | IPO_SINGLE_CLICK | IPO_ROTATE | IPO_FLIP );
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -90,9 +90,8 @@ int MICROWAVE_TOOL::addMicrowaveFootprint( const TOOL_EVENT& aEvent )
|
|||
|
||||
MICROWAVE_PLACER placer( frame, aEvent.Parameter<intptr_t>() );
|
||||
|
||||
frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
|
||||
doInteractiveItemPlacement( &placer, _( "Place microwave feature" ),
|
||||
doInteractiveItemPlacement( aEvent.GetCommandStr().get(), &placer,
|
||||
_( "Place microwave feature" ),
|
||||
IPO_REPEAT | IPO_ROTATE | IPO_FLIP );
|
||||
|
||||
return 0;
|
||||
|
@ -150,7 +149,8 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
|||
KIGFX::VIEW_CONTROLS& controls = *getViewControls();
|
||||
auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
|
||||
|
||||
frame.PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
frame.PushTool( tool );
|
||||
Activate();
|
||||
|
||||
TWO_POINT_GEOMETRY_MANAGER tpGeomMgr;
|
||||
|
@ -189,7 +189,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
frame.PopTool();
|
||||
frame.PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
frame.PopTool();
|
||||
frame.PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -328,7 +328,8 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
|||
if( settingsDlg.ShowModal() != wxID_OK )
|
||||
return 0;
|
||||
|
||||
frame()->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
frame()->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
GENERAL_COLLECTOR collector;
|
||||
|
@ -370,7 +371,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
commit.Revert();
|
||||
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -378,7 +379,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
commit.Push( _( "Renumber pads" ) );
|
||||
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -478,7 +479,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
|
|||
evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
commit.Push( _( "Renumber pads" ) );
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -649,7 +649,8 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
|||
controls->ShowCursor( true );
|
||||
controls->SetSnapping( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
VECTOR2I cursorPos = controls->GetCursorPosition();
|
||||
|
@ -686,7 +687,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
|||
cleanup();
|
||||
else
|
||||
{
|
||||
m_frame->PopTool();
|
||||
m_frame->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +704,7 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -858,7 +859,8 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
controls->SetSnapping( true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
// Main loop: keep receiving events
|
||||
|
@ -869,7 +871,7 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -882,7 +884,7 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( tool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1118,7 +1120,8 @@ void PCB_EDITOR_CONTROL::DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* a
|
|||
|
||||
int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||
|
@ -1133,7 +1136,8 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1304,7 +1308,8 @@ int PCB_EDITOR_CONTROL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
|||
highlightNet( getViewControls()->GetMousePosition(), use_selection );
|
||||
}
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||
|
@ -1318,7 +1323,8 @@ int PCB_EDITOR_CONTROL::HighlightNetTool( const TOOL_EVENT& aEvent )
|
|||
picker->SetLayerSet( LSET::AllCuMask() );
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1372,7 +1378,8 @@ static bool showLocalRatsnest( TOOL_MANAGER* aToolMgr, BOARD* aBoard, bool aShow
|
|||
|
||||
int PCB_EDITOR_CONTROL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
auto picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||
|
@ -1398,7 +1405,8 @@ int PCB_EDITOR_CONTROL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,14 @@
|
|||
#include "pcb_actions.h"
|
||||
#include "tool_event_utils.h"
|
||||
|
||||
void PCB_TOOL_BASE::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
|
||||
void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
|
||||
INTERACTIVE_PLACER_BASE* aPlacer,
|
||||
const wxString& aCommitMessage, int aOptions )
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
std::unique_ptr<BOARD_ITEM> newItem;
|
||||
|
||||
frame()->PushTool( aTool );
|
||||
Activate();
|
||||
|
||||
BOARD_COMMIT commit( frame() );
|
||||
|
@ -100,14 +102,14 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer
|
|||
if( aOptions & IPO_SINGLE_CLICK )
|
||||
{
|
||||
cleanup();
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( aTool );
|
||||
break;
|
||||
}
|
||||
else if( newItem )
|
||||
cleanup();
|
||||
else
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( aTool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +129,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer
|
|||
}
|
||||
else
|
||||
{
|
||||
frame()->PopTool();
|
||||
frame()->PopTool( aTool );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ protected:
|
|||
* @param aItemCreator the callable that will attempt to create the item
|
||||
* @param aCommitMessage the message used on a successful commit
|
||||
*/
|
||||
void doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE *aPlacer,
|
||||
void doInteractiveItemPlacement( const std::string& aTool, INTERACTIVE_PLACER_BASE *aPlacer,
|
||||
const wxString& aCommitMessage,
|
||||
int aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT );
|
||||
|
||||
|
|
|
@ -450,7 +450,8 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||
|
@ -464,7 +465,8 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -486,7 +488,8 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
m_frame->PushTool( aEvent.GetCommandStr().get() );
|
||||
std::string tool = aEvent.GetCommandStr().get();
|
||||
m_frame->PushTool( tool );
|
||||
Activate();
|
||||
|
||||
PCBNEW_PICKER_TOOL* picker = m_toolMgr->GetTool<PCBNEW_PICKER_TOOL>();
|
||||
|
@ -551,7 +554,8 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|||
|
||||
picker->Activate();
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
|
||||
m_frame->PopTool( tool );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,6 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
reset();
|
||||
controls->ForceCursorPosition( false );
|
||||
frame()->PopTool();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,9 +169,9 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
|
|||
{
|
||||
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
|
||||
Wait();
|
||||
// Picker calls PopTool() so that it gets done before activating tool's PushTool()
|
||||
}
|
||||
|
||||
frame()->PopTool( "pcbnew.PositionRelative.selectReferenceItem" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue