diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 1010011386..bedbae12a8 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -209,7 +209,8 @@ ROUTER_TOOL::ROUTER_TOOL() : m_lastTargetLayer( UNDEFINED_LAYER ), m_originalActiveLayer( UNDEFINED_LAYER ), m_inRouterTool( false ), - m_inRouteSelected( false ) + m_inRouteSelected( false ), + m_startWithVia( false ) { } @@ -1311,6 +1312,13 @@ void ROUTER_TOOL::performRouting( VECTOR2D aStartPosition ) // Set initial cursor setCursor(); + // If the user pressed 'V' before starting to route, enable via placement now + if( m_startWithVia ) + { + m_startWithVia = false; + handleLayerSwitch( ACT_PlaceThroughVia.MakeEvent(), true ); + } + while( TOOL_EVENT* evt = Wait() ) { setCursor(); @@ -1767,6 +1775,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent ) m_router->SetMode( mode ); m_cancelled = false; + m_startWithVia = false; if( aEvent.HasPosition() ) m_toolMgr->PrimeTool( aEvent.Position() ); @@ -1834,6 +1843,7 @@ int ROUTER_TOOL::MainLoop( const TOOL_EVENT& aEvent ) } else if( evt->IsAction( &ACT_PlaceThroughVia ) ) { + m_startWithVia = true; m_toolMgr->RunAction( PCB_ACTIONS::layerToggle ); } else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) ) diff --git a/pcbnew/router/router_tool.h b/pcbnew/router/router_tool.h index ac63abd93d..5e763b8fe6 100644 --- a/pcbnew/router/router_tool.h +++ b/pcbnew/router/router_tool.h @@ -103,6 +103,8 @@ private: bool m_inRouterTool; // Re-entrancy guard bool m_inRouteSelected; + + bool m_startWithVia; // User pressed V before routing started }; #endif