ADDED: TOOL_ACTION for switching PNS router mode.

Fixes https://gitlab.com/kicad/code/kicad/issues/2249
This commit is contained in:
Michael Kavanagh 2020-04-19 15:39:16 +01:00 committed by Ian McInerney
parent b2cd66f0a3
commit 7db355e34a
4 changed files with 35 additions and 3 deletions

View File

@ -895,6 +895,17 @@ int ROUTER_TOOL::SettingsDialog( const TOOL_EVENT& aEvent )
}
int ROUTER_TOOL::ChangeRouterMode( const TOOL_EVENT& aEvent )
{
PNS::PNS_MODE mode = aEvent.Parameter<PNS::PNS_MODE>();
PNS::ROUTING_SETTINGS& settings = m_router->Settings();
settings.SetMode( mode );
return 0;
}
void ROUTER_TOOL::breakTrack()
{
if( m_startItem && m_startItem->OfKind( PNS::ITEM::SEGMENT_T ) )
@ -1358,6 +1369,9 @@ void ROUTER_TOOL::setTransitions()
Go( &ROUTER_TOOL::MainLoop, PCB_ACTIONS::routeDiffPair.MakeEvent() );
Go( &ROUTER_TOOL::DpDimensionsDialog, PCB_ACTIONS::routerDiffPairDialog.MakeEvent() );
Go( &ROUTER_TOOL::SettingsDialog, PCB_ACTIONS::routerSettingsDialog.MakeEvent() );
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::InlineDrag, PCB_ACTIONS::routerInlineDrag.MakeEvent() );
Go( &ROUTER_TOOL::InlineBreakTrack, PCB_ACTIONS::inlineBreakTrack.MakeEvent() );
@ -1370,5 +1384,3 @@ void ROUTER_TOOL::setTransitions()
Go( &ROUTER_TOOL::CustomTrackWidthDialog, ACT_CustomTrackWidth.MakeEvent() );
Go( &ROUTER_TOOL::onTrackViaSizeChanged, PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
}

View File

@ -43,6 +43,7 @@ public:
int SelectCopperLayerPair( const TOOL_EVENT& aEvent );
int DpDimensionsDialog( const TOOL_EVENT& aEvent );
int SettingsDialog( const TOOL_EVENT& aEvent );
int ChangeRouterMode( const TOOL_EVENT& aEvent );
int CustomTrackWidthDialog( const TOOL_EVENT& aEvent );
void setTransitions() override;

View File

@ -30,6 +30,7 @@
#include <microwave/microwave_tool.h>
#include <tool/tool_manager.h>
#include <router/pns_router.h>
#include <router/pns_routing_settings.h>
OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
{
@ -1120,6 +1121,21 @@ TOOL_ACTION PCB_ACTIONS::routerDiffPairDialog( "pcbnew.InteractiveRouter.DiffPai
_( "Differential Pair Dimensions..." ), _( "Open Differential Pair Dimension settings" ),
ps_diff_pair_gap_xpm );
TOOL_ACTION PCB_ACTIONS::routerHighlightMode( "pcbnew.InteractiveRouter.HighlightMode",
AS_GLOBAL, 0, "",
_( "Router Highlight Mode" ), _( "Switch router to highlight mode" ),
nullptr, AF_NONE, (void*) PNS::RM_MarkObstacles );
TOOL_ACTION PCB_ACTIONS::routerShoveMode( "pcbnew.InteractiveRouter.ShoveMode",
AS_GLOBAL, 0, "",
_( "Router Shove Mode" ), _( "Switch router to shove mode" ),
nullptr, AF_NONE, (void*) PNS::RM_Shove );
TOOL_ACTION PCB_ACTIONS::routerWalkaroundMode( "pcbnew.InteractiveRouter.WalkaroundMode",
AS_GLOBAL, 0, "",
_( "Router Walkaround Mode" ), _( "Switch router to walkaround mode" ),
nullptr, AF_NONE, (void*) PNS::RM_Walkaround );
TOOL_ACTION PCB_ACTIONS::selectLayerPair( "pcbnew.InteractiveRouter.SelectLayerPair",
AS_GLOBAL, 0, "",
_( "Set Layer Pair..." ), _( "Change active layer pair for routing" ),
@ -1176,4 +1192,3 @@ TOOL_ACTION PCB_ACTIONS::dragFreeAngle( "pcbnew.InteractiveRouter.DragFreeAngle"
_( "Drag (free angle)" ),
_( "Drags the nearest joint in the track without restricting the track angle." ),
move_xpm );

View File

@ -184,6 +184,10 @@ public:
static TOOL_ACTION routerSettingsDialog;
static TOOL_ACTION routerDiffPairDialog;
/// Actions to enable switching modes via hotkey assignments
static TOOL_ACTION routerHighlightMode;
static TOOL_ACTION routerShoveMode;
static TOOL_ACTION routerWalkaroundMode;
/// Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION routerInlineDrag;