diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index ae4da6d90d..912e651c14 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1696,20 +1696,19 @@ void PNS_KICAD_IFACE::Commit() EraseView(); - for( auto fpOffset : m_fpOffsets ) + for( const std::pair& 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(); - - VECTOR2I p_orig = footprint->GetPosition(); - VECTOR2I p_new = p_orig + offset; + VECTOR2I p_orig = footprint->GetPosition(); + VECTOR2I p_new = p_orig + offset; if( processedFootprints.find( footprint ) != processedFootprints.end() ) continue; processedFootprints.insert( footprint ); m_commit->Modify( footprint ); - footprint->SetPosition( wxPoint( p_new.x, p_new.y ) ); + footprint->SetPosition( p_new ); } m_fpOffsets.clear(); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 31c9b0241a..5b61f2e8b9 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -590,7 +590,7 @@ void ROUTER_TOOL::saveRouterDebugLog() 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" ); } @@ -608,14 +608,15 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent ) switch( aEvent.KeyCode() ) { - case '0': + case '0': if( !ADVANCED_CFG::GetCfg().m_ShowRouterDebugGraphics ) return; saveRouterDebugLog(); aEvent.SetPassEvent( false ); break; - default: + + default: break; } } @@ -641,15 +642,13 @@ int ROUTER_TOOL::getStartLayer( const PNS::ITEM* aItem ) void ROUTER_TOOL::switchLayerOnViaPlacement() { - int al = frame()->GetActiveLayer(); - int cl = m_router->GetCurrentLayer(); + int activeLayer = frame()->GetActiveLayer(); + int currentLayer = m_router->GetCurrentLayer(); - if( cl != al ) - { - m_router->SwitchLayer( al ); - } + if( currentLayer != activeLayer ) + m_router->SwitchLayer( activeLayer ); - std::optional newLayer = m_router->Sizes().PairedLayer( cl ); + std::optional newLayer = m_router->Sizes().PairedLayer( currentLayer ); if( !newLayer ) 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 ) { if( !m_router->IsPlacingVia() ) + { return handleLayerSwitch( aEvent, true ); + } else { m_router->ToggleViaPlacement(); @@ -938,9 +939,7 @@ int ROUTER_TOOL::handleLayerSwitch( const TOOL_EVENT& aEvent, bool aForceVia ) LSET not_allowed_ly = LSET::AllNonCuMask(); if( viaType != VIATYPE::THROUGH ) - { not_allowed_ly.set( currentLayer ); - } 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. targetLayer = PCB_LAYER_ID( currentLayer + 1 ); } + break; case VIATYPE::BLIND_BURIED: @@ -1320,9 +1320,7 @@ void ROUTER_TOOL::performRouting() bool forceFinish = evt->Modifier( MD_SHIFT ); if( m_router->FixRoute( m_endSnapPoint, m_endItem, forceFinish ) ) - { break; - } if( needLayerSwitch ) switchLayerOnViaPlacement(); @@ -1522,7 +1520,9 @@ int ROUTER_TOOL::RouteSelected( const TOOL_EVENT& aEvent ) itemList.push_back( pad ); } else if( dynamic_cast( item ) != nullptr ) + { itemList.push_back( static_cast( item ) ); + } } std::shared_ptr connectivity = frame->GetBoard()->GetConnectivity();