From 51f02ecc5182113c4d3a4897910debff9574df21 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 8 Jan 2021 13:18:52 -0800 Subject: [PATCH] Fix alignment tool with locked footprints --- pcbnew/tools/placement_tool.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/placement_tool.cpp b/pcbnew/tools/placement_tool.cpp index 7143ca00a0..e6b5b5b522 100644 --- a/pcbnew/tools/placement_tool.cpp +++ b/pcbnew/tools/placement_tool.cpp @@ -66,7 +66,7 @@ bool ALIGN_DISTRIBUTE_TOOL::Init() m_placementMenu->Add( PCB_ACTIONS::alignLeft ); m_placementMenu->Add( PCB_ACTIONS::alignCenterX ); m_placementMenu->Add( PCB_ACTIONS::alignRight ); - + m_placementMenu->AppendSeparator(); m_placementMenu->Add( PCB_ACTIONS::alignTop ); m_placementMenu->Add( PCB_ACTIONS::alignCenterY ); @@ -162,7 +162,19 @@ size_t ALIGN_DISTRIBUTE_TOOL::GetSelections( ALIGNMENT_RECTS& aItemsToAlign, BOARD_ITEM* boardItem = static_cast( item ); if( boardItem->IsLocked() ) - lockedItems.push_back( boardItem ); + { + // Locking a pad but not the footprint means that we align the footprint using + // the pad position. So we test for footprint locking here + if( m_frame->IsType( FRAME_PCB_EDITOR ) && boardItem->Type() == PCB_PAD_T + && !boardItem->GetParent()->IsLocked() ) + { + itemsToAlign.push_back( boardItem ); + } + else + { + lockedItems.push_back( boardItem ); + } + } else itemsToAlign.push_back( boardItem ); }