Browse Source

Move footprint when selecting locked pad

Prompting to unlock is obtrusive and blocks the common action of
dragging from a pad to align footprints.  The less common action of
editing pads in layout can be accomplished after unlocking the pads

Fixes https://gitlab.com/kicad/code/kicad/issues/6997
6.0.7
Seth Hillbrand 5 years ago
parent
commit
9424d66d22
  1. 14
      pcbnew/tools/edit_tool.cpp
  2. 6
      pcbnew/tools/grid_helper.cpp

14
pcbnew/tools/edit_tool.cpp

@ -333,6 +333,8 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{
std::set<BOARD_ITEM*> to_add;
// Iterate from the back so we don't have to worry about removals.
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
{
@ -340,7 +342,19 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference )
if( item->Type() == PCB_MARKER_T )
aCollector.Remove( item );
/// Locked pads do not get moved independently of the footprint
if( item->Type() == PCB_PAD_T && item->IsLocked() )
{
if( !aCollector.HasItem( item->GetParent() ) )
to_add.insert( item->GetParent() );
aCollector.Remove( item );
}
}
for( BOARD_ITEM* item : to_add )
aCollector.Append( item );
},
true /* prompt user regarding locked items */ );

6
pcbnew/tools/grid_helper.cpp

@ -415,7 +415,11 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
auto handlePadShape =
[&]( PAD* aPad )
{
addAnchor( aPad->GetPosition(), CORNER | SNAPPABLE, aPad );
addAnchor( aPad->GetPosition(), ORIGIN | SNAPPABLE, aPad );
/// If we are getting a drag point, we don't want to center the edge of pads
if( aFrom )
return;
const std::shared_ptr<SHAPE> eshape = aPad->GetEffectiveShape( aPad->GetLayer() );

Loading…
Cancel
Save