Cleanup.
This commit is contained in:
parent
de5980b92e
commit
b01bf081d8
|
@ -1696,20 +1696,19 @@ void PNS_KICAD_IFACE::Commit()
|
||||||
|
|
||||||
EraseView();
|
EraseView();
|
||||||
|
|
||||||
for( auto fpOffset : m_fpOffsets )
|
for( const std::pair<const PAD*, OFFSET>& fpOffset : m_fpOffsets )
|
||||||
{
|
{
|
||||||
VECTOR2I offset = fpOffset.second.p_new - fpOffset.second.p_old;
|
VECTOR2I offset = fpOffset.second.p_new - fpOffset.second.p_old;
|
||||||
FOOTPRINT* footprint = fpOffset.first->GetParent();
|
FOOTPRINT* footprint = fpOffset.first->GetParent();
|
||||||
|
VECTOR2I p_orig = footprint->GetPosition();
|
||||||
VECTOR2I p_orig = footprint->GetPosition();
|
VECTOR2I p_new = p_orig + offset;
|
||||||
VECTOR2I p_new = p_orig + offset;
|
|
||||||
|
|
||||||
if( processedFootprints.find( footprint ) != processedFootprints.end() )
|
if( processedFootprints.find( footprint ) != processedFootprints.end() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
processedFootprints.insert( footprint );
|
processedFootprints.insert( footprint );
|
||||||
m_commit->Modify( footprint );
|
m_commit->Modify( footprint );
|
||||||
footprint->SetPosition( wxPoint( p_new.x, p_new.y ) );
|
footprint->SetPosition( p_new );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fpOffsets.clear();
|
m_fpOffsets.clear();
|
||||||
|
|
|
@ -590,7 +590,7 @@ void ROUTER_TOOL::saveRouterDebugLog()
|
||||||
|
|
||||||
pcb_io.Save( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr );
|
pcb_io.Save( fname_dump.GetFullPath(), m_iface->GetBoard(), nullptr );
|
||||||
|
|
||||||
auto prj = m_iface->GetBoard()->GetProject();
|
PROJECT* prj = m_iface->GetBoard()->GetProject();
|
||||||
prj->GetProjectFile().SaveAs( cwd, "pns" );
|
prj->GetProjectFile().SaveAs( cwd, "pns" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,14 +608,15 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
switch( aEvent.KeyCode() )
|
switch( aEvent.KeyCode() )
|
||||||
{
|
{
|
||||||
case '0':
|
case '0':
|
||||||
if( !ADVANCED_CFG::GetCfg().m_ShowRouterDebugGraphics )
|
if( !ADVANCED_CFG::GetCfg().m_ShowRouterDebugGraphics )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
saveRouterDebugLog();
|
saveRouterDebugLog();
|
||||||
aEvent.SetPassEvent( false );
|
aEvent.SetPassEvent( false );
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,15 +642,13 @@ int ROUTER_TOOL::getStartLayer( const PNS::ITEM* aItem )
|
||||||
|
|
||||||
void ROUTER_TOOL::switchLayerOnViaPlacement()
|
void ROUTER_TOOL::switchLayerOnViaPlacement()
|
||||||
{
|
{
|
||||||
int al = frame()->GetActiveLayer();
|
int activeLayer = frame()->GetActiveLayer();
|
||||||
int cl = m_router->GetCurrentLayer();
|
int currentLayer = m_router->GetCurrentLayer();
|
||||||
|
|
||||||
if( cl != al )
|
if( currentLayer != activeLayer )
|
||||||
{
|
m_router->SwitchLayer( activeLayer );
|
||||||
m_router->SwitchLayer( al );
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<int> newLayer = m_router->Sizes().PairedLayer( cl );
|
std::optional<int> newLayer = m_router->Sizes().PairedLayer( currentLayer );
|
||||||
|
|
||||||
if( !newLayer )
|
if( !newLayer )
|
||||||
newLayer = m_router->Sizes().GetLayerTop();
|
newLayer = m_router->Sizes().GetLayerTop();
|
||||||
|
@ -825,7 +824,9 @@ int ROUTER_TOOL::onLayerCommand( const TOOL_EVENT& aEvent )
|
||||||
int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( !m_router->IsPlacingVia() )
|
if( !m_router->IsPlacingVia() )
|
||||||
|
{
|
||||||
return handleLayerSwitch( aEvent, true );
|
return handleLayerSwitch( aEvent, true );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_router->ToggleViaPlacement();
|
m_router->ToggleViaPlacement();
|
||||||
|
@ -938,9 +939,7 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia )
|
||||||
LSET not_allowed_ly = LSET::AllNonCuMask();
|
LSET not_allowed_ly = LSET::AllNonCuMask();
|
||||||
|
|
||||||
if( viaType != VIATYPE::THROUGH )
|
if( viaType != VIATYPE::THROUGH )
|
||||||
{
|
|
||||||
not_allowed_ly.set( currentLayer );
|
not_allowed_ly.set( currentLayer );
|
||||||
}
|
|
||||||
|
|
||||||
if( viaType == VIATYPE::MICROVIA )
|
if( viaType == VIATYPE::MICROVIA )
|
||||||
{
|
{
|
||||||
|
@ -1037,6 +1036,7 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia )
|
||||||
// but at this point we do not know what the user want.
|
// but at this point we do not know what the user want.
|
||||||
targetLayer = PCB_LAYER_ID( currentLayer + 1 );
|
targetLayer = PCB_LAYER_ID( currentLayer + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIATYPE::BLIND_BURIED:
|
case VIATYPE::BLIND_BURIED:
|
||||||
|
@ -1320,9 +1320,7 @@ void ROUTER_TOOL::performRouting()
|
||||||
bool forceFinish = evt->Modifier( MD_SHIFT );
|
bool forceFinish = evt->Modifier( MD_SHIFT );
|
||||||
|
|
||||||
if( m_router->FixRoute( m_endSnapPoint, m_endItem, forceFinish ) )
|
if( m_router->FixRoute( m_endSnapPoint, m_endItem, forceFinish ) )
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
if( needLayerSwitch )
|
if( needLayerSwitch )
|
||||||
switchLayerOnViaPlacement();
|
switchLayerOnViaPlacement();
|
||||||
|
@ -1522,7 +1520,9 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent )
|
||||||
itemList.push_back( pad );
|
itemList.push_back( pad );
|
||||||
}
|
}
|
||||||
else if( dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) != nullptr )
|
else if( dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) != nullptr )
|
||||||
|
{
|
||||||
itemList.push_back( static_cast<BOARD_CONNECTED_ITEM*>( item ) );
|
itemList.push_back( static_cast<BOARD_CONNECTED_ITEM*>( item ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CONNECTIVITY_DATA> connectivity = frame->GetBoard()->GetConnectivity();
|
std::shared_ptr<CONNECTIVITY_DATA> connectivity = frame->GetBoard()->GetConnectivity();
|
||||||
|
|
Loading…
Reference in New Issue