Added feature to switch between router modes

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9414
This commit is contained in:
Electro707 2021-10-28 22:46:05 +00:00 committed by Ian McInerney
parent b42fce430d
commit 4afb59fda0
4 changed files with 26 additions and 0 deletions

View File

@ -1239,6 +1239,24 @@ int ROUTER_TOOL::ChangeRouterMode( const TOOL_EVENT& aEvent )
}
int ROUTER_TOOL::CycleRouterMode( const TOOL_EVENT& aEvent )
{
PNS::ROUTING_SETTINGS& settings = m_router->Settings();
PNS::PNS_MODE mode = settings.Mode();
switch( mode )
{
case PNS::RM_MarkObstacles: mode = PNS::RM_Shove; break;
case PNS::RM_Shove: mode = PNS::RM_Walkaround; break;
case PNS::RM_Walkaround: mode = PNS::RM_MarkObstacles; break;
}
settings.SetMode( mode );
return 0;
}
PNS::PNS_MODE ROUTER_TOOL::GetRouterMode()
{
return m_router->Settings().Mode();
@ -2007,6 +2025,7 @@ void ROUTER_TOOL::setTransitions()
Go( &ROUTER_TOOL::ChangeRouterMode, PCB_ACTIONS::routerHighlightMode.MakeEvent() );
Go( &ROUTER_TOOL::ChangeRouterMode, PCB_ACTIONS::routerShoveMode.MakeEvent() );
Go( &ROUTER_TOOL::ChangeRouterMode, PCB_ACTIONS::routerWalkaroundMode.MakeEvent() );
Go( &ROUTER_TOOL::CycleRouterMode, PCB_ACTIONS::cycleRouterMode.MakeEvent() );
Go( &ROUTER_TOOL::InlineDrag, PCB_ACTIONS::routerInlineDrag.MakeEvent() );
Go( &ROUTER_TOOL::InlineBreakTrack, PCB_ACTIONS::inlineBreakTrack.MakeEvent() );

View File

@ -44,6 +44,7 @@ public:
int DpDimensionsDialog( const TOOL_EVENT& aEvent );
int SettingsDialog( const TOOL_EVENT& aEvent );
int ChangeRouterMode( const TOOL_EVENT& aEvent );
int CycleRouterMode( const TOOL_EVENT& aEvent );
int CustomTrackWidthDialog( const TOOL_EVENT& aEvent );
PNS::PNS_MODE GetRouterMode();

View File

@ -1342,6 +1342,11 @@ TOOL_ACTION PCB_ACTIONS::routerWalkaroundMode( "pcbnew.InteractiveRouter.Walkaro
_( "Router Walkaround Mode" ), _( "Switch router to walkaround mode" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) PNS::RM_Walkaround );
TOOL_ACTION PCB_ACTIONS::cycleRouterMode( "pcbnew.InteractiveRouter.CycleRouterMode",
AS_GLOBAL, 0, "",
_( "Cycle Router Mode" ), _( "Cycle router to the next mode" ),
BITMAPS::INVALID_BITMAP);
TOOL_ACTION PCB_ACTIONS::selectLayerPair( "pcbnew.InteractiveRouter.SelectLayerPair",
AS_GLOBAL, 0, "",
_( "Set Layer Pair..." ), _( "Change active layer pair for routing" ),

View File

@ -200,6 +200,7 @@ public:
static TOOL_ACTION routerHighlightMode;
static TOOL_ACTION routerShoveMode;
static TOOL_ACTION routerWalkaroundMode;
static TOOL_ACTION cycleRouterMode;
/// Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION routerInlineDrag;