Allow layer switching when routing from pad.
Additionally, don't process layer events from both main loop and transitions -- it makes for a mess. Fixes https://gitlab.com/kicad/code/kicad/issues/4832
This commit is contained in:
parent
f2ac6fcd44
commit
00edc85f4f
|
@ -942,7 +942,8 @@ bool LINE_PLACER::SetLayer( int aLayer )
|
|||
return false;
|
||||
}
|
||||
else if( !m_startItem
|
||||
|| ( m_startItem->OfKind( ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) ) )
|
||||
|| ( m_startItem->OfKind( ITEM::VIA_T ) && m_startItem->Layers().Overlaps( aLayer ) )
|
||||
|| ( m_startItem->OfKind( ITEM::SOLID_T ) && m_startItem->Layers().Overlaps( aLayer ) ) )
|
||||
{
|
||||
m_currentLayer = aLayer;
|
||||
m_head.Line().Clear();
|
||||
|
|
|
@ -479,16 +479,12 @@ void ROUTER::FlipPosture()
|
|||
}
|
||||
|
||||
|
||||
void ROUTER::SwitchLayer( int aLayer )
|
||||
bool ROUTER::SwitchLayer( int aLayer )
|
||||
{
|
||||
switch( m_state )
|
||||
{
|
||||
case ROUTE_TRACK:
|
||||
m_placer->SetLayer( aLayer );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( m_state == ROUTE_TRACK )
|
||||
return m_placer->SetLayer( aLayer );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
|
||||
void FlipPosture();
|
||||
|
||||
void SwitchLayer( int layer );
|
||||
bool SwitchLayer( int layer );
|
||||
|
||||
void ToggleViaPlacement();
|
||||
void SetOrthoMode( bool aEnable );
|
||||
|
|
|
@ -648,7 +648,19 @@ static PCB_LAYER_ID getTargetLayerFromEvent( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int ROUTER_TOOL::onLayerCommand( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
return handleLayerSwitch( aEvent, false );
|
||||
}
|
||||
|
||||
|
||||
int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
return handleLayerSwitch( aEvent, true );
|
||||
}
|
||||
|
||||
|
||||
int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia )
|
||||
{
|
||||
if( !IsToolActive() )
|
||||
return 0;
|
||||
|
@ -701,6 +713,13 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
if( !aForceVia && m_router && m_router->SwitchLayer( targetLayer ) )
|
||||
{
|
||||
updateEndItem( aEvent );
|
||||
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOARD_DESIGN_SETTINGS& bds = board()->GetDesignSettings();
|
||||
const int layerCount = bds.GetCopperLayerCount();
|
||||
|
||||
|
@ -1045,12 +1064,6 @@ void ROUTER_TOOL::performRouting()
|
|||
updateEndItem( *evt );
|
||||
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
||||
}
|
||||
else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
|
||||
{
|
||||
m_router->SwitchLayer( frame()->GetActiveLayer() );
|
||||
updateEndItem( *evt );
|
||||
m_router->Move( m_endSnapPoint, m_endItem ); // refresh
|
||||
}
|
||||
else if( evt->IsAction( &ACT_EndTrack ) || evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
// Stop current routing:
|
||||
|
@ -1739,40 +1752,40 @@ void ROUTER_TOOL::setTransitions()
|
|||
Go( &ROUTER_TOOL::onViaCommand, ACT_SelLayerAndPlaceThroughVia.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, ACT_SelLayerAndPlaceBlindVia.MakeEvent() );
|
||||
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerTop.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner1.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner2.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner3.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner4.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner5.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner6.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner7.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner8.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner9.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner10.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner11.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner12.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner13.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner14.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner15.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner16.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner17.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner18.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner19.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner20.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner21.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner22.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner23.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner24.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner25.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner26.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner27.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner28.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner29.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerInner30.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerBottom.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerNext.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onViaCommand, PCB_ACTIONS::layerPrev.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerTop.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner1.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner2.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner3.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner4.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner5.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner6.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner7.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner8.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner9.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner10.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner11.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner12.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner13.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner14.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner15.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner16.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner17.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner18.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner19.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner20.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner21.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner22.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner23.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner24.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner25.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner26.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner27.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner28.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner29.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerInner30.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerBottom.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerNext.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onLayerCommand, PCB_ACTIONS::layerPrev.MakeEvent() );
|
||||
|
||||
Go( &ROUTER_TOOL::CustomTrackWidthDialog, ACT_CustomTrackWidth.MakeEvent() );
|
||||
Go( &ROUTER_TOOL::onTrackViaSizeChanged, PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
|
||||
|
|
|
@ -60,10 +60,12 @@ private:
|
|||
void breakTrack();
|
||||
|
||||
void handleCommonEvents( const TOOL_EVENT& evt );
|
||||
int handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia );
|
||||
|
||||
int getStartLayer( const PNS::ITEM* aItem );
|
||||
void switchLayerOnViaPlacement();
|
||||
|
||||
int onLayerCommand( const TOOL_EVENT& aEvent );
|
||||
int onViaCommand( const TOOL_EVENT& aEvent );
|
||||
int onTrackViaSizeChanged( const TOOL_EVENT& aEvent );
|
||||
|
||||
|
|
Loading…
Reference in New Issue