Clean up some things about pad locking

Allow selecting pads on a locked footprint (but not editing)
Don't create point editor for pads that should be locked

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5829
This commit is contained in:
Jon Evans 2020-09-29 18:53:49 -04:00
parent ab033327c7
commit 31549cdc10
4 changed files with 22 additions and 13 deletions

View File

@ -308,9 +308,11 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Component can be freely moved and auto placed. User "
"can arbitrarily select and edit component's pads." ) );
m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Component can be freely moved and auto placed, but "
"its pads cannot be selected or edited." ) );
"its pads cannot be edited." ) );
m_AutoPlaceCtrl->SetItemToolTip( 2, _( "Component is locked: it cannot be freely moved or "
"auto placed." ) );
"auto placed, and can only be selected when the "
"\"Locked items\" checkbox is enabled in the "
"selection filter." ) );
m_CostRot90Ctrl->SetValue( m_footprint->GetPlacementCost90() );
m_CostRot180Ctrl->SetValue( m_footprint->GetPlacementCost180() );

View File

@ -742,11 +742,23 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// Display properties dialog
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
// Do not handle undo buffer, it is done by the properties dialogs
editFrame->OnEditItemRequest( item );
// Pads on a locked footprint can be selected but not edited
if( item->Type() == PCB_PAD_T && item->GetParent() &&
( static_cast<D_PAD*>( item )->GetParent()->IsLocked() ||
static_cast<D_PAD*>( item )->GetParent()->PadsLocked() ) )
{
m_statusPopup->SetText( _( "Locked items cannot be edited" ) );
m_statusPopup->PopupFor( 2000 );
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
}
else
{
// Do not handle undo buffer, it is done by the properties dialogs
editFrame->OnEditItemRequest( item );
// Notify other tools of the changes
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
// Notify other tools of the changes
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
}
}
else if( selection.Size() == 0 && getView()->IsLayerVisible( LAYER_WORKSHEET ) )
{

View File

@ -201,7 +201,8 @@ public:
wxPoint shapePos = pad->ShapePos();
wxPoint halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 );
if( pad->GetParent() && pad->GetParent()->PadsLocked() )
if( pad->GetParent() &&
( pad->GetParent()->IsLocked() || pad->GetParent()->PadsLocked() ) )
break;
switch( pad->GetShape() )

View File

@ -1490,12 +1490,6 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
if( !m_filter.pads )
return false;
// Parent footprint locking should apply to pads also
D_PAD* pad = static_cast<D_PAD*>( aItem );
if( !m_filter.lockedItems && pad->GetParent() && pad->GetParent()->IsLocked() )
return false;
break;
}