Special handling for presence of Ref or Value in groups.

Fixes https://gitlab.com/kicad/code/kicad/issues/6677
This commit is contained in:
Jeff Young 2020-12-08 23:43:39 +00:00
parent c87a1ca17a
commit 5e9d9f5753
2 changed files with 13 additions and 2 deletions

View File

@ -94,13 +94,16 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
m_thermalWidth = aFootprint.m_thermalWidth;
m_thermalGap = aFootprint.m_thermalGap;
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
// Copy reference and value.
m_reference = new FP_TEXT( *aFootprint.m_reference );
m_reference->SetParent( this );
ptrMap[ aFootprint.m_reference ] = m_reference;
m_value = new FP_TEXT( *aFootprint.m_value );
m_value->SetParent( this );
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
ptrMap[ aFootprint.m_value ] = m_value;
// Copy pads
for( PAD* pad : aFootprint.Pads() )

View File

@ -1396,6 +1396,14 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
{
if( bItem->GetParent() && bItem->GetParent()->Type() == PCB_FOOTPRINT_T )
{
// Silently ignore delete of Reference or Value if they happen to be in
// group.
if( bItem->Type() == PCB_FP_TEXT_T )
{
if( static_cast<FP_TEXT*>( bItem )->GetType() != FP_TEXT::TEXT_is_DIVERS )
return;
}
m_commit->Modify( bItem->GetParent() );
getView()->Remove( bItem );
bItem->GetParent()->Remove( bItem );